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

Store information about attribute definitions and instances. More...

#include <Resource.h>

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

Classes

class  GuardedLinks
 

Public Types

typedef smtk::geometry::Resource ParentResource
 
- Public Types inherited from smtk::resource::DerivedFrom< Resource, smtk::geometry::Resource >
using ParentResource = smtk::geometry::Resource
 
using Superclass = smtk::geometry::Resource
 
using DirectSuperclass = DerivedFrom< Resource, smtk::geometry::Resource >
 
- Public Types inherited from smtk::resource::DerivedFrom< Resource, smtk::resource::Resource >
using ParentResource = smtk::resource::Resource
 
using Superclass = smtk::resource::Resource
 
using DirectSuperclass = DerivedFrom< Resource, smtk::resource::Resource >
 
- Public Types inherited from smtk::resource::Resource
typedef std::size_t Index
 
typedef smtk::resource::Metadata Metadata
 
typedef detail::ResourceLinks Links
 
typedef detail::ResourceProperties Properties
 
typedef query::Queries Queries
 

Public Member Functions

 smtkTypeMacro (smtk::attribute::Resource)
 
 smtkCreateMacro (smtk::attribute::Resource)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
bool setUnitsSystem (const shared_ptr< units::System > &unitsSystem) override
 Sets the system of units used by this resource.
 
smtk::attribute::DefinitionPtr createDefinition (const std::string &typeName, const std::string &baseTypeName="", const smtk::common::UUID &id=smtk::common::UUID::null())
 
smtk::attribute::DefinitionPtr createDefinition (const std::string &name, attribute::DefinitionPtr baseDefiniiton, const smtk::common::UUID &id=smtk::common::UUID::null())
 
bool removeDefinition (smtk::attribute::DefinitionPtr def)
 
void setIsPrivate (bool isPrivateValue)
 
bool isPrivate () const
 
const std::string & defaultNameSeparator () const
 Get the separator used for new Attributes whose names are not unique.
 
void resetDefaultNameSeparator ()
 Reset the separator used for new Attributes whose names are not unique to to the default which is '-'.
 
bool setDefaultNameSeparator (const std::string &separator)
 Set the separator used for new Attributes whose names are not unique.
 
smtk::attribute::AttributePtr createAttribute (attribute::DefinitionPtr def)
 
smtk::attribute::AttributePtr createAttribute (const std::string &type)
 
smtk::attribute::AttributePtr createAttribute (const std::string &name, const std::string &type, const smtk::common::UUID &id=smtk::common::UUID::null())
 
smtk::attribute::AttributePtr createAttribute (const std::string &name, attribute::DefinitionPtr def, const smtk::common::UUID &id=smtk::common::UUID::null())
 
bool removeAttribute (smtk::attribute::AttributePtr att)
 
smtk::attribute::AttributePtr findAttribute (const std::string &name) const
 
smtk::attribute::AttributePtr findAttribute (const smtk::common::UUID &id) const
 
smtk::attribute::AttributePtr findAttribute (const smtk::resource::ComponentPtr &comp, const smtk::resource::Links::RoleType &role) const
 
void addUniqueRoles (const std::set< smtk::resource::Links::RoleType > &roles)
 
void addUniqueRole (const smtk::resource::Links::RoleType &role)
 
const std::set< smtk::resource::Links::RoleType > & uniqueRoles () const
 
bool isRoleUnique (const smtk::resource::Links::RoleType &role) const
 
smtk::resource::ComponentPtr find (const smtk::common::UUID &id) const override
 Given a resource component's UUID, return the resource component.
 
std::function< bool(const smtk::resource::Component &)> queryOperation (const std::string &) const override
 Given a std::string describing a query, return a functor for performing the query. More...
 
void visit (smtk::resource::Component::Visitor &) const override
 
void findAttributes (const std::string &type, std::vector< smtk::attribute::AttributePtr > &result) const
 
std::vector< smtk::attribute::AttributePtrfindAttributes (const std::string &type) const
 
void findAttributes (smtk::attribute::DefinitionPtr def, std::vector< smtk::attribute::AttributePtr > &result) const
 
smtk::attribute::DefinitionPtr findDefinition (const std::string &type) const
 
smtk::attribute::DefinitionPtr findDefinition (const smtk::common::UUID &id) const
 
bool hasDefinition (const std::string &type) const
 Return true if the Resource has a Definition with the requested type.
 
void findBaseDefinitions (std::vector< smtk::attribute::DefinitionPtr > &result) const
 
void derivedDefinitions (smtk::attribute::DefinitionPtr def, std::vector< smtk::attribute::DefinitionPtr > &result) const
 
void findAllDerivedDefinitions (smtk::attribute::DefinitionPtr def, bool concreteOnly, std::vector< smtk::attribute::DefinitionPtr > &result) const
 
void findDefinitionAttributes (const std::string &type, std::vector< smtk::attribute::AttributePtr > &result) const
 
void findDefinitions (unsigned long mask, std::vector< smtk::attribute::DefinitionPtr > &result) const
 Find the attribute definitions that can be associated with mask.
 
smtk::attribute::ConstDefinitionPtr findIsUniqueBaseClass (smtk::attribute::ConstDefinitionPtr attDef) const
 
bool rename (AttributePtr att, const std::string &newName)
 
bool resetId (AttributePtr att, const smtk::common::UUID &newId)
 Changes the ID of an Attribute. More...
 
smtk::attribute::Analysesanalyses ()
 
std::size_t numberOfAdvanceLevels () const
 
void addAdvanceLevel (int level, std::string label, const double *l_color=nullptr)
 
const std::map< int, std::string > & advanceLevels () const
 
const double * advanceLevelColor (int level) const
 
void setAdvanceLevelColor (int level, const double *l_color)
 
std::string createUniqueName (const std::string &type) const
 
void finalizeDefinitions ()
 This method updates information passed down to Attribute and Item Definitions. More...
 
bool passActiveCategoryCheck (const smtk::common::Categories::Expression &cats) const
 
bool passActiveCategoryCheck (const smtk::common::Categories &cats) const
 
void addView (smtk::view::ConfigurationPtr)
 
smtk::view::ConfigurationPtr findView (const std::string &name) const
 
smtk::view::ConfigurationPtr findViewByType (const std::string &vtype) const
 
smtk::view::ConfigurationPtr findTopLevelView () const
 
std::vector< smtk::view::ConfigurationPtrfindTopLevelViews () const
 
const std::map< std::string, smtk::view::ConfigurationPtr > & views () const
 
smtk::resource::ResourceSet associations () const
 Return a set of resources associated to this attribute resource.
 
bool associate (const smtk::resource::ResourcePtr &resource)
 Add a resource to the set of associated resources, and return true if the association is successful.
 
bool disassociate (const smtk::resource::ResourcePtr &resource)
 Remove a resource from the set of associated resources, and return true if the disassociation is successful.
 
bool hasAssociations () const
 Returns true if the attribute resource has other resources associated with it.
 
std::set< AttributePtrattributes (const smtk::resource::ConstPersistentObjectPtr &object) const
 
bool hasAttributes (const smtk::resource::ConstPersistentObjectPtr &object) const
 
bool hasAttributes () const
 
void disassociateAllAttributes (const smtk::resource::PersistentObjectPtr &object)
 
void updateDerivedDefinitionIndexOffsets (smtk::attribute::DefinitionPtr def)
 
smtk::attribute::DefinitionPtr copyDefinition (smtk::attribute::DefinitionPtr def, unsigned int options=0)
 
void definitions (std::vector< smtk::attribute::DefinitionPtr > &result, bool sortList=false) const
 
void attributes (std::vector< smtk::attribute::AttributePtr > &result) const
 
smtk::attribute::EvaluatorFactoryevaluatorFactory ()
 
const smtk::attribute::EvaluatorFactoryevaluatorFactory () const
 
bool canEvaluate (smtk::attribute::ConstAttributePtr att)
 
std::unique_ptr< smtk::attribute::EvaluatorcreateEvaluator (smtk::attribute::ConstAttributePtr att)
 
smtk::attribute::SymbolDependencyStoragesymbolDependencyStorage ()
 
void setDirectoryInfo (const DirectoryInfo &dinfo)
 
const DirectoryInfo & directoryInfo () const
 
CustomItemDefinitionFactorycustomItemDefinitionFactory ()
 
const CustomItemDefinitionFactorycustomItemDefinitionFactory () const
 
AssociationRulesassociationRules ()
 
const AssociationRulesassociationRules () const
 
const GuardedLinks guardedLinks () const
 
GuardedLinks guardedLinks ()
 
std::mutex & mutex () const
 
bool setTemplateType (const smtk::string::Token &templateType) override
 Set/get the "type" of a resource's template. More...
 
smtk::string::Token templateType () const override
 Set/get the "type" of a resource's template. More...
 
bool setTemplateVersion (std::size_t templateVersion) override
 Set/get the version of the template this instance of the resource is based upon. More...
 
std::size_t templateVersion () const override
 Set/get the "type" of a resource's template. More...
 
std::shared_ptr< smtk::resource::Resourceclone (smtk::resource::CopyOptions &options) const override
 Create an empty, un-managed clone of this resource instance's meta information. More...
 
bool copyInitialize (const std::shared_ptr< const smtk::resource::Resource > &other, smtk::resource::CopyOptions &options) override
 Copy data from the other resource into this resource, as specified by options. More...
 
bool copyFinalize (const std::shared_ptr< const smtk::resource::Resource > &source, smtk::resource::CopyOptions &options) override
 Copy attribute resource contents. More...
 
void copyViews (const std::shared_ptr< const smtk::attribute::Resource > &source, smtk::resource::CopyOptions &options)
 Copy View Information from the source resource into this resource, as specified by options.
 
void updateViewComponentIdAttributes (smtk::view::Configuration::Component &comp, smtk::resource::CopyOptions &options)
 Update ID information of a View Component using the object mapping (if provided) More...
 
std::size_t numberOfCategories () const
 API for accessing Category information. More...
 
const std::set< std::string > & categories () const
 API for accessing Category information. More...
 
void setActiveCategoriesEnabled (bool mode)
 API for setting and accessing Active Category information. More...
 
bool activeCategoriesEnabled () const
 API for setting and accessing Active Category information. More...
 
void setActiveCategories (const std::set< std::string > &cats)
 API for setting and accessing Active Category information. More...
 
const std::set< std::string > & activeCategories () const
 API for setting and accessing Active Category information. More...
 
void addStyle (const std::string &definitionType, smtk::view::Configuration::Component style)
 API for setting and accessing style information. More...
 
const smtk::view::Configuration::ComponentfindStyle (const smtk::attribute::DefinitionPtr &def, const std::string &styleName="") const
 API for setting and accessing style information. More...
 
const std::map< std::string, smtk::view::Configuration::Component > & findStyles (const smtk::attribute::DefinitionPtr &def) const
 API for setting and accessing style information. More...
 
const std::map< std::string, std::map< std::string, smtk::view::Configuration::Component > > & styles () const
 API for setting and accessing style information. More...
 
smtk::attribute::AttributePtr copyAttribute (const smtk::attribute::AttributePtr &att, const CopyAssignmentOptions &options, smtk::io::Logger &logger)
 Copies an attribute. More...
 
smtk::attribute::AttributePtr copyAttribute (const smtk::attribute::AttributePtr &att, const CopyAssignmentOptions &options=CopyAssignmentOptions())
 Copies an attribute. More...
 
- Public Member Functions inherited from smtk::resource::DerivedFrom< Resource, smtk::geometry::Resource >
bool isOfType (const Resource::Index &index) const override
 given a resource index, return whether or not this resource is or is derived from the resource described by the index.
 
bool isOfType (const std::string &typeName) const override
 given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name.
 
int numberOfGenerationsFromBase (const std::string &typeName) const override
 
 DerivedFrom (const DerivedFrom &)=delete
 
- Public Member Functions inherited from smtk::geometry::Resource
 smtkTypeMacro (smtk::geometry::Resource)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
std::unique_ptr< Geometry > & geometry (const Backend &backend)
 Given a backend, return a provider of geometry for that backend. More...
 
std::unique_ptr< Geometry > & geometry ()
 Return the first geometry provider (for any backend). More...
 
void visitGeometry (std::function< void(std::unique_ptr< Geometry > &)> visitor)
 Visit all existing geometry providers for this resource. More...
 
void visitGeometry (std::function< void(const std::unique_ptr< Geometry > &)> visitor) const
 
 Resource (Resource &&)=default
 
void copyGeometry (const std::shared_ptr< const Resource > &source, smtk::resource::CopyOptions &options)
 Copy renderable geometry from source into this resource. More...
 
- Public Member Functions inherited from smtk::resource::DerivedFrom< Resource, smtk::resource::Resource >
bool isOfType (const Resource::Index &index) const override
 given a resource index, return whether or not this resource is or is derived from the resource described by the index.
 
bool isOfType (const std::string &typeName) const override
 given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name.
 
int numberOfGenerationsFromBase (const std::string &typeName) const override
 
 DerivedFrom (const DerivedFrom &)=delete
 
- Public Member Functions inherited from smtk::resource::Resource
 smtkTypeMacro (smtk::resource::Resource)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
ResourceparentResource () const override
 Return a raw (not shared) pointer to the resource that owns this resource. More...
 
void setParentResource (Resource *newParent)
 Sets the parent resource for this resource. More...
 
bool setManager (ManagerPtr newManager)
 Set the manager that the resource will use to decode its link information. More...
 
 Resource (Resource &&) noexcept
 
virtual Index index () const
 Index is a compile-time intrinsic of the derived resource's type; as such, it cannot be set.
 
template<class ResourceType >
bool isOfType () const
 Given a resource type, return whether or not this resource is or is derived from the resource described by the index.
 
const smtk::common::UUIDid () const override
 Set/get the UUID of a resource. More...
 
bool setId (const smtk::common::UUID &myID) override
 Set/get the UUID of a resource. More...
 
const std::string & location () const
 Set/get the location (a URL) where the resource is stored persistently. More...
 
virtual bool setLocation (const std::string &location)
 Set/get the location (a URL) where the resource is stored persistently. More...
 
std::string name () const override
 Set/get the user-assigned name of the resource. More...
 
virtual bool setName (const std::string &name)
 Set/get the user-assigned name of the resource. More...
 
bool isNameSet () const
 Set/get the user-assigned name of the resource. More...
 
virtual bool clean () const
 Resources that have a non-empty location and are identical to the data stored at location are clean. More...
 
void setClean (bool state=true)
 Resources that have a non-empty location and are identical to the data stored at location are clean. More...
 
void setMarkedForRemoval (bool val)
 Mark the resource to indicate it is about to removed (meaning it is being removed from memory not necessarily for deletion)
 
virtual bool isMarkedForRemoval () const
 Return whether the object is marked for removal.
 
ManagerPtr manager () const
 Resources that are managed have a non-null pointer to their manager.
 
virtual Componentcomponent (const smtk::common::UUID &compId) const
 Given a component's UUID, return a raw pointer to the component.
 
template<typename ComponentType >
ComponentType * componentAs (const smtk::common::UUID &uuid) const
 A templated version of component() that casts its result to a type. More...
 
virtual void visit (std::function< void(const ComponentPtr &)> &v) const =0
 visit all components in a resource.
 
ComponentSet filter (const std::string &queryString) const
 Given a resource component's UUID, return the resource component.
 
template<typename Collection >
Collection filterAs (const std::string &queryString) const
 given a a std::string describing a query and a type of container, return a set of components that satisfy both. More...
 
Linkslinks () override
 Fetch the links stored for this resource and its components.
 
const Linkslinks () const override
 Fetch the links stored for this resource and its components.
 
Propertiesproperties () override
 
const Propertiesproperties () const override
 
const Queriesqueries () const
 
Queriesqueries ()
 
Locklock (Key()) const
 Classes that are granted permission to the key may retrieve the resource's lock. More...
 
LockType locked () const
 Anyone can query whether or not the resource is locked.
 
const shared_ptr< units::System > & unitsSystem () const
 Gets the system of units used by this resource.
 
void copyUnitSystem (const std::shared_ptr< const Resource > &rsrc, const CopyOptions &options)
 Copy the units system from rsrc into this resource as specified by options. More...
 
void copyProperties (const std::shared_ptr< const Resource > &rsrc, CopyOptions &options)
 Copy all property data from rsrc, mapping them along the way via options. More...
 
- Public Member Functions inherited from smtk::resource::PersistentObject
 smtkTypeMacroBase (smtk::resource::PersistentObject)
 
template<typename T >
T::Ptr as ()
 Attempt to cast this object to a subclass.
 
template<typename T >
T::ConstPtr as () const
 Attempt to cast this object to a subclass.
 

Static Public Member Functions

static constexpr smtk::resource::Links::RoleType associationRole ()
 
static constexpr smtk::resource::Links::RoleType referenceRole ()
 
static filter::GrammarInfo extractGrammarInfo (const std::string &s)
 
static std::string createAttributeQuery (const smtk::attribute::DefinitionPtr &def)
 Given an attribute definition, construct a valid query to retrive attributes of that type.
 
static std::string createAttributeQuery (const std::string &defType)
 
- Static Public Member Functions inherited from smtk::resource::Resource
static constexpr smtk::resource::Links::RoleType visuallyLinkedRole ()
 

Static Public Attributes

static constexpr smtk::resource::Links::RoleType AssociationRole = -1
 Link from an attribute to persistent objects which manifest, exhibit, or possess the attribute.
 
static constexpr smtk::resource::Links::RoleType ReferenceRole = -2
 Link from an attribute item to persistent objects which the item contains or references.
 
- Static Public Attributes inherited from smtk::resource::DerivedFrom< Resource, smtk::geometry::Resource >
static const Resource::Index type_index
 A static index for this resource type. More...
 
- Static Public Attributes inherited from smtk::resource::DerivedFrom< Resource, smtk::resource::Resource >
static const Resource::Index type_index
 A static index for this resource type. More...
 
- Static Public Attributes inherited from smtk::resource::Resource
static const Resource::Index type_index = std::type_index(typeid(Resource)).hash_code()
 
static constexpr smtk::resource::Links::RoleType VisuallyLinkedRole = -4
 A role for components that implies their visibility in renderings should be linked to another object. More...
 

Protected Member Functions

 Resource (const smtk::common::UUID &myID, smtk::resource::ManagerPtr manager)
 
 Resource (smtk::resource::ManagerPtr manager=nullptr)
 
void internalFindAllDerivedDefinitions (smtk::attribute::DefinitionPtr def, bool onlyConcrete, std::vector< smtk::attribute::DefinitionPtr > &result) const
 
void internalFindAttributes (attribute::DefinitionPtr def, std::vector< smtk::attribute::AttributePtr > &result) const
 
bool copyDefinitionImpl (smtk::attribute::DefinitionPtr sourceDef, smtk::attribute::ItemDefinition::CopyInfo &info)
 
- Protected Member Functions inherited from smtk::resource::DerivedFrom< Resource, smtk::geometry::Resource >
 DerivedFrom (T &&... all)
 Forward all constructor arguments to the parent class.
 
 DerivedFrom (DerivedFrom &&rhs) noexcept=default
 
- Protected Member Functions inherited from smtk::geometry::Resource
 Resource (const smtk::common::UUID &myID, smtk::resource::ManagerPtr manager)
 
 Resource (const smtk::common::UUID &myID)
 
 Resource (smtk::resource::ManagerPtr manager=nullptr)
 
- Protected Member Functions inherited from smtk::resource::DerivedFrom< Resource, smtk::resource::Resource >
 DerivedFrom (T &&... all)
 Forward all constructor arguments to the parent class.
 
 DerivedFrom (DerivedFrom &&rhs) noexcept=default
 
- Protected Member Functions inherited from smtk::resource::Resource
 Resource (const smtk::common::UUID &, ManagerPtr manager=nullptr)
 
 Resource (ManagerPtr manager=nullptr)
 
bool copyPropertiesForId (const std::shared_ptr< Resource > &rsrc, const smtk::common::UUID &sourceId, const smtk::common::UUID &targetId, const CopyOptions &options)
 Copy all property data for sourceId from rsrc into targetId of this resource. More...
 
void copyLinks (const std::shared_ptr< const Resource > &rsrc, const CopyOptions &options)
 Copy links from rsrc (except those excluded by options), mapping them along the way. More...
 

Protected Attributes

std::map< std::string, smtk::attribute::DefinitionPtrm_definitions
 
std::map< std::string, std::set< smtk::attribute::AttributePtr, Attribute::CompareByName > > m_attributeClusters
 
std::map< std::string, smtk::attribute::AttributePtrm_attributes
 
std::map< smtk::common::UUID, smtk::attribute::AttributePtrm_attributeIdMap
 
std::map< smtk::common::UUID, smtk::attribute::DefinitionPtrm_definitionIdMap
 
std::map< smtk::attribute::DefinitionPtr, std::set< smtk::attribute::WeakDefinitionPtr, Definition::WeakDefinitionPtrCompare > > m_derivedDefInfo
 
std::set< std::string > m_categories
 
std::set< std::string > m_activeCategories
 
bool m_activeCategoriesEnabled = false
 
smtk::attribute::Analyses m_analyses
 
std::map< std::string, smtk::view::ConfigurationPtrm_views
 
std::map< std::string, std::map< std::string, smtk::view::Configuration::Component > > m_styles
 
std::map< int, std::string > m_advLevels
 
std::map< int, std::vector< double > > m_advLevelColors
 
DirectoryInfo m_directoryInfo
 
std::set< smtk::resource::Links::RoleType > m_roles
 
CustomItemDefinitionFactory m_customItemDefinitionFactory
 
AssociationRules m_associationRules
 
bool m_isPrivate = false
 
EvaluatorFactory m_evaluatorFactory
 
std::string m_defaultAttNameSeparator = "-"
 
smtk::string::Token m_templateType
 
std::size_t m_templateVersion = 0
 
- Protected Attributes inherited from smtk::resource::Resource
WeakManagerPtr m_manager
 
std::shared_ptr< units::System > m_unitsSystem
 

Detailed Description

Store information about attribute definitions and instances.

This subclass of smtk::geometry::Resource holds attribute data. The file contains at least a schema (definitions and item-definitions) but may also contain attribute instances that conform to the schema as well as information about how to present the attribute system through a series of views.

This class inherits smtk::geometry::Resource so that attributes may (if desired) provide geometric data via a plugin. By default, no geometry will be available since attributes model information that is not spatial in nature and are instead associated with geometric components from other resources.

Member Function Documentation

◆ activeCategories()

const std::set<std::string>& smtk::attribute::Resource::activeCategories ( ) const
inline

API for setting and accessing Active Category information.

Active Categories are used to determine attribute/item validity as well as item values. If m_ActiveCategoriesEnabled is true then active categories will be taken into consideration.

◆ activeCategoriesEnabled()

bool smtk::attribute::Resource::activeCategoriesEnabled ( ) const
inline

API for setting and accessing Active Category information.

Active Categories are used to determine attribute/item validity as well as item values. If m_ActiveCategoriesEnabled is true then active categories will be taken into consideration.

◆ addStyle()

void Resource::addStyle ( const std::string &  definitionType,
smtk::view::Configuration::Component  style 
)

API for setting and accessing style information.

A style is represented as a smtk::view::Configuration::Component and represents customizations for displaying the attribute in a GUI.

◆ categories()

const std::set<std::string>& smtk::attribute::Resource::categories ( ) const
inline

API for accessing Category information.

These categories are specified when defining Definitions and are gathered as a result of calling finalizeDefinitions.

◆ clone()

std::shared_ptr< smtk::resource::Resource > Resource::clone ( smtk::resource::CopyOptions options) const
overridevirtual

Create an empty, un-managed clone of this resource instance's meta information.

If options has copyTemplateData() set to true, then this resource's Definition instances will be copied to the output resources. In addition, unitsSystem and Analysis information is copied.

Reimplemented from smtk::resource::Resource.

◆ copyAttribute() [1/2]

smtk::attribute::AttributePtr Resource::copyAttribute ( const smtk::attribute::AttributePtr att,
const CopyAssignmentOptions options,
smtk::io::Logger logger 
)

Copies an attribute.

Will create a copy of an attribute. Note that the source attribute can belong to a different attribute resource. The logger will contain any information including warnings or errors encountered in the copying/assignment process. In the version that does not take in a logger, smtk::io::Logger::instance() will be used. Note that the source attribute does not need to be a component of the attribute resource holding the copy. If errors occur that prevent the copy process from successfully completing, no attribute will be created. - see CopyAssignmentOptions.h for attribute and item assignment/copy options.

◆ copyAttribute() [2/2]

smtk::attribute::AttributePtr Resource::copyAttribute ( const smtk::attribute::AttributePtr att,
const CopyAssignmentOptions options = CopyAssignmentOptions() 
)

Copies an attribute.

Will create a copy of an attribute. Note that the source attribute can belong to a different attribute resource. The logger will contain any information including warnings or errors encountered in the copying/assignment process. In the version that does not take in a logger, smtk::io::Logger::instance() will be used. Note that the source attribute does not need to be a component of the attribute resource holding the copy. If errors occur that prevent the copy process from successfully completing, no attribute will be created. - see CopyAssignmentOptions.h for attribute and item assignment/copy options.

◆ copyFinalize()

bool Resource::copyFinalize ( const std::shared_ptr< const smtk::resource::Resource > &  source,
smtk::resource::CopyOptions options 
)
overridevirtual

Copy attribute resource contents.

Besides items' values this includes: Relations (associations, references) from the source resource into this resource, as specified by options. Associated resource information. Link information

Note that since the structure of the resource is assumed to be copied in copyFinalize, the attribute copy option DisableCopyAttributes always set to true.

Reimplemented from smtk::resource::Resource.

◆ copyInitialize()

bool Resource::copyInitialize ( const std::shared_ptr< const smtk::resource::Resource > &  other,
smtk::resource::CopyOptions options 
)
overridevirtual

Copy data from the other resource into this resource, as specified by options.

In the case of attribute resources - only the structure defined by the source's attributes are copied (note their items' values), as well as properties, views, geometry (if any), and active category information. Note that the following attribute copy options will always be assumed to be set and cannot be overridden by options: CopyUUID(false) PerformAssignment(false) CopyDefinition(false)

Reimplemented from smtk::resource::Resource.

◆ finalizeDefinitions()

void Resource::finalizeDefinitions ( )

This method updates information passed down to Attribute and Item Definitions.

It should be called whenever shared information such as local categories and local advance information is changed. Note that this method can be called multiple times without issue.

◆ findStyle()

const smtk::view::Configuration::Component & Resource::findStyle ( const smtk::attribute::DefinitionPtr def,
const std::string &  styleName = "" 
) const

API for setting and accessing style information.

A style is represented as a smtk::view::Configuration::Component and represents customizations for displaying the attribute in a GUI.

◆ findStyles()

const std::map< std::string, smtk::view::Configuration::Component > & Resource::findStyles ( const smtk::attribute::DefinitionPtr def) const

API for setting and accessing style information.

A style is represented as a smtk::view::Configuration::Component and represents customizations for displaying the attribute in a GUI.

◆ numberOfCategories()

std::size_t smtk::attribute::Resource::numberOfCategories ( ) const
inline

API for accessing Category information.

These categories are specified when defining Definitions and are gathered as a result of calling finalizeDefinitions.

◆ queryOperation()

std::function< bool(const smtk::resource::Component &)> Resource::queryOperation ( const std::string &  filterString) const
overridevirtual

Given a std::string describing a query, return a functor for performing the query.

Currently, the query string must be either empty, *, any, or of the form ‘attribute[type='xxx’], wherexxx` specifies the name of a definition that the resulting attributes instantiate. Note that if an attribute type xxx is provided, any attribute whose definition inherits from xxx as a base will be included, not just those whose immediate, concrete type is xxx.

If the query string filters attributes by their definition types, note that the definition must exist at the time that queryOperation() is called. This requirement allows faster repeated evaluation of the query.

Reimplemented from smtk::resource::Resource.

◆ resetId()

bool Resource::resetId ( AttributePtr  att,
const smtk::common::UUID newId 
)

Changes the ID of an Attribute.

If /a newId is currently in use, the Attribute's ID will not be changed and the method will return false.

NOTE: Care must be taken when resetting the ID since this currently does not update the links that refer to the Attribute's original ID.

◆ setActiveCategories()

void Resource::setActiveCategories ( const std::set< std::string > &  cats)

API for setting and accessing Active Category information.

Active Categories are used to determine attribute/item validity as well as item values. If m_ActiveCategoriesEnabled is true then active categories will be taken into consideration.

◆ setActiveCategoriesEnabled()

void Resource::setActiveCategoriesEnabled ( bool  mode)

API for setting and accessing Active Category information.

Active Categories are used to determine attribute/item validity as well as item values. If m_ActiveCategoriesEnabled is true then active categories will be taken into consideration.

◆ setTemplateType()

bool Resource::setTemplateType ( const smtk::string::Token templateType)
overridevirtual

Set/get the "type" of a resource's template.

A resource template-type is not required, but if present it can be used to register updaters for migrating from an old template to a newer version.

Reimplemented from smtk::resource::Resource.

◆ setTemplateVersion()

bool Resource::setTemplateVersion ( std::size_t  templateVersion)
overridevirtual

Set/get the version of the template this instance of the resource is based upon.

If non-zero, this number indicates the version number of the template (i.e., SBT file) the definitions in the current resource are drawn from. It is used during the update process to determine which updaters are applicable.

Reimplemented from smtk::resource::Resource.

◆ styles()

const std::map<std::string, std::map<std::string, smtk::view::Configuration::Component> >& smtk::attribute::Resource::styles ( ) const
inline

API for setting and accessing style information.

A style is represented as a smtk::view::Configuration::Component and represents customizations for displaying the attribute in a GUI.

◆ templateType()

smtk::string::Token smtk::attribute::Resource::templateType ( ) const
inlineoverridevirtual

Set/get the "type" of a resource's template.

A resource template-type is not required, but if present it can be used to register updaters for migrating from an old template to a newer version.

The default implementation returns an invalid string token (indicating the resource does not support templates). Subclasses must override this method if they wish to support document templates.

Reimplemented from smtk::resource::Resource.

◆ templateVersion()

std::size_t smtk::attribute::Resource::templateVersion ( ) const
inlineoverridevirtual

Set/get the "type" of a resource's template.

A resource template-type is not required, but if present it can be used to register updaters for migrating from an old template to a newer version.

The default implementation returns an invalid string token (indicating the resource does not support templates). Subclasses must override this method if they wish to support document templates.

Reimplemented from smtk::resource::Resource.

◆ updateViewComponentIdAttributes()

void Resource::updateViewComponentIdAttributes ( smtk::view::Configuration::Component comp,
smtk::resource::CopyOptions options 
)

Update ID information of a View Component using the object mapping (if provided)

If /a comp contains an ID attribute and it maps to a different persistent object, the mapped object's id will be substituted in /a comp.


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