SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Namespaces | Classes | Typedefs | Enumerations | Functions
smtk::resource Namespace Reference

A common base class for resources (data stored in files) and tools to manage them. More...

Namespaces

 detail
 Global access methods used to sort Container data.
 
 properties
 Namespace for non-POD data that can be attached to resources and components.
 

Classes

struct  AliasTag
 
class  Component
 Component is the base class for records stored in an smtk::resource::Resource. More...
 
class  ConstPropertiesOfType
 A specialization of the Properties container for a single type. More...
 
class  DerivedFrom
 Derived resources are subclassed from smtk::resource::Resource. More...
 
class  GarbageCollector
 A class that owns ephemeral objects and remove them when abandoned. More...
 
struct  IdTag
 Tags used to access Container data. More...
 
struct  IndexTag
 
class  Key
 Operations need the ability to lock and unlock resources, but no additional access privilege is required. More...
 
struct  LinkInformation
 Given a Key, Information about the object to which a link connects can be returned. More...
 
class  Links
 Links is a virtual class describing the API for connecting one resource/component to another resource/component. More...
 
struct  LocationTag
 
class  Lock
 A read/write lock for resources. More...
 
class  Manager
 A resource Manager is responsible for tracking currently allocated resources, creating new resources and serializing/deserializing resources to/from disk. More...
 
class  Metadata
 Resources are registered to a resource manager at runtime with an instance of smtk::resource::Metadata. More...
 
struct  NameTag
 
class  PersistentObject
 An abstract base class for SMTK resources and their components. More...
 
class  Properties
 Resource/Component properties store data as maps from UUIDs to values and present data as key/value pairs on Resources/Components themselves. More...
 
class  PropertiesOfType
 A specialization of the Properties container for a single type. More...
 
class  Registrar
 
class  Resource
 An abstract base class for SMTK resources. More...
 
class  ScopedLockGuard
 A scope-guarded utility for handling locks. More...
 
class  Surrogate
 A resource Surrogate is a stand-in for an actual resource. More...
 

Typedefs

typedef smtk::shared_ptr< smtk::resource::ManagerManagerPtr
 
typedef smtk::weak_ptr< smtk::resource::ManagerWeakManagerPtr
 
typedef smtk::shared_ptr< smtk::resource::PersistentObjectPersistentObjectPtr
 
typedef smtk::shared_ptr< const smtk::resource::PersistentObjectConstPersistentObjectPtr
 
typedef smtk::weak_ptr< smtk::resource::PersistentObjectWeakPersistentObjectPtr
 
typedef std::set< smtk::resource::PersistentObjectPtrPersistentObjectSet
 
typedef smtk::shared_ptr< smtk::resource::ResourceResourcePtr
 
typedef smtk::shared_ptr< smtk::resource::ComponentComponentPtr
 
typedef smtk::weak_ptr< smtk::resource::ResourceWeakResourcePtr
 
typedef smtk::shared_ptr< smtk::resource::Set > SetPtr
 
typedef smtk::shared_ptr< const smtk::resource::ComponentConstComponentPtr
 
typedef smtk::shared_ptr< const smtk::resource::ResourceConstResourcePtr
 
typedef smtk::shared_ptr< const smtk::resource::Set > ConstSetPtr
 
typedef std::vector< smtk::resource::PersistentObjectPtrPersistentObjectArray
 
typedef std::vector< smtk::resource::ResourcePtrResourceArray
 
typedef std::vector< smtk::resource::ComponentPtrComponentArray
 
typedef std::set< smtk::resource::ResourcePtrResourceSet
 
typedef std::set< smtk::resource::ComponentPtrComponentSet
 
typedef boost::multi_index_container< ResourcePtr, indexed_by< ordered_unique< tag< IdTag >, global_fun< const ResourcePtr &, const smtk::common::UUID &, &detail::id > >, ordered_non_unique< tag< IndexTag >, global_fun< const ResourcePtr &, smtk::resource::Resource::Index, &detail::index > >, ordered_non_unique< tag< NameTag >, global_fun< const ResourcePtr &, std::string, &detail::name > >, ordered_non_unique< tag< LocationTag >, global_fun< const ResourcePtr &, const std::string &, &detail::location > > > > Container
 A multi-index container for accessing resources. More...
 
using GarbageCollectorPtr = std::shared_ptr< GarbageCollector >
 
typedef boost::multi_index_container< Metadata, indexed_by< ordered_unique< tag< NameTag >, const_mem_fun< Metadata, const std::string &, &Metadata::typeName > >, ordered_unique< tag< IndexTag >, const_mem_fun< Metadata, const smtk::resource::Resource::Index &, &Metadata::index > > > > MetadataContainer
 A multi-index container for accessing resource metadata. More...
 
typedef std::function< void(const Metadata &, bool)> MetadataObserver
 
typedef smtk::common::Observers< MetadataObserver > MetadataObservers
 
typedef std::function< void(const Resource &, EventType)> Observer
 
typedef smtk::common::Observers< Observer > Observers
 
typedef double Float
 
typedef std::vector< Float > FloatList
 
typedef std::map< std::string, FloatList > FloatData
 
typedef std::map< smtk::common::UUID, FloatData > UUIDsToFloatData
 
typedef UUIDsToFloatData::iterator UUIDWithFloatProperties
 
typedef FloatData::iterator PropertyNameWithFloats
 
typedef FloatData::const_iterator PropertyNameWithConstFloats
 
typedef std::string String
 Use std::string for holding string values.
 
typedef std::vector< StringStringList
 Use vectors of String objects for holding string properties on model entities.
 
typedef std::map< std::string, StringListStringData
 A dictionary of property names mapped to their values (string vectors)
 
typedef std::map< smtk::common::UUID, StringDataUUIDsToStringData
 A dictionary of model entities mapped to all the string properties defined on them.
 
typedef UUIDsToStringData::iterator UUIDWithStringProperties
 A convenient typedef that describes how an iterator to model-entity string properties is used.
 
typedef StringData::iterator PropertyNameWithStrings
 A convenient typedef that describes how the iterator to one string property is used.
 
typedef StringData::const_iterator PropertyNameWithConstStrings
 A convenient typedef that describes how the const_iterator to one string property is used.
 
typedef long Integer
 
typedef std::vector< long > IntegerList
 
typedef std::map< std::string, IntegerList > IntegerData
 
typedef std::map< smtk::common::UUID, IntegerData > UUIDsToIntegerData
 
typedef UUIDsToIntegerData::iterator UUIDWithIntegerProperties
 
typedef IntegerData::iterator PropertyNameWithIntegers
 
typedef IntegerData::const_iterator PropertyNameWithConstIntegers
 

Enumerations

enum  LockType { DoNotLock = 0, Unlocked = 0, Read, Write }
 
enum  EventType { EventType::ADDED, EventType::MODIFIED, EventType::REMOVED }
 Enumerate events that the resource manager may encounter. More...
 
enum  PropertyType { FLOAT_PROPERTY, STRING_PROPERTY, INTEGER_PROPERTY, INVALID_PROPERTY }
 Primitive storage types for model properties. More...
 

Functions

bool registerPythonResource (const smtk::resource::Manager::Ptr &resourceManager, const std::string &moduleName)
 
template<typename QueryType >
SMTKCORE_NO_EXPORT QueryType & queryForObject (const PersistentObject &object)
 Given an object, return a query for interrogating it. More...
 

Detailed Description

A common base class for resources (data stored in files) and tools to manage them.

A set of classes exist for presenting model information to users. DescriptivePhrase is an abstract base class with subclasses in other SMTK subsystems for presenting information about their components. ComponentListPhrase presents a "folder"-like item that holds an array of phrases describing components. Similarly, PropertyListPhrase and PropertyValuePhrase hold information about string, floating-point, and integer data indexed by resource and component UUIDs.

These instances are placed into a hierarchy that describe the model in a context. Consider these examples specific to SMTK's modeling subsystem: in a functional modeling context, perhaps only descriptions of models and their groups will be displayed. When assigning geometry to functional groups, perhaps only geometric cells of a particular dimension will be shown. The SubphraseGenerator class is what determines the particular hierarchy, and a subclass will generally be written for each context in which resource components should be presented.

Typedef Documentation

◆ ComponentArray

See also
ComponentPtr

◆ ComponentPtr

◆ ComponentSet

See also
ComponentPtr

◆ ConstComponentPtr

◆ ConstPersistentObjectPtr

◆ ConstResourcePtr

◆ ConstSetPtr

typedef smtk::shared_ptr<const smtk::resource::Set> smtk::resource::ConstSetPtr
See also
smtk::resource::Set

◆ Container

typedef boost::multi_index_container< ResourcePtr, indexed_by< ordered_unique< tag<IdTag>, global_fun<const ResourcePtr&, const smtk::common::UUID&, &detail::id> >, ordered_non_unique< tag<IndexTag>, global_fun<const ResourcePtr&, smtk::resource::Resource::Index, &detail::index> >, ordered_non_unique<tag<NameTag>, global_fun<const ResourcePtr&, std::string, &detail::name> >, ordered_non_unique< tag<LocationTag>, global_fun<const ResourcePtr&, const std::string&, &detail::location> > > > smtk::resource::Container

A multi-index container for accessing resources.

This class is primarily intended to be used in the implementation of smtk::resource::Manager only.

◆ ManagerPtr

◆ MetadataContainer

typedef boost::multi_index_container< Metadata, indexed_by< ordered_unique<tag<NameTag>, const_mem_fun<Metadata, const std::string&, &Metadata::typeName> >, ordered_unique< tag<IndexTag>, const_mem_fun<Metadata, const smtk::resource::Resource::Index&, &Metadata::index> > > > smtk::resource::MetadataContainer

A multi-index container for accessing resource metadata.

This class is primarily intended to be used in the implementation of smtk::resource::Manager only.

◆ PersistentObjectArray

◆ PersistentObjectPtr

◆ PersistentObjectSet

◆ ResourceArray

See also
ResourcePtr

◆ ResourcePtr

◆ ResourceSet

See also
ResourcePtr

◆ SetPtr

typedef smtk::shared_ptr<smtk::resource::Set> smtk::resource::SetPtr
See also
smtk::resource::Set

◆ WeakManagerPtr

◆ WeakPersistentObjectPtr

◆ WeakResourcePtr

Enumeration Type Documentation

◆ EventType

Enumerate events that the resource manager may encounter.

Note that the resource modification event only fires when a resource's clean/dirty state changes, not for each modification: once a resource is dirty, further modifications are not reported. If you want to monitor each modification to a resource, you should observe operations via an operation manager.

Also, the MODIFIED signal is fired when a resource is marked clean not just when it is marked dirty.

Enumerator
ADDED 

A new resource's contents now available in memory.

MODIFIED 

an existing resource's clean/dirty state has changed.

REMOVED 

An existing resource's contents are being removed from memory.

◆ PropertyType

Primitive storage types for model properties.

Enumerator
FLOAT_PROPERTY 

Property is an array of floating-point numbers.

STRING_PROPERTY 

Property is an array of strings.

INTEGER_PROPERTY 

Property is an array of integers.

INVALID_PROPERTY 

Property has no storage.

Function Documentation

◆ queryForObject()

template<typename QueryType >
SMTKCORE_NO_EXPORT QueryType& smtk::resource::queryForObject ( const PersistentObject object)

Given an object, return a query for interrogating it.

This method will test whether the object is a resource (in which case it asks the resource to construct the query) or a component (in which case it asks the component's owning resource to construct the query).