HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ValueElement Class Reference

#include <Element.h>

+ Inheritance diagram for ValueElement:

Public Member Functions

virtual ~ValueElement ()
 
Value String
void setValueString (const string &value)
 Set the value string of an element. More...
 
bool hasValueString () const
 Return true if the given element has a value string. More...
 
const stringgetValueString () const
 Get the value string of a element. More...
 
string getResolvedValueString (StringResolverPtr resolver=nullptr) const
 
Interface Names
void setInterfaceName (const string &name)
 Set the interface name of an element. More...
 
bool hasInterfaceName () const
 Return true if the given element has an interface name. More...
 
const stringgetInterfaceName () const
 Return the interface name of an element. More...
 
Implementation Names
void setImplementationName (const string &name)
 Set the implementation name of an element. More...
 
bool hasImplementationName () const
 Return true if the given element has an implementation name. More...
 
const stringgetImplementationName () const
 Return the implementation name of an element. More...
 
Typed Value
template<class T >
void setValue (const T &value, const string &type=EMPTY_STRING)
 Set the typed value of an element. More...
 
void setValue (const char *value, const string &type=EMPTY_STRING)
 Set the typed value of an element from a C-style string. More...
 
bool hasValue () const
 Return true if the element possesses a typed value. More...
 
ValuePtr getValue () const
 
ValuePtr getResolvedValue (StringResolverPtr resolver=nullptr) const
 
ValuePtr getDefaultValue () const
 
Units
void setUnit (const string &unit)
 Set the unit string of an element. More...
 
bool hasUnit () const
 Return true if the given element has a unit string. More...
 
const stringgetUnit () const
 Return the unit string of an element. More...
 
const stringgetActiveUnit () const
 
void setUnitType (const string &unit)
 Set the unit type of an element. More...
 
bool hasUnitType () const
 Return true if the given element has a unit type. More...
 
const stringgetUnitType () const
 Return the unit type of an element. More...
 
Uniform attribute
void setIsUniform (bool value)
 Set the uniform attribute flag on this element. More...
 
bool getIsUniform () const
 The the uniform attribute flag for this element. More...
 
Validation
bool validate (string *message=nullptr) const override
 
- Public Member Functions inherited from TypedElement
virtual ~TypedElement ()
 
void setType (const string &type)
 Set the element's type string. More...
 
bool hasType () const
 Return true if the given element has a type string. More...
 
virtual const stringgetType () const
 Return the element's type string. More...
 
bool isMultiOutputType () const
 Return true if the element is of multi-output type. More...
 
TypeDefPtr getTypeDef () const
 
- Public Member Functions inherited from Element
virtual ~Element ()
 
 Element (const Element &)=delete
 
Elementoperator= (const Element &)=delete
 
bool operator== (const Element &rhs) const
 
bool operator!= (const Element &rhs) const
 
void setCategory (const string &category)
 Set the element's category string. More...
 
const stringgetCategory () const
 
void setName (const string &name)
 
const stringgetName () const
 Return the element's name string. More...
 
string getNamePath (ConstElementPtr relativeTo=nullptr) const
 
ElementPtr getDescendant (const string &namePath) const
 
void setFilePrefix (const string &prefix)
 Set the element's file prefix string. More...
 
bool hasFilePrefix () const
 Return true if the given element has a file prefix string. More...
 
const stringgetFilePrefix () const
 Return the element's file prefix string. More...
 
const stringgetActiveFilePrefix () const
 
void setGeomPrefix (const string &prefix)
 Set the element's geom prefix string. More...
 
bool hasGeomPrefix () const
 Return true if the given element has a geom prefix string. More...
 
const stringgetGeomPrefix () const
 Return the element's geom prefix string. More...
 
const stringgetActiveGeomPrefix () const
 
void setColorSpace (const string &colorSpace)
 Set the element's color space string. More...
 
bool hasColorSpace () const
 Return true if the given element has a color space string. More...
 
const stringgetColorSpace () const
 Return the element's color space string. More...
 
const stringgetActiveColorSpace () const
 
void setInheritString (const string &inherit)
 Set the inherit string of this element. More...
 
bool hasInheritString () const
 Return true if this element has an inherit string. More...
 
const stringgetInheritString () const
 Return the inherit string of this element. More...
 
void setInheritsFrom (ConstElementPtr super)
 Set the element that this one directly inherits from. More...
 
ElementPtr getInheritsFrom () const
 Return the element, if any, that this one directly inherits from. More...
 
bool hasInheritedBase (ConstElementPtr base) const
 
bool hasInheritanceCycle () const
 Return true if the inheritance chain for this element contains a cycle. More...
 
void setNamespace (const string &space)
 Set the namespace string of this element. More...
 
bool hasNamespace () const
 Return true if this element has a namespace string. More...
 
const stringgetNamespace () const
 Return the namespace string of this element. More...
 
string getQualifiedName (const string &name) const
 
void setDocString (const string &doc)
 Set the documentation string of this element. More...
 
string getDocString () const
 Return the documentation string of this element. More...
 
template<class T >
bool isA (const string &category=EMPTY_STRING) const
 
template<class T >
shared_ptr< TasA ()
 Dynamic cast to an instance of the given subclass. More...
 
template<class T >
shared_ptr< const TasA () const
 Dynamic cast to a const instance of the given subclass. More...
 
template<class T >
shared_ptr< TaddChild (const string &name=EMPTY_STRING)
 
ElementPtr addChildOfCategory (const string &category, string name=EMPTY_STRING)
 
ElementPtr changeChildCategory (ElementPtr child, const string &category)
 
ElementPtr getChild (const string &name) const
 Return the child element, if any, with the given name. More...
 
template<class T >
shared_ptr< TgetChildOfType (const string &name) const
 
const vector< ElementPtr > & getChildren () const
 
template<class T >
vector< shared_ptr< T > > getChildrenOfType (const string &category=EMPTY_STRING) const
 
void setChildIndex (const string &name, int index)
 
int getChildIndex (const string &name) const
 
void removeChild (const string &name)
 Remove the child element, if any, with the given name. More...
 
template<class T >
void removeChildOfType (const string &name)
 
void setAttribute (const string &attrib, const string &value)
 Set the value string of the given attribute. More...
 
bool hasAttribute (const string &attrib) const
 Return true if the given attribute is present. More...
 
const stringgetAttribute (const string &attrib) const
 
const StringVecgetAttributeNames () const
 Return a vector of stored attribute names, in the order they were set. More...
 
template<class T >
void setTypedAttribute (const string &attrib, const T &data)
 
template<class T >
T getTypedAttribute (const string &attrib) const
 
void removeAttribute (const string &attrib)
 Remove the given attribute, if present. More...
 
ElementPtr getSelf ()
 Return our self pointer. More...
 
ConstElementPtr getSelf () const
 Return our self pointer. More...
 
ElementPtr getParent ()
 Return our parent element. More...
 
ConstElementPtr getParent () const
 Return our parent element. More...
 
ElementPtr getRoot ()
 Return the root element of our tree. More...
 
ConstElementPtr getRoot () const
 Return the root element of our tree. More...
 
DocumentPtr getDocument ()
 Return the root document of our tree. More...
 
ConstDocumentPtr getDocument () const
 Return the root document of our tree. More...
 
template<class T >
shared_ptr< const TgetAncestorOfType () const
 
TreeIterator traverseTree () const
 
GraphIterator traverseGraph () const
 
virtual Edge getUpstreamEdge (size_t index=0) const
 
virtual size_t getUpstreamEdgeCount () const
 Return the number of queriable upstream edges for this element. More...
 
ElementPtr getUpstreamElement (size_t index=0) const
 
InheritanceIterator traverseInheritance () const
 
void setSourceUri (const string &sourceUri)
 
bool hasSourceUri () const
 Return true if this element has a source URI. More...
 
const stringgetSourceUri () const
 Return the element's source URI. More...
 
const stringgetActiveSourceUri () const
 
void copyContentFrom (const ConstElementPtr &source)
 
void clearContent ()
 Clear all attributes and descendants from this element. More...
 
string createValidChildName (string name) const
 
StringResolverPtr createStringResolver (const string &geom=EMPTY_STRING) const
 
string asString () const
 
template<class T >
shared_ptr< TresolveRootNameReference (const string &name) const
 

Static Public Attributes

static const string VALUE_ATTRIBUTE
 
static const string INTERFACE_NAME_ATTRIBUTE
 
static const string IMPLEMENTATION_NAME_ATTRIBUTE
 
static const string IMPLEMENTATION_TYPE_ATTRIBUTE
 
static const string ENUM_ATTRIBUTE
 
static const string ENUM_VALUES_ATTRIBUTE
 
static const string UI_NAME_ATTRIBUTE
 
static const string UI_FOLDER_ATTRIBUTE
 
static const string UI_MIN_ATTRIBUTE
 
static const string UI_MAX_ATTRIBUTE
 
static const string UI_SOFT_MIN_ATTRIBUTE
 
static const string UI_SOFT_MAX_ATTRIBUTE
 
static const string UI_STEP_ATTRIBUTE
 
static const string UI_ADVANCED_ATTRIBUTE
 
static const string UNIT_ATTRIBUTE
 
static const string UNITTYPE_ATTRIBUTE
 
static const string UNIFORM_ATTRIBUTE
 
- Static Public Attributes inherited from TypedElement
static const string TYPE_ATTRIBUTE
 
- Static Public Attributes inherited from Element
static const string NAME_ATTRIBUTE
 
static const string FILE_PREFIX_ATTRIBUTE
 
static const string GEOM_PREFIX_ATTRIBUTE
 
static const string COLOR_SPACE_ATTRIBUTE
 
static const string INHERIT_ATTRIBUTE
 
static const string NAMESPACE_ATTRIBUTE
 
static const string DOC_ATTRIBUTE
 

Protected Member Functions

 ValueElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from TypedElement
 TypedElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from Element
 Element (ElementPtr parent, const string &category, const string &name)
 
void validateRequire (bool expression, bool &res, string *message, string errorDesc) const
 
virtual void registerChildElement (ElementPtr child)
 
virtual void unregisterChildElement (ElementPtr child)
 
ElementPtr getSelfNonConst () const
 

Additional Inherited Members

- Protected Types inherited from TypedElement
using TypeDefPtr = shared_ptr< class TypeDef >
 
- Protected Types inherited from Element
using DocumentPtr = shared_ptr< Document >
 
using ConstDocumentPtr = shared_ptr< const Document >
 
- Protected Attributes inherited from Element
string _category
 
string _name
 
string _sourceUri
 
ElementMap _childMap
 
vector< ElementPtr_childOrder
 
StringMap _attributeMap
 
StringVec _attributeOrder
 
weak_ptr< Element_parent
 
weak_ptr< Element_root
 

Detailed Description

The base class for elements that support typed values.

Definition at line 887 of file Element.h.

Constructor & Destructor Documentation

ValueElement::ValueElement ( ElementPtr  parent,
const string category,
const string name 
)
inlineprotected

Definition at line 890 of file Element.h.

virtual ValueElement::~ValueElement ( )
inlinevirtual

Definition at line 896 of file Element.h.

Member Function Documentation

const string& ValueElement::getActiveUnit ( ) const

Return the unit defined by the assocaited NodeDef if this element is a child of a Node.

ValuePtr ValueElement::getDefaultValue ( ) const

Return the default value for this element as a generic value object, which may be queried to access its data.

Returns
A shared pointer to a typed value, or an empty shared pointer if no default value was found.
const string& ValueElement::getImplementationName ( ) const
inline

Return the implementation name of an element.

Definition at line 965 of file Element.h.

const string& ValueElement::getInterfaceName ( ) const
inline

Return the interface name of an element.

Definition at line 943 of file Element.h.

bool ValueElement::getIsUniform ( ) const
inline

The the uniform attribute flag for this element.

Definition at line 1082 of file Element.h.

ValuePtr ValueElement::getResolvedValue ( StringResolverPtr  resolver = nullptr) const
inline

Return the resolved value of an element as a generic value object, which may be queried to access its data.

Parameters
resolverAn optional string resolver, which will be used to apply string substitutions. By default, a new string resolver will be created at this scope and applied to the return value.
Returns
A shared pointer to the typed value of this element, or an empty shared pointer if no value is present.

Definition at line 1013 of file Element.h.

string ValueElement::getResolvedValueString ( StringResolverPtr  resolver = nullptr) const

Return the resolved value string of an element, applying any string substitutions that are defined at the element's scope.

Parameters
resolverAn optional string resolver, which will be used to apply string substitutions. By default, a new string resolver will be created at this scope and applied to the return value.
const string& ValueElement::getUnit ( ) const
inline

Return the unit string of an element.

Definition at line 1044 of file Element.h.

const string& ValueElement::getUnitType ( ) const
inline

Return the unit type of an element.

Definition at line 1066 of file Element.h.

ValuePtr ValueElement::getValue ( ) const
inline

Return the typed value of an element as a generic value object, which may be queried to access its data.

Returns
A shared pointer to the typed value of this element, or an empty shared pointer if no value is present.

Definition at line 998 of file Element.h.

const string& ValueElement::getValueString ( ) const
inline

Get the value string of a element.

Definition at line 914 of file Element.h.

bool ValueElement::hasImplementationName ( ) const
inline

Return true if the given element has an implementation name.

Definition at line 959 of file Element.h.

bool ValueElement::hasInterfaceName ( ) const
inline

Return true if the given element has an interface name.

Definition at line 937 of file Element.h.

bool ValueElement::hasUnit ( ) const
inline

Return true if the given element has a unit string.

Definition at line 1038 of file Element.h.

bool ValueElement::hasUnitType ( ) const
inline

Return true if the given element has a unit type.

Definition at line 1060 of file Element.h.

bool ValueElement::hasValue ( ) const
inline

Return true if the element possesses a typed value.

Definition at line 988 of file Element.h.

bool ValueElement::hasValueString ( ) const
inline

Return true if the given element has a value string.

Definition at line 908 of file Element.h.

void ValueElement::setImplementationName ( const string name)
inline

Set the implementation name of an element.

Definition at line 953 of file Element.h.

void ValueElement::setInterfaceName ( const string name)
inline

Set the interface name of an element.

Definition at line 931 of file Element.h.

void ValueElement::setIsUniform ( bool  value)
inline

Set the uniform attribute flag on this element.

Definition at line 1076 of file Element.h.

void ValueElement::setUnit ( const string unit)
inline

Set the unit string of an element.

Definition at line 1032 of file Element.h.

void ValueElement::setUnitType ( const string unit)
inline

Set the unit type of an element.

Definition at line 1054 of file Element.h.

template<class T >
void ValueElement::setValue ( const T value,
const string type = EMPTY_STRING 
)
inline

Set the typed value of an element.

Definition at line 975 of file Element.h.

void ValueElement::setValue ( const char *  value,
const string type = EMPTY_STRING 
)
inline

Set the typed value of an element from a C-style string.

Definition at line 982 of file Element.h.

void ValueElement::setValueString ( const string value)
inline

Set the value string of an element.

Definition at line 902 of file Element.h.

bool ValueElement::validate ( string message = nullptr) const
overridevirtual

Validate that the given element tree, including all descendants, is consistent with the MaterialX specification.

Reimplemented from Element.

Reimplemented in Output, Input, and PortElement.

Member Data Documentation

const string ValueElement::ENUM_ATTRIBUTE
static

Definition at line 1102 of file Element.h.

const string ValueElement::ENUM_VALUES_ATTRIBUTE
static

Definition at line 1103 of file Element.h.

const string ValueElement::IMPLEMENTATION_NAME_ATTRIBUTE
static

Definition at line 1100 of file Element.h.

const string ValueElement::IMPLEMENTATION_TYPE_ATTRIBUTE
static

Definition at line 1101 of file Element.h.

const string ValueElement::INTERFACE_NAME_ATTRIBUTE
static

Definition at line 1099 of file Element.h.

const string ValueElement::UI_ADVANCED_ATTRIBUTE
static

Definition at line 1111 of file Element.h.

const string ValueElement::UI_FOLDER_ATTRIBUTE
static

Definition at line 1105 of file Element.h.

const string ValueElement::UI_MAX_ATTRIBUTE
static

Definition at line 1107 of file Element.h.

const string ValueElement::UI_MIN_ATTRIBUTE
static

Definition at line 1106 of file Element.h.

const string ValueElement::UI_NAME_ATTRIBUTE
static

Definition at line 1104 of file Element.h.

const string ValueElement::UI_SOFT_MAX_ATTRIBUTE
static

Definition at line 1109 of file Element.h.

const string ValueElement::UI_SOFT_MIN_ATTRIBUTE
static

Definition at line 1108 of file Element.h.

const string ValueElement::UI_STEP_ATTRIBUTE
static

Definition at line 1110 of file Element.h.

const string ValueElement::UNIFORM_ATTRIBUTE
static

Definition at line 1114 of file Element.h.

const string ValueElement::UNIT_ATTRIBUTE
static

Definition at line 1112 of file Element.h.

const string ValueElement::UNITTYPE_ATTRIBUTE
static

Definition at line 1113 of file Element.h.

const string ValueElement::VALUE_ATTRIBUTE
static

Definition at line 1098 of file Element.h.


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