SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Resource.h
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 
11 #ifndef smtk_geometry_Resource_h
12 #define smtk_geometry_Resource_h
13 
14 #include "smtk/resource/DerivedFrom.h"
15 #include "smtk/resource/Resource.h"
16 
17 #include "smtk/geometry/Backend.h"
18 #include "smtk/geometry/Geometry.h"
19 
20 #include <memory>
21 
22 namespace smtk
23 {
25 namespace geometry
26 {
27 
28 class Backend;
29 class Geometry;
30 class Manager;
31 
33 class SMTKCORE_EXPORT Resource
34  : public smtk::resource::DerivedFrom<Resource, smtk::resource::Resource>
35 {
36 public:
40 
41  ~Resource() override;
42 
48  std::unique_ptr<Geometry>& geometry(const Backend& backend);
49 
68  std::unique_ptr<Geometry>& geometry();
69 
88  void visitGeometry(std::function<void(std::unique_ptr<Geometry>&)> visitor);
89 
90  Resource(Resource&&) = default;
91 
92 protected:
94  Resource(const smtk::common::UUID& myID);
95  Resource(smtk::resource::ManagerPtr manager = nullptr);
96 
97 private:
98  std::map<Backend::index_t, std::unique_ptr<Geometry>> m_geometry;
99 };
100 
101 } // namespace geometry
102 } // namespace smtk
103 
104 #endif // smtk_geometry_Resource_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::resource::DerivedFrom
Derived resources are subclassed from smtk::resource::Resource.
Definition: DerivedFrom.h:32
smtk::common::UUID
Definition: UUID.h:38
smtkSharedFromThisMacro
#define smtkSharedFromThisMacro(...)
A macro to help with derived classes whose bases enable shared_from_this().
Definition: SharedFromThis.h:190
smtkTypeMacro
#define smtkTypeMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:51
smtk::plugin::Manager
smtk::common::Singleton< detail::Manager > Manager
The Manager is a singleton interface for registering available plugins to manager instances.
Definition: Manager.h:92
smtkSuperclassMacro
#define smtkSuperclassMacro(...)
Add a typedef to the superclass of this class.
Definition: SharedFromThis.h:87
smtk::geometry::Backend
This is an empty class used by geometry providers to specify their interface.
Definition: Backend.h:28
smtk::resource::PersistentObject
An abstract base class for SMTK resources and their components.
Definition: PersistentObject.h:39
smtk::resource::ManagerPtr
smtk::shared_ptr< smtk::resource::Manager > ManagerPtr
Definition: PublicPointerDefs.h:281
smtk::geometry::Resource
An abstract base class for SMTK resources that provide geometry for themselves and/or their component...
Definition: Resource.h:33