SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_resource_Metadata_h
12 #define smtk_resource_Metadata_h
14 #include "smtk/CoreExports.h"
16 #include "smtk/common/Managers.h"
17 #include "smtk/common/UUID.h"
18 #include "smtk/resource/MetadataObserver.h"
19 #include "smtk/resource/Resource.h"
47 typedef std::function<void(
const Metadata&)> Visitor;
48 typedef MetadataObserver Observer;
53 Resource::Index index,
54 std::set<Resource::Index> parentIndices,
57 createFunctor =
nullptr,
58 std::function<
ResourcePtr(
const std::string&,
const std::shared_ptr<smtk::common::Managers>&)>
59 readFunctor =
nullptr,
60 std::function<
bool(
const ResourcePtr&,
const std::shared_ptr<smtk::common::Managers>&)>
61 writeFunctor =
nullptr)
64 , m_parentIndices(parentIndices)
71 this->
create = createFunctor;
75 this->
read = readFunctor;
79 this->
write = writeFunctor;
83 const std::string&
typeName()
const {
return m_typeName; }
84 const Resource::Index& index()
const {
return m_index; }
88 bool isOfType(
const Resource::Index& index)
const
90 return m_parentIndices.find(index) != m_parentIndices.end();
98 [
this](
const smtk::common::UUID& uid,
const shared_ptr<smtk::common::Managers>& managers) {
106 std::function<
ResourcePtr(
const std::string&,
const std::shared_ptr<smtk::common::Managers>&)>
108 [
this](
const std::string& filename,
const std::shared_ptr<smtk::common::Managers>& managers) {
116 std::function<bool(
const ResourcePtr&,
const std::shared_ptr<smtk::common::Managers>&)>
write =
117 [
this](
const ResourcePtr& resource,
const std::shared_ptr<smtk::common::Managers>& managers) {
124 std::string m_typeName;
125 Resource::Index m_index;
126 std::set<Resource::Index> m_parentIndices;
131 #endif // smtk_resource_Metadata_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
An Observer is a functor that is called when certain actions are performed.
Definition: Observers.h:66
smtk::common::Singleton< detail::Manager > Manager
The Manager is a singleton interface for registering available plugins to manager instances.
Definition: Manager.h:92
std::string typeName()
Return the name of a class.
Definition: TypeName.h:289
A resource Manager is responsible for tracking currently allocated resources, creating new resources ...
Definition: Manager.h:47
smtk::shared_ptr< smtk::resource::Resource > ResourcePtr
Definition: PublicPointerDefs.h:302