SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::attribute::ItemDefinitionManager Class Reference

A manager for custom (i.e. More...

#include <ItemDefinitionManager.h>

Inheritance diagram for smtk::attribute::ItemDefinitionManager:
[legend]
Collaboration diagram for smtk::attribute::ItemDefinitionManager:
[legend]

Public Member Functions

 smtkTypedefs (smtk::attribute::ItemDefinitionManager)
 
 ItemDefinitionManager (const ItemDefinitionManager &)=delete
 
 ItemDefinitionManager (ItemDefinitionManager &&)=delete
 
ItemDefinitionManageroperator= (const ItemDefinitionManager &)=delete
 
ItemDefinitionManageroperator= (ItemDefinitionManager &&)=delete
 
bool registerResourceManager (smtk::resource::Manager::Ptr &)
 Register to a resource manager. More...
 
bool registerDefinitionsTo (smtk::attribute::Resource::Ptr &resource) const
 Explicilty add the contained custom item definitions to an attribute resource.
 
template<typename CustomDefinitionType >
bool registerDefinition ()
 Register <CustomItemDefinitionType> to all attribute resources.
 
template<typename CustomDefinitionType >
bool unregisterDefinition ()
 Unregister <CustomItemDefinitionType> from all attribute resources.
 
template<typename Tuple >
bool registerDefinitions ()
 Register multiple definitions to all attribute resources.
 
template<typename Tuple >
bool unregisterDefinitions ()
 Unregister multiple definitions from all attribute resources.
 

Static Public Member Functions

static std::shared_ptr< ItemDefinitionManagercreate ()
 

Protected Member Functions

 ItemDefinitionManager (const std::shared_ptr< smtk::resource::Manager > &)
 
template<std::size_t I, typename Tuple >
std::enable_if< I !=std::tuple_size< Tuple >::value, bool >::type registerDefinitions ()
 
template<std::size_t I, typename Tuple >
std::enable_if< I==std::tuple_size< Tuple >::value, bool >::type registerDefinitions ()
 
template<std::size_t I, typename Tuple >
std::enable_if< I !=std::tuple_size< Tuple >::value, bool >::type unregisterDefinitions ()
 
template<std::size_t I, typename Tuple >
std::enable_if< I==std::tuple_size< Tuple >::value, bool >::type unregisterDefinitions ()
 

Protected Attributes

std::unordered_map< std::size_t, std::function< void(smtk::attribute::Resource &)> > m_registerFunctions
 
std::weak_ptr< smtk::resource::Managerm_manager
 
std::unordered_map< std::size_t, smtk::resource::Observers::Key > m_observers
 

Detailed Description

A manager for custom (i.e.

user-defined) item definitions.

ItemDefinitionManager is an interface for registering user-defined item definitions. SMTK Plugins can interact with the ItemDefinitionManager by adding methods similar to the following to their Registrar:

registerTo(const smtk::attribute::ItemDefinitionManager::Ptr& manager) { manager->registerDefinition<MyCustomItemDefinition>(); }

unregisterFrom(const smtk::attribute::ItemDefinitionManager::Ptr& manager) { manager->unregisterDefinition<MyCustomItemDefinition>(); }

Additionally, the smtk_add_plugin() call for the plugin should be extended to include smtk::attribute::ItemDefinitionManager in its list of managers. Upon registration, attribute resources (a) associated with the same resource manager as the ItemDefinitionManager or (b) constructed by an operation that is managed by an operation manager with access to the ItemDefinitionManager will be able to read, write and create attributes that contain the newly registered custom items.

Member Function Documentation

◆ registerResourceManager()

bool smtk::attribute::ItemDefinitionManager::registerResourceManager ( smtk::resource::Manager::Ptr &  )

Register to a resource manager.

All attribute resources managed by the resource manager (both preexisting and resources subsequently added to the resource manager) will be able to read, write and create attributes that contain definitions registered to this class.


The documentation for this class was generated from the following files: