SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Resources are registered to a resource manager at runtime with an instance of smtk::resource::Metadata. More...
#include <Metadata.h>
Public Types | |
typedef std::function< void(const Metadata &)> | Visitor |
typedef MetadataObserver | Observer |
typedef MetadataObservers | Observers |
Public Member Functions | |
Metadata (const std::string &typeName, Resource::Index index, std::set< Resource::Index > parentIndices, std::function< ResourcePtr(const smtk::common::UUID &, const std::shared_ptr< smtk::common::Managers > &)> createFunctor=nullptr, std::function< ResourcePtr(const std::string &, const std::shared_ptr< smtk::common::Managers > &)> readFunctor=nullptr, std::function< bool(const ResourcePtr &, const std::shared_ptr< smtk::common::Managers > &)> writeFunctor=nullptr) | |
const std::string & | typeName () const |
const Resource::Index & | index () const |
bool | isOfType (const Resource::Index &index) const |
Public Attributes | |
std::function< ResourcePtr(const smtk::common::UUID &, const shared_ptr< smtk::common::Managers > &)> | create |
A method that can be called to create a resource of the metadata's type. More... | |
std::function< ResourcePtr(const std::string &, const std::shared_ptr< smtk::common::Managers > &)> | read |
A method that can be called to read a resource of the metadata's type from a file. More... | |
std::function< bool(const ResourcePtr &, const std::shared_ptr< smtk::common::Managers > &)> | write |
A method that can be called to write a resource of the metadata's type. More... | |
Friends | |
class | Manager |
The Manager is a singleton interface for registering available plugins to manager instances. More... | |
Resources are registered to a resource manager at runtime with an instance of smtk::resource::Metadata.
Instances of this class must provide typeName, a unique (to the manager) string used to describe the resource within the manager. They may also provide functors for the creation and serialization/deserialization of the resource to/from disk (create, write and read, respectively). There are two variants of the read, write, and create methods: one takes a shared-pointer to an smtk::common::Managers instance and the other does not. The former is preferred.
|
friend |
The Manager is a singleton interface for registering available plugins to manager instances.
When a plugin is loaded, it creates a Client that adds itself to Manager's set of Client weak_ptrs. When a manager instance is passed into the Manager's "registerPluginsTo" method, each Client in the set that accepts a manager of this type constructs a Registry that tethers the scope of the manager's ability to use features from the plugin to the lifetime of the Registry object. Additionally, when a manager is passed into this class a register function is created that facilitates the registration of future plugins to the manager.
std::function<ResourcePtr(const smtk::common::UUID&, const shared_ptr<smtk::common::Managers>&)> smtk::resource::Metadata::create |
A method that can be called to create a resource of the metadata's type.
Provide a default method that returns a null pointer.
std::function<ResourcePtr(const std::string&, const std::shared_ptr<smtk::common::Managers>&)> smtk::resource::Metadata::read |
A method that can be called to read a resource of the metadata's type from a file.
Provide a default that does nothing but return a null pointer.
std::function<bool(const ResourcePtr&, const std::shared_ptr<smtk::common::Managers>&)> smtk::resource::Metadata::write |
A method that can be called to write a resource of the metadata's type.
Provide a default that does nothing and always returns false.