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 isColorType () const
 Return true if the element is of color type. 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)
 
virtual 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
 

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)
 
template<class T >
shared_ptr< TresolveNameReference (const string &name, ConstElementPtr parent=nullptr) const
 
void validateRequire (bool expression, bool &res, string *message, const 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 900 of file Element.h.

Constructor & Destructor Documentation

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

Definition at line 903 of file Element.h.

virtual ValueElement::~ValueElement ( )
inlinevirtual

Definition at line 909 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 978 of file Element.h.

const string& ValueElement::getInterfaceName ( ) const
inline

Return the interface name of an element.

Definition at line 956 of file Element.h.

bool ValueElement::getIsUniform ( ) const
inline

The the uniform attribute flag for this element.

Definition at line 1095 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 1026 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 1057 of file Element.h.

const string& ValueElement::getUnitType ( ) const
inline

Return the unit type of an element.

Definition at line 1079 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 1011 of file Element.h.

const string& ValueElement::getValueString ( ) const
inline

Get the value string of a element.

Definition at line 927 of file Element.h.

bool ValueElement::hasImplementationName ( ) const
inline

Return true if the given element has an implementation name.

Definition at line 972 of file Element.h.

bool ValueElement::hasInterfaceName ( ) const
inline

Return true if the given element has an interface name.

Definition at line 950 of file Element.h.

bool ValueElement::hasUnit ( ) const
inline

Return true if the given element has a unit string.

Definition at line 1051 of file Element.h.

bool ValueElement::hasUnitType ( ) const
inline

Return true if the given element has a unit type.

Definition at line 1073 of file Element.h.

bool ValueElement::hasValue ( ) const
inline

Return true if the element possesses a typed value.

Definition at line 1001 of file Element.h.

bool ValueElement::hasValueString ( ) const
inline

Return true if the given element has a value string.

Definition at line 921 of file Element.h.

void ValueElement::setImplementationName ( const string name)
inline

Set the implementation name of an element.

Definition at line 966 of file Element.h.

void ValueElement::setInterfaceName ( const string name)
inline

Set the interface name of an element.

Definition at line 944 of file Element.h.

void ValueElement::setIsUniform ( bool  value)
inline

Set the uniform attribute flag on this element.

Definition at line 1089 of file Element.h.

void ValueElement::setUnit ( const string unit)
inline

Set the unit string of an element.

Definition at line 1045 of file Element.h.

void ValueElement::setUnitType ( const string unit)
inline

Set the unit type of an element.

Definition at line 1067 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 988 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 995 of file Element.h.

void ValueElement::setValueString ( const string value)
inline

Set the value string of an element.

Definition at line 915 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 1115 of file Element.h.

const string ValueElement::ENUM_VALUES_ATTRIBUTE
static

Definition at line 1116 of file Element.h.

const string ValueElement::IMPLEMENTATION_NAME_ATTRIBUTE
static

Definition at line 1113 of file Element.h.

const string ValueElement::IMPLEMENTATION_TYPE_ATTRIBUTE
static

Definition at line 1114 of file Element.h.

const string ValueElement::INTERFACE_NAME_ATTRIBUTE
static

Definition at line 1112 of file Element.h.

const string ValueElement::UI_ADVANCED_ATTRIBUTE
static

Definition at line 1124 of file Element.h.

const string ValueElement::UI_FOLDER_ATTRIBUTE
static

Definition at line 1118 of file Element.h.

const string ValueElement::UI_MAX_ATTRIBUTE
static

Definition at line 1120 of file Element.h.

const string ValueElement::UI_MIN_ATTRIBUTE
static

Definition at line 1119 of file Element.h.

const string ValueElement::UI_NAME_ATTRIBUTE
static

Definition at line 1117 of file Element.h.

const string ValueElement::UI_SOFT_MAX_ATTRIBUTE
static

Definition at line 1122 of file Element.h.

const string ValueElement::UI_SOFT_MIN_ATTRIBUTE
static

Definition at line 1121 of file Element.h.

const string ValueElement::UI_STEP_ATTRIBUTE
static

Definition at line 1123 of file Element.h.

const string ValueElement::UNIFORM_ATTRIBUTE
static

Definition at line 1127 of file Element.h.

const string ValueElement::UNIT_ATTRIBUTE
static

Definition at line 1125 of file Element.h.

const string ValueElement::UNITTYPE_ATTRIBUTE
static

Definition at line 1126 of file Element.h.

const string ValueElement::VALUE_ATTRIBUTE
static

Definition at line 1111 of file Element.h.


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