| 12 | { |
| 13 | public: |
| 14 | ALResult Get( std::shared_ptr<ObjectType>& object, const CreateArgument& argument, Tr2PrimaryRenderContextAL& renderContext ) |
| 15 | { |
| 16 | auto found = m_objects.find( argument ); |
| 17 | if( found != m_objects.end() ) |
| 18 | { |
| 19 | if( !found->second->IsValid() ) |
| 20 | { |
| 21 | m_objects.erase( found ); |
| 22 | } |
| 23 | else |
| 24 | { |
| 25 | object = found->second; |
| 26 | return S_OK; |
| 27 | } |
| 28 | } |
| 29 | auto newObject = std::make_shared<ObjectType>(); |
| 30 | CR_RETURN_HR( newObject->Create( argument, renderContext ) ); |
| 31 | m_objects[argument] = newObject; |
| 32 | object = newObject; |
| 33 | return S_OK; |
| 34 | } |
| 35 | |
| 36 | void Clear() |
| 37 | { |
no test coverage detected