SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::attribute::ValueItemDefinition Class Referenceabstract
Inheritance diagram for smtk::attribute::ValueItemDefinition:
[legend]
Collaboration diagram for smtk::attribute::ValueItemDefinition:
[legend]

Public Types

typedef std::function< bool(const Item *, int enumIndex, bool includeCatagories, const std::set< std::string > &testCategories, bool includeReadAccess, unsigned int readAccessLevel)> EnumRelevanceFunc
 Typedef for custom relevance functions.
 

Public Member Functions

 smtkTypeMacro (smtk::attribute::ValueItemDefinition)
 
 ValueItemDefinition (const std::string &myname)
 
bool hasSupportedUnits () const
 Returns true if units and a units system have been specified and that the specified units are supported by the units system.
 
std::string supportedUnits () const
 Return native units of the definition that are supported by its units system. More...
 
bool isDiscrete () const
 Returns true if the definition is discrete in nature.
 
std::size_t numberOfDiscreteValues () const
 Returns the number of discrete values defined in definition.
 
const std::string & discreteEnum (std::size_t ith) const
 Returns the ith enumeration string.
 
bool getEnumIndex (const std::string &enumVal, std::size_t &index) const
 Finds the index of a discrete enumeration string. More...
 
bool addItemDefinition (smtk::attribute::ItemDefinitionPtr cdef)
 
template<typename T >
smtk::internal::shared_ptr_type< T >::SharedPointerType addItemDefinition (const std::string &idName)
 
bool addConditionalItem (const std::string &enumValue, const std::string &itemName)
 
std::vector< std::string > conditionalItems (const std::string &enumValue) const
 
std::vector< std::string > relevantEnums (bool includeCategories, const std::set< std::string > &testCategories, bool includeReadAccess, unsigned int readAccessLevel) const
 Return the enum strings that pass a set of categories and/or specified advance read access level.
 
virtual bool defaultIsEnumRelevant (int enumIndex, bool includeCatagories, const std::set< std::string > &testCategories, bool includeReadAccess, unsigned int readAccessLevel) const
 Default isRelevant method that returns true if an Enum of the Definition is relevant. More...
 
const std::string & units () const
 Set/Get the units string associated with the definition. More...
 
virtual bool setUnits (const std::string &newUnits)
 Set/Get the units string associated with the definition. More...
 
int defaultDiscreteIndex () const
 Get/Set the default discrete value via its index location.
 
void setDefaultDiscreteIndex (int discreteIndex)
 Get/Set the default discrete value via its index location.
 
bool allowsExpressions () const
 }@ More...
 
bool isValidExpression (const smtk::attribute::AttributePtr &exp) const
 Returns true if exp can be assigned to the definition's items as an expression.
 
smtk::attribute::ComponentItemDefinitionPtrexpressionInformation ()
 Return the component item which is used to represent the definition's expression constraints.
 
std::string expressionType () const
 Return the expression type used when assigning expression attributes to the definition's items. More...
 
void setExpressionType (const std::string &etype)
 Set the type of expression to be used determine if an attribute can be used an expression for the definition's items. More...
 
void setExpressionDefinition (const smtk::attribute::DefinitionPtr &exp)
 Set the type of expression to be used determine if an attribute can be used an expression for the definition's items. More...
 
smtk::attribute::DefinitionPtr expressionDefinition (const smtk::attribute::ResourcePtr &attResource) const
 Return the expression definition used when assigning expression attributes to the definition's items. More...
 
void buildExpressionItem (ValueItem *vitem) const
 Get/Set the default discrete value via its index location.
 
void buildChildrenItems (ValueItem *vitem) const
 Get/Set the default discrete value via its index location.
 
bool hasDefault () const
 Get/Set the default discrete value via its index location.
 
virtual bool hasRange () const =0
 Get/Set the default discrete value via its index location.
 
std::size_t numberOfRequiredValues () const
 Get/Set the default discrete value via its index location.
 
bool setNumberOfRequiredValues (std::size_t esize)
 Get/Set the default discrete value via its index location.
 
std::size_t maxNumberOfValues () const
 Get/Set the default discrete value via its index location.
 
bool setMaxNumberOfValues (std::size_t esize)
 Get/Set the default discrete value via its index location.
 
bool isExtensible () const
 Get/Set the default discrete value via its index location.
 
void setIsExtensible (bool mode)
 Get/Set the default discrete value via its index location.
 
bool hasValueLabels () const
 Get/Set the default discrete value via its index location.
 
bool usingCommonLabel () const
 Get/Set the default discrete value via its index location.
 
void setValueLabel (std::size_t element, const std::string &elabel)
 Get/Set the default discrete value via its index location.
 
void setCommonValueLabel (const std::string &elabel)
 Get/Set the default discrete value via its index location.
 
std::string valueLabel (std::size_t element) const
 Get/Set the default discrete value via its index location.
 
bool isDiscreteIndexValid (int index) const
 Get/Set the default discrete value via its index location.
 
bool isDiscreteIndexValid (int index, const std::set< std::string > &categories) const
 Get/Set the default discrete value via its index location.
 
std::size_t numberOfChildrenItemDefinitions () const
 For conditional children items based on the item's current discrete value.
 
const std::map< std::string, smtk::attribute::ItemDefinitionPtr > & childrenItemDefinitions () const
 Get/Set the default discrete value via its index location.
 
bool hasChildItemDefinition (const std::string &itemName) const
 Get/Set the default discrete value via its index location.
 
bool hasChildItemDefinition (const std::string &valueName, const std::string &itemName)
 Get/Set the default discrete value via its index location.
 
bool addChildItemDefinition (smtk::attribute::ItemDefinitionPtr cdef)
 Get/Set the default discrete value via its index location.
 
void setEnumCategories (const std::string &enumValue, const smtk::common::Categories::Expression &cats)
 Set/Get the set of categories associated with a value Enum.
 
void addEnumCategory (const std::string &enumValue, const std::string &cat)
 Get/Set the default discrete value via its index location.
 
const smtk::common::Categories::ExpressionenumCategories (const std::string &enumValue) const
 Get/Set the default discrete value via its index location.
 
void setEnumAdvanceLevel (const std::string &enumValue, unsigned int level)
 Set/Get advance level associated with associated with a value Enum.
 
void unsetEnumAdvanceLevel (const std::string &enumValue)
 Set/Get advance level associated with associated with a value Enum.
 
unsigned int enumAdvanceLevel (const std::string &enumValue) const
 Set/Get advance level associated with associated with a value Enum.
 
bool hasEnumAdvanceLevel (const std::string &enumValue) const
 Set/Get advance level associated with associated with a value Enum.
 
const std::map< std::string, unsigned int > enumAdvanceLevelInfo () const
 Set/Get advance level associated with associated with a value Enum.
 
void setCustomEnumIsRelevant (EnumRelevanceFunc func)
 Set and Get Methods for specifying a custom isEnumRelevant function.
 
EnumRelevanceFunc customEnumIsRelevant () const
 Set and Get Methods for specifying a custom isEnumRelevant function.
 
- Public Member Functions inherited from smtk::attribute::ItemDefinition
 smtkTypeMacroBase (smtk::attribute::ItemDefinition)
 
const std::string & name () const
 
virtual Item::Type type () const =0
 
const std::string & label () const
 
void setLabel (const std::string &newLabel)
 
int version () const
 
void setVersion (int myVersion)
 
bool isOptional () const
 
void setIsOptional (bool isOptionalValue)
 
bool isEnabledByDefault () const
 
void setIsEnabledByDefault (bool isEnabledByDefaultValue)
 
const smtk::common::Categoriescategories () const
 Returns the categories (both explicitly assigned and inherited) associated to the Item Definition. More...
 
smtk::common::Categories::ExpressionlocalCategories ()
 Returns the categories::Expression explicitly assigned to the Items Definition.
 
const smtk::common::Categories::ExpressionlocalCategories () const
 
void setLocalCategories (const smtk::common::Categories::Expression &catExp)
 Sets the local categories. More...
 
unsigned int advanceLevel (int mode=0) const
 
unsigned int localAdvanceLevel (int mode=0) const
 
void setLocalAdvanceLevel (int mode, unsigned int level)
 
void setLocalAdvanceLevel (unsigned int level)
 
void unsetLocalAdvanceLevel (int mode=0)
 
bool hasLocalAdvanceLevelInfo (int mode=0) const
 
const std::string & detailedDescription () const
 
void setDetailedDescription (const std::string &text)
 
const std::string & briefDescription () const
 
void setBriefDescription (const std::string &text)
 
const Tags & tags () const
 return the smtk::attribute::Tags associated with the Definition
 
const shared_ptr< units::System > & unitSystem () const
 Return the unitSystem of the Definition.
 
const shared_ptr< units::System > & unitsSystem () const
 
virtual smtk::attribute::ItemPtr buildItem (Attribute *owningAttribute, int itemPosition) const =0
 
virtual smtk::attribute::ItemPtr buildItem (Item *owningItem, int position, int subGroupPosition) const =0
 
virtual smtk::attribute::ItemDefinitionPtr createCopy (smtk::attribute::ItemDefinition::CopyInfo &info) const =0
 
smtk::common::Categories::CombinationMode categoryInheritanceMode () const
 Determines how the Definition should combine its local category Set with the category constraints being inherited from it's owning Attribute or Item Definition.
 
void setCategoryInheritanceMode (smtk::common::Categories::CombinationMode mode)
 Determines how the Definition should combine its local category Set with the category constraints being inherited from it's owning Attribute or Item Definition.
 
const Tagtag (const std::string &name) const
 Return a pointer to a smtk::attribute::Tag with a given name. If the Tag does not exist, return a null pointer.
 
Tagtag (const std::string &name)
 Return a pointer to a smtk::attribute::Tag with a given name. If the Tag does not exist, return a null pointer.
 
bool addTag (const Tag &tag)
 Add/Remove a smtk::attribute::Tag from a Definition.
 
bool removeTag (const std::string &name)
 Add/Remove a smtk::attribute::Tag from a Definition.
 

Protected Member Functions

void copyTo (ValueItemDefinitionPtr def, smtk::attribute::ItemDefinition::CopyInfo &info) const
 
void applyCategories (const smtk::common::Categories::Stack &inheritedFromParent, smtk::common::Categories &inheritedToParent) override
 
void applyAdvanceLevels (const unsigned int &readLevelFromParent, const unsigned int &writeLevelFromParent) override
 
void setUnitSystem (const shared_ptr< units::System > &unitSystem) override
 Set the unitSystem of the Definition. More...
 
void setUnitsSystem (const shared_ptr< units::System > &unitsSystem) override
 
virtual void updateDiscreteValue ()=0
 
- Protected Member Functions inherited from smtk::attribute::ItemDefinition
 ItemDefinition (const std::string &myname)
 
void copyTo (ItemDefinitionPtr def) const
 

Protected Attributes

bool m_hasDefault
 
bool m_useCommonLabel
 
std::vector< std::string > m_valueLabels
 
std::vector< std::string > m_discreteValueEnums
 
int m_defaultDiscreteIndex
 
std::size_t m_numberOfRequiredValues
 
std::size_t m_maxNumberOfValues
 
bool m_isExtensible
 
std::string m_units
 
std::string m_expressionType
 
smtk::attribute::ComponentItemDefinitionPtr m_expressionInformation
 
std::map< std::string, smtk::attribute::ItemDefinitionPtrm_itemDefs
 
std::map< std::string, std::set< std::string > > m_itemToValueAssociations
 
std::map< std::string, std::vector< std::string > > m_valueToItemAssociations
 
std::map< std::string, smtk::common::Categories::Expressionm_valueToCategoryAssociations
 
std::map< std::string, unsigned int > m_valueToAdvanceLevelAssociations
 
EnumRelevanceFunc m_customEnumIsRelevant = nullptr
 
- Protected Attributes inherited from smtk::attribute::ItemDefinition
int m_version
 
bool m_isOptional
 
bool m_isEnabledByDefault
 
std::string m_label
 
common::Categories::Expression m_localCategories
 
common::Categories m_categories
 
std::string m_detailedDescription
 
std::string m_briefDescription
 
bool m_hasLocalAdvanceLevelInfo [2]
 
unsigned int m_localAdvanceLevel [2]
 
unsigned int m_advanceLevel [2]
 
attribute::Tags m_tags
 
smtk::common::Categories::CombinationMode m_combinationMode
 
std::shared_ptr< units::System > m_unitSystem
 

Member Function Documentation

◆ allowsExpressions()

bool ValueItemDefinition::allowsExpressions ( ) const

}@

Returns true if the definition allows expressions.

◆ defaultIsEnumRelevant()

bool ValueItemDefinition::defaultIsEnumRelevant ( int  enumIndex,
bool  includeCatagories,
const std::set< std::string > &  testCategories,
bool  includeReadAccess,
unsigned int  readAccessLevel 
) const
virtual

Default isRelevant method that returns true if an Enum of the Definition is relevant.

If includeCatagories is true and the Enum does not pass it's category checks, then return false, If includeReadAccess is true, and the Enum's advanceLevel is > readAccessLevel then return false. Else return true.

◆ expressionDefinition()

smtk::attribute::DefinitionPtr ValueItemDefinition::expressionDefinition ( const smtk::attribute::ResourcePtr attResource) const

Return the expression definition used when assigning expression attributes to the definition's items.

Note: This is a convenience method when the expression information represents a single accept constraint containing no regular expression in the type name or property constraints. In any other situation, this method will return nullptr.

◆ expressionType()

std::string ValueItemDefinition::expressionType ( ) const

Return the expression type used when assigning expression attributes to the definition's items.

Note: This is a convenience method when the expression information represents a single accept constraint containing no regular expression in the type name or property constraints. In any other situation, this method will return an empty string.

◆ getEnumIndex()

bool ValueItemDefinition::getEnumIndex ( const std::string &  enumVal,
std::size_t &  index 
) const

Finds the index of a discrete enumeration string.

Returns false if enumVal is not present.

◆ setExpressionDefinition()

void ValueItemDefinition::setExpressionDefinition ( const smtk::attribute::DefinitionPtr exp)

Set the type of expression to be used determine if an attribute can be used an expression for the definition's items.

Note: This is a convenience method to handle the common case where there is only one acceptable condition which indicates that the definition's items will only accept an attribute as an expression if it belongs to or derived from exp.

◆ setExpressionType()

void ValueItemDefinition::setExpressionType ( const std::string &  etype)

Set the type of expression to be used determine if an attribute can be used an expression for the definition's items.

Note: This is a convenience method to handle the common case where there is only one acceptable condition which indicates that the definition's items will only accept an attribute as an expression if it belongs to or derived from the definition /a etype.

◆ setUnits()

bool ValueItemDefinition::setUnits ( const std::string &  newUnits)
virtual

Set/Get the units string associated with the definition.

If the units string is supported by the units system assigned to the definition, then unit conversion will be supported.

Reimplemented in smtk::attribute::DoubleItemDefinition.

◆ setUnitSystem()

void ValueItemDefinition::setUnitSystem ( const shared_ptr< units::System > &  unitSystem)
overrideprotectedvirtual

Set the unitSystem of the Definition.

Note that this should be done before units are specified in the Definition

Reimplemented from smtk::attribute::ItemDefinition.

◆ supportedUnits()

std::string ValueItemDefinition::supportedUnits ( ) const

Return native units of the definition that are supported by its units system.

If there is no units system assigned to the definition or if the item's native units are not supported by the units system, an empty string is returned.

◆ units()

const std::string& smtk::attribute::ValueItemDefinition::units ( ) const
inline

Set/Get the units string associated with the definition.

If the units string is supported by the units system assigned to the definition, then unit conversion will be supported.


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