SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
smtk::attribute::Attribute Class Reference

Represent a (possibly composite) value according to a definition. More...

#include <Attribute.h>

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

Classes

struct  CompareByName
 
class  GuardedLinks
 

Public Member Functions

 smtkTypeMacro (smtk::attribute::Attribute)
 
 smtkSuperclassMacro (smtk::resource::Component)
 
AttributePtr shared_from_this ()
 
std::shared_ptr< const Attributeshared_from_this () const
 
std::string name () const override
 Return the name of the object - by default it will return the UUID but that can be overridden.
 
const std::string & type () const
 
std::vector< std::string > types () const
 
bool isA (const smtk::attribute::DefinitionPtr &def) const
 
const smtk::attribute::DefinitionPtrdefinition () const
 
const double * color () const
 
void setColor (double r, double g, double b, double alpha)
 
void setColor (const double *l_color)
 
bool isColorSet () const
 
void unsetColor ()
 
unsigned int advanceLevel (int mode=0) const
 Get the Attribute 's advance level. More...
 
void setLocalAdvanceLevel (int mode, unsigned int level)
 
unsigned int localAdvanceLevel (int mode=0) const
 
void unsetLocalAdvanceLevel (int mode=0)
 
bool hasLocalAdvanceLevelInfo (int mode=0) const
 
const std::vector< smtk::attribute::ItemPtr > & items () const
 
smtk::attribute::ItemPtr item (int ith) const
 
smtk::attribute::ItemPtr find (const std::string &name, SearchStyle style=RECURSIVE_ACTIVE)
 Return the item with the given inName, searching in the given style. More...
 
smtk::attribute::ConstItemPtr find (const std::string &name, SearchStyle style=RECURSIVE_ACTIVE) const
 
std::size_t numberOfItems () const
 
template<typename T >
T::Ptr findAs (const std::string &name, SearchStyle style=RECURSIVE_ACTIVE)
 
template<typename T >
T::ConstPtr findAs (const std::string &name, SearchStyle style=RECURSIVE_ACTIVE) const
 
template<typename T >
void filterItems (T &values, std::function< bool(typename T::value_type)> test, bool activeChildren=true)
 Given a container, filter items in the attribute by a lambda function. More...
 
IntItemPtr findInt (const std::string &name)
 
ConstIntItemPtr findInt (const std::string &name) const
 
DoubleItemPtr findDouble (const std::string &name)
 
ConstDoubleItemPtr findDouble (const std::string &name) const
 
StringItemPtr findString (const std::string &name)
 
ConstStringItemPtr findString (const std::string &name) const
 
FileItemPtr findFile (const std::string &name)
 
ConstFileItemPtr findFile (const std::string &name) const
 
DirectoryItemPtr findDirectory (const std::string &name)
 
ConstDirectoryItemPtr findDirectory (const std::string &name) const
 
GroupItemPtr findGroup (const std::string &name)
 
ConstGroupItemPtr findGroup (const std::string &name) const
 
ModelEntityItemPtr findModelEntity (const std::string &name)
 
ConstModelEntityItemPtr findModelEntity (const std::string &name) const
 
VoidItemPtr findVoid (const std::string &name)
 
ConstVoidItemPtr findVoid (const std::string &name) const
 
DateTimeItemPtr findDateTime (const std::string &name)
 
ConstDateTimeItemPtr findDateTime (const std::string &name) const
 
ReferenceItemPtr findReference (const std::string &name)
 
ConstReferenceItemPtr findReference (const std::string &name) const
 
template<typename T >
entityRefsAs (const std::string &name) const
 
ResourceItemPtr findResource (const std::string &name)
 
ConstResourceItemPtr findResource (const std::string &name) const
 
ComponentItemPtr findComponent (const std::string &name)
 
ConstComponentItemPtr findComponent (const std::string &name) const
 
ConstReferenceItemPtr associatedObjects () const
 
ReferenceItemPtr associatedObjects ()
 
bool isObjectAssociated (const smtk::common::UUID &uid) const
 
bool isObjectAssociated (const smtk::resource::PersistentObjectPtr &componentPtr) const
 
bool canBeAssociated (const smtk::resource::PersistentObjectPtr &obj) const
 
bool canBeDisassociated (const smtk::resource::PersistentObjectPtr &obj, AttributePtr &probAtt) const
 
ConstReferenceItemPtr associations () const
 
ReferenceItemPtr associations ()
 
bool isEntityAssociated (const smtk::common::UUID &entity) const
 Is the model entity associated with this attribute? More...
 
bool isEntityAssociated (const smtk::model::EntityRef &entityref) const
 Is the model entity of the entityref associated with this attribute? More...
 
smtk::common::UUIDs associatedModelEntityIds () const
 Return the associated model entities as a set of UUIDs.
 
template<typename T >
associatedModelEntities () const
 Return a container of associated entityref-subclass instances. More...
 
template<typename T >
associatedObjects () const
 
bool associate (smtk::resource::PersistentObjectPtr obj)
 
bool associateEntity (const smtk::common::UUID &entity)
 Associate a new-style model ID (a UUID) with this attribute. More...
 
bool associateEntity (const smtk::model::EntityRef &entity)
 Associate a new-style model ID (a EntityRef) with this attribute. More...
 
void disassociateEntity (const smtk::common::UUID &entity, bool reverse=true)
 Disassociate a new-style model ID (a UUID) from this attribute. More...
 
void disassociateEntity (const smtk::model::EntityRef &entity, bool reverse=true)
 Disassociate a new-style model entity (a EntityRef) from this attribute.
 
bool disassociate (smtk::resource::PersistentObjectPtr obj, AttributePtr &probAtt, bool reverse=true)
 Disassociate attribute from an object. More...
 
bool disassociate (smtk::resource::PersistentObjectPtr obj, bool reverse=true)
 Disassociate attribute from an object. Returns true if successful.
 
bool assign (const AttributePtr &sourceAtt, const CopyAssignmentOptions &options=CopyAssignmentOptions())
 
bool assign (const AttributePtr &sourceAtt, const CopyAssignmentOptions &options, smtk::io::Logger &logger)
 
void detachItemsFromOwningResource ()
 Sever dependencies between items and the owning resource. More...
 
bool removeAllAssociations (bool partialRemovalOk=false)
 Remove all associations of this attribute with model entities. More...
 
bool removeExpungedEntities (const smtk::model::EntityRefs &expungedEnts)
 Remove expunged Entities from attribute. More...
 
bool appliesToBoundaryNodes () const
 
void setAppliesToBoundaryNodes (bool appliesValue)
 
bool appliesToInteriorNodes () const
 
void setAppliesToInteriorNodes (bool appliesValue)
 
const smtk::common::Categoriescategories () const
 The categories that the attribute applies to. More...
 
smtk::attribute::ConstItemPtr itemAtPath (const std::string &path, const std::string &sep="/", bool activeOnly=false) const
 Find an item via its path with respects to the attribute. More...
 
smtk::attribute::ItemPtr itemAtPath (const std::string &path, const std::string &sep="/", bool activeOnly=false)
 Find an item via its path with respects to the attribute. More...
 
template<typename T >
T::ConstPtr itemAtPathAs (const std::string &path, const std::string &sep="/", bool activeOnly=false) const
 Find an item via its path with respects to the attribute. More...
 
template<typename T >
T::Ptr itemAtPathAs (const std::string &path, const std::string &sep="/", bool activeOnly=false)
 Return an item given its path, converted to a given pointer type.
 
std::string itemPath (const ItemPtr &item, const std::string &sep="/") const
 Formats the full path to the item with respect to the attribute.
 
- Public Member Functions inherited from smtk::resource::Component
 smtkTypeMacro (smtk::resource::Component)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
ResourceparentResource () const override
 Return a raw (not shared) pointer to the resource that owns this component. More...
 
template<typename ResourceType >
ResourceType * parentResourceAs () const
 This variant of parentResource casts the result to the given ResourceType.
 
Linkslinks () override
 Return the links that connect this component to external resources/components.
 
const Linkslinks () const override
 
Propertiesproperties () override
 Return properties defined on this component.
 
const Propertiesproperties () const override
 
- 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 smtk::attribute::AttributePtr New (const std::string &myName, const smtk::attribute::DefinitionPtr &myDefinition, const smtk::common::UUID &myId)
 

Friends

class smtk::attribute::Definition
 
class smtk::attribute::Resource
 
std::string m_name
 Returns true if the attribute is valid. More...
 
std::vector< smtk::attribute::ItemPtrm_items
 Returns true if the attribute is valid. More...
 
ReferenceItemPtr m_associatedObjects
 Returns true if the attribute is valid. More...
 
smtk::attribute::DefinitionPtr m_definition
 Returns true if the attribute is valid. More...
 
bool m_appliesToBoundaryNodes { false }
 Returns true if the attribute is valid. More...
 
bool m_appliesToInteriorNodes { false }
 Returns true if the attribute is valid. More...
 
bool m_isColorSet { false }
 Returns true if the attribute is valid. More...
 
std::map< std::string, smtk::simulation::UserDataPtrm_userData
 Returns true if the attribute is valid. More...
 
bool m_aboutToBeDeleted { false }
 Returns true if the attribute is valid. More...
 
double m_color [4]
 Returns true if the attribute is valid. More...
 
smtk::common::UUID m_id
 Returns true if the attribute is valid. More...
 
std::size_t m_includeIndex { 0 }
 Returns true if the attribute is valid. More...
 
bool m_hasLocalAdvanceLevelInfo [2]
 Returns true if the attribute is valid. More...
 
unsigned int m_localAdvanceLevel [2]
 Returns true if the attribute is valid. More...
 
std::string m_localUnits
 Returns true if the attribute is valid. More...
 
bool isValid (bool useActiveCategories=true) const
 Returns true if the attribute is valid. More...
 
bool isValid (const std::set< std::string > &categories) const
 Returns true if the attribute is valid. More...
 
bool isRelevant (bool requestCatagories=true, bool includeReadAccess=false, unsigned int readAccessLevel=0) const
 Returns true if the attribute is relevant. More...
 
smtk::attribute::ResourcePtr attributeResource () const
 Returns true if the attribute is valid. More...
 
const smtk::resource::ResourcePtr resource () const override
 Returns true if the attribute is valid. More...
 
void setUserData (const std::string &key, smtk::simulation::UserDataPtr value)
 Returns true if the attribute is valid. More...
 
smtk::simulation::UserDataPtr userData (const std::string &key) const
 Returns true if the attribute is valid. More...
 
void clearUserData (const std::string &key)
 Returns true if the attribute is valid. More...
 
void clearAllUserData ()
 Returns true if the attribute is valid. More...
 
bool isAboutToBeDeleted () const
 Returns true if the attribute is valid. More...
 
const common::UUIDid () const override
 Returns true if the attribute is valid. More...
 
bool setId (const common::UUID &uid) override
 Assign an ID to this attribute. More...
 
void setIncludeIndex (std::size_t index)
 Returns true if the attribute is valid. More...
 
std::size_t includeIndex () const
 Returns true if the attribute is valid. More...
 
bool canEvaluate () const
 Returns true if the attribute is valid. More...
 
bool doesEvalaute () const
 Returns true if the attribute is valid. More...
 
std::unique_ptr< smtk::attribute::EvaluatorcreateEvaluator () const
 Returns true if the attribute is valid. More...
 
const std::string & units () const
 Return the units associated to the attribute. More...
 
const std::string & localUnits () const
 Return the units locally set on the attribute.
 
bool setLocalUnits (const std::string &newUnits)
 Locally set the units on the attribute. More...
 
bool supportsUnits () const
 Returns true if the attribute supports units. More...
 
const GuardedLinks guardedLinks () const
 Returns true if the attribute is valid. More...
 
GuardedLinks guardedLinks ()
 Returns true if the attribute is valid. More...
 
 Attribute (const std::string &myName, const smtk::attribute::DefinitionPtr &myDefinition, const smtk::common::UUID &myId)
 Returns true if the attribute is valid. More...
 
void build ()
 Constructs the attribute from its definition.
 
void removeAllItems ()
 Returns true if the attribute is valid. More...
 
void forceDisassociate (smtk::resource::PersistentObjectPtr)
 Used to disassociate an attribute from an object without checking constraints. More...
 
void addItem (smtk::attribute::ItemPtr &iPtr)
 Returns true if the attribute is valid. More...
 
void setName (const std::string &newname)
 Returns true if the attribute is valid. More...
 
void resetId (const smtk::common::UUID &newId)
 This allows the resource to change an Attribute ID.
 

Additional Inherited Members

- Public Types inherited from smtk::resource::Component
typedef std::function< void(const ComponentPtr &)> Visitor
 
typedef detail::ComponentLinks Links
 
typedef detail::ComponentProperties Properties
 

Detailed Description

Represent a (possibly composite) value according to a definition.

Constructor & Destructor Documentation

◆ Attribute()

Attribute::Attribute ( const std::string &  myName,
const smtk::attribute::DefinitionPtr myDefinition,
const smtk::common::UUID myId 
)
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

Member Function Documentation

◆ addItem()

void smtk::attribute::Attribute::addItem ( smtk::attribute::ItemPtr iPtr)
inlineprotected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ advanceLevel()

unsigned int Attribute::advanceLevel ( int  mode = 0) const

Get the Attribute 's advance level.

if mode is 1 then the write access level is returned; else the read access level is returned The information can either be specificied directly to the attribute using setLocalAdvanceLevel() or from the attributes's definition. NOTE: This information is used in GUI only

◆ associatedModelEntities()

template<typename T >
T smtk::attribute::Attribute::associatedModelEntities

Return a container of associated entityref-subclass instances.

This method returns a container (usually a std::vector or std::set) of entityref-subclass instances (e.g., Edge, EdgeUse, Loop) that are associated with this attribute.

Note that if you request a container of EntityRef entities, you will obtain all of the associated model entities. However, if you request a container of some subclass, only entities of that type will be returned. For example, if an attribute is associated with two faces, an edge, a group, and a shell, calling associatedModelEntities<EntityRefs>() will return 5 EntityRef entries while associatedModelEntities<CellEntities>() will return 3 entries (2 faces and 1 edge) since the other entities do not construct valid CellEntity instances.

◆ associateEntity() [1/2]

bool Attribute::associateEntity ( const smtk::common::UUID objId)

Associate a new-style model ID (a UUID) with this attribute.

This function returns true when the association is valid and successful. It will return false if the association is prohibited.

◆ associateEntity() [2/2]

bool Attribute::associateEntity ( const smtk::model::EntityRef entityRef)

Associate a new-style model ID (a EntityRef) with this attribute.

This function returns true when the association is valid and successful. It may return false if the association is prohibited. (This is not currently implemented.)

◆ attributeResource()

ResourcePtr Attribute::attributeResource ( ) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ canEvaluate()

bool Attribute::canEvaluate ( ) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ categories()

const smtk::common::Categories & Attribute::categories ( ) const

The categories that the attribute applies to.

Typically a category will be a simulation type like heat transfer, fluid flow, etc.

◆ clearAllUserData()

void smtk::attribute::Attribute::clearAllUserData ( )
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ clearUserData()

void smtk::attribute::Attribute::clearUserData ( const std::string &  key)
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ createEvaluator()

std::unique_ptr< Evaluator > Attribute::createEvaluator ( ) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ detachItemsFromOwningResource()

void Attribute::detachItemsFromOwningResource ( )

Sever dependencies between items and the owning resource.

Some items implicitly interact with the parent resource to store and retrieve data (e.g. ReferenceItem uses links to retrieve references). For items with this type of relationship with the owning resource, this method disables those routines, forcing the item (and, therefore, the containing attribute) to satisfy its API without using the owning resource. This is useful when an attribute has been removed from its parent resource and is still held by ancillary routines (i.e. when the attribute is expunged and Operation observers are inspecting expunged resources).

◆ disassociate()

bool Attribute::disassociate ( smtk::resource::PersistentObjectPtr  obj,
AttributePtr probAtt,
bool  reverse = true 
)

Disassociate attribute from an object.

Returns true if successful, else it will set probAtt to attribute using this as a prerequisite

◆ disassociateEntity()

void Attribute::disassociateEntity ( const smtk::common::UUID entity,
bool  reverse = true 
)

Disassociate a new-style model ID (a UUID) from this attribute.

If reverse is true (the default), then the model resource is notified of the item's disassociation immediately after its removal from this attribute, allowing the model and attribute to stay in sync.

◆ doesEvalaute()

bool Attribute::doesEvalaute ( ) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ filterItems()

template<typename T >
void smtk::attribute::Attribute::filterItems ( T &  values,
std::function< bool(typename T::value_type)>  test,
bool  activeChildren = true 
)

Given a container, filter items in the attribute by a lambda function.

Parameters
valuesa container which holds items
testa lambda function which would be applied on children items Example filter double and int items [](Item::Ptr item) { return item->type() == DoubleType || item->type() == IntType; } Example filter modelEntity items [](ModelEntity::Ptr item) { return true; }
activeChildrena flag indicates whether it should be applied to active children only or not

◆ find()

smtk::attribute::ItemPtr Attribute::find ( const std::string &  inName,
SearchStyle  style = RECURSIVE_ACTIVE 
)

Return the item with the given inName, searching in the given style.

The search style dictates whether children of conditional items are included and, if so, whether all of their children are searched or just the active children. The default is to search active children.

◆ forceDisassociate()

void Attribute::forceDisassociate ( smtk::resource::PersistentObjectPtr  obj)
protected

Used to disassociate an attribute from an object without checking constraints.

Typical use is either when all attributes are being disassociated from the same object or if the attribute is being deleted.

◆ guardedLinks() [1/2]

GuardedLinks smtk::attribute::Attribute::guardedLinks ( )

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ guardedLinks() [2/2]

smtk::attribute::Attribute::GuardedLinks Attribute::guardedLinks ( ) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ id()

const common::UUID& smtk::attribute::Attribute::id ( ) const
inlineoverridevirtual

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

Implements smtk::resource::PersistentObject.

◆ includeIndex()

std::size_t smtk::attribute::Attribute::includeIndex ( ) const
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ isAboutToBeDeleted()

bool smtk::attribute::Attribute::isAboutToBeDeleted ( ) const
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ isEntityAssociated() [1/2]

bool Attribute::isEntityAssociated ( const smtk::common::UUID entity) const

Is the model entity associated with this attribute?

◆ isEntityAssociated() [2/2]

bool Attribute::isEntityAssociated ( const smtk::model::EntityRef entityref) const

Is the model entity of the entityref associated with this attribute?

◆ isRelevant()

bool Attribute::isRelevant ( bool  requestCatagories = true,
bool  includeReadAccess = false,
unsigned int  readAccessLevel = 0 
) const

Returns true if the attribute is relevant.

If requestCatagories is true, the Attribute's Definition does not ignore categories, and the attribute does not pass it's category checks with respects to the resource's active category settings then return false, If includeReadAccess is true, and if all of the items in the attribute have their advanceLevel > readAccessLevel then return false. Else return true.

◆ isValid() [1/2]

bool Attribute::isValid ( bool  useActiveCategories = true) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ isValid() [2/2]

bool Attribute::isValid ( const std::set< std::string > &  categories) const

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ itemAtPath() [1/2]

smtk::attribute::ItemPtr Attribute::itemAtPath ( const std::string &  path,
const std::string &  sep = "/",
bool  activeOnly = false 
)

Find an item via its path with respects to the attribute.

Return an item given a string specifying a path to it.

If activeOnly is true then all items in the path must active (with respect to a parent ValueItem) else nullptr will be returned. This parameter will have no effect on other types of items. Note that the path should not start with a separator character.

Note that itemAtPath() can also be used to reference an attribute's associations (if any are allowed) as long as the association-definition's name does not collide with any immediate child-item's name.

◆ itemAtPath() [2/2]

smtk::attribute::ConstItemPtr Attribute::itemAtPath ( const std::string &  path,
const std::string &  sep = "/",
bool  activeOnly = false 
) const

Find an item via its path with respects to the attribute.

Return an item given a string specifying a path to it.

If activeOnly is true then all items in the path must active (with respect to a parent ValueItem) else nullptr will be returned. This parameter will have no effect on other types of items. Note that the path should not start with a separator character.

Note that itemAtPath() can also be used to reference an attribute's associations (if any are allowed) as long as the association-definition's name does not collide with any immediate child-item's name.

◆ itemAtPathAs()

template<typename T >
T::ConstPtr smtk::attribute::Attribute::itemAtPathAs ( const std::string &  path,
const std::string &  sep = "/",
bool  activeOnly = false 
) const

Find an item via its path with respects to the attribute.

Return an item given a string specifying a path to it.

If activeOnly is true then all items in the path must active (with respect to a parent ValueItem) else nullptr will be returned. This parameter will have no effect on other types of items. Note that the path should not start with a separator character.

Note that itemAtPath() can also be used to reference an attribute's associations (if any are allowed) as long as the association-definition's name does not collide with any immediate child-item's name.

◆ removeAllAssociations()

bool Attribute::removeAllAssociations ( bool  partialRemovalOk = false)

Remove all associations of this attribute with model entities.

When dealing with prerequisite constraints it may not be possible to remove all associations. If partialRemovalOk is true, then all associations that can be removed all. If false, then associations are only removed iff all can be removed. Note that this may reset the associations. If there are any default associations, they will be present but typically there are none.

◆ removeAllItems()

void Attribute::removeAllItems ( )
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ removeExpungedEntities()

bool Attribute::removeExpungedEntities ( const smtk::model::EntityRefs expungedEnts)

Remove expunged Entities from attribute.

Update attribute when entities has been expunged Note it would check associations and every modelEntityItem.

Parameters
expungedEntsa set of expunged entities
Returns
if association or modelEntityItem has been updated, return true. (then operator widget should update its UI)

◆ resource()

const smtk::resource::ResourcePtr Attribute::resource ( ) const
overridevirtual

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

Implements smtk::resource::Component.

◆ setId()

bool Attribute::setId ( const common::UUID uid)
overridevirtual

Assign an ID to this attribute.

This not supported for attributes. The Id is set in the constructor and should never be changed.

Implements smtk::resource::PersistentObject.

◆ setIncludeIndex()

void smtk::attribute::Attribute::setIncludeIndex ( std::size_t  index)
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ setLocalUnits()

bool Attribute::setLocalUnits ( const std::string &  newUnits)

Locally set the units on the attribute.

This will fail and return false under the following circumstances:

  1. There are no units associated with its definition and the newUnits string is not empty
  2. There is no units system associated with its definition and newUnits is not the same as those on the definition
  3. newUnits are not supported by the associated units system
  4. Its definition's units are not "*" or there is no way to convert between the units associated with its definition and newUnits

◆ setName()

void smtk::attribute::Attribute::setName ( const std::string &  newname)
inlineprotected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ setUserData()

void smtk::attribute::Attribute::setUserData ( const std::string &  key,
smtk::simulation::UserDataPtr  value 
)
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ supportsUnits()

bool Attribute::supportsUnits ( ) const

Returns true if the attribute supports units.

An attribute supports units if its definition's units() does not return an empty string.

◆ units()

const std::string & Attribute::units ( ) const

Return the units associated to the attribute.

Returns the units that have been locally set on the attribute, else it will return those returned from its definition's units method

This means that the information that the attributes represents conceptually has units but unlike attribute Items, does not have a numerical value associated with it. For example an attribute may be used to indicate that a numerical field being output by a simulation represents a temperature whose units should be in Kelvin.

If the attribute has no local units set and its definition's units method returns "*", then this will return an empty string indicating that the attribute is currently unit-less

◆ userData()

smtk::simulation::UserDataPtr smtk::attribute::Attribute::userData ( const std::string &  key) const
inline

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

Member Data Documentation

◆ m_aboutToBeDeleted

bool smtk::attribute::Attribute::m_aboutToBeDeleted { false }
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_appliesToBoundaryNodes

bool smtk::attribute::Attribute::m_appliesToBoundaryNodes { false }
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_appliesToInteriorNodes

bool smtk::attribute::Attribute::m_appliesToInteriorNodes { false }
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_associatedObjects

ReferenceItemPtr smtk::attribute::Attribute::m_associatedObjects
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_color

double smtk::attribute::Attribute::m_color[4]
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_definition

smtk::attribute::DefinitionPtr smtk::attribute::Attribute::m_definition
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_hasLocalAdvanceLevelInfo

bool smtk::attribute::Attribute::m_hasLocalAdvanceLevelInfo[2]
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_id

smtk::common::UUID smtk::attribute::Attribute::m_id
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_includeIndex

std::size_t smtk::attribute::Attribute::m_includeIndex { 0 }
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_isColorSet

bool smtk::attribute::Attribute::m_isColorSet { false }
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_items

std::vector<smtk::attribute::ItemPtr> smtk::attribute::Attribute::m_items
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_localAdvanceLevel

unsigned int smtk::attribute::Attribute::m_localAdvanceLevel[2]
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_localUnits

std::string smtk::attribute::Attribute::m_localUnits
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_name

std::string smtk::attribute::Attribute::m_name
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration

◆ m_userData

std::map<std::string, smtk::simulation::UserDataPtr> smtk::attribute::Attribute::m_userData
protected

Returns true if the attribute is valid.

Validate the attribute against its definition.

An irrelevant attribute is considered valid since for all intents and purposes it is treated as though it does not exist. A relevant attribute if valid if all of its relevant children items are valid

This method will only return true when every (required) item in the attribute is set and considered a valid value by its definition. This can be used to ensure that an attribute is in a good state before using it to perform some operation.

If useActiveCategories is true, the Definition does not ignoreCategories, and if the resource has active categories enabled, then the resource's active categories will be taken into consideration


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