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

#include <Interface.h>

+ Inheritance diagram for PortElement:

Public Member Functions

virtual ~PortElement ()
 
Node Name
void setNodeName (const string &node)
 
bool hasNodeName () const
 Return true if this element has a node name string. More...
 
const stringgetNodeName () const
 Return the node name string of this element. More...
 
Node Graph
void setNodeGraphString (const string &node)
 Set the node graph string of this element. More...
 
bool hasNodeGraphString () const
 Return true if this element has a node graph string. More...
 
const stringgetNodeGraphString () const
 Return the node graph string of this element. More...
 
Output
void setOutputString (const string &output)
 Set the output string of this element. More...
 
bool hasOutputString () const
 Return true if this element has an output string. More...
 
const stringgetOutputString () const
 Return the output string of this element. More...
 
Connections
void setConnectedNode (NodePtr node)
 
virtual NodePtr getConnectedNode () const
 Return the node, if any, to which this element is connected. More...
 
Validation
bool validate (string *message=nullptr) const override
 
- Public Member Functions inherited from ValueElement
virtual ~ValueElement ()
 
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
 
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...
 
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...
 
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
 
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...
 
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...
 
- 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 NODE_NAME_ATTRIBUTE
 
static const string NODE_GRAPH_ATTRIBUTE
 
static const string OUTPUT_ATTRIBUTE
 
static const string CHANNELS_ATTRIBUTE
 
- Static Public Attributes inherited from ValueElement
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 Types

using NodePtr = shared_ptr< Node >
 
- 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 Member Functions

 PortElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from ValueElement
 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
 

Channels

void setChannels (const string &channels)
 
bool hasChannels () const
 Return true if this element has a channels string. More...
 
const stringgetChannels () const
 Return the channels string of this element. More...
 
static bool validChannelsCharacters (const string &channels, const string &sourceType)
 
static bool validChannelsString (const string &channels, const string &sourceType, const string &destinationType)
 

Additional Inherited Members

- 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 port elements such as Input and Output.

Port elements support spatially-varying upstream connections to nodes.

Definition at line 51 of file Interface.h.

Member Typedef Documentation

using PortElement::NodePtr = shared_ptr<Node>
protected

Definition at line 63 of file Interface.h.

Constructor & Destructor Documentation

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

Definition at line 54 of file Interface.h.

virtual PortElement::~PortElement ( )
inlinevirtual

Definition at line 60 of file Interface.h.

Member Function Documentation

const string& PortElement::getChannels ( ) const
inline

Return the channels string of this element.

Definition at line 150 of file Interface.h.

virtual NodePtr PortElement::getConnectedNode ( ) const
virtual

Return the node, if any, to which this element is connected.

Reimplemented in Input.

const string& PortElement::getNodeGraphString ( ) const
inline

Return the node graph string of this element.

Definition at line 105 of file Interface.h.

const string& PortElement::getNodeName ( ) const
inline

Return the node name string of this element.

Definition at line 83 of file Interface.h.

const string& PortElement::getOutputString ( ) const
inline

Return the output string of this element.

Definition at line 127 of file Interface.h.

bool PortElement::hasChannels ( ) const
inline

Return true if this element has a channels string.

Definition at line 144 of file Interface.h.

bool PortElement::hasNodeGraphString ( ) const
inline

Return true if this element has a node graph string.

Definition at line 99 of file Interface.h.

bool PortElement::hasNodeName ( ) const
inline

Return true if this element has a node name string.

Definition at line 77 of file Interface.h.

bool PortElement::hasOutputString ( ) const
inline

Return true if this element has an output string.

Definition at line 121 of file Interface.h.

void PortElement::setChannels ( const string channels)
inline

Set the channels string of this element, defining a channel swizzle that will be applied to the upstream result if this port is connected.

Definition at line 138 of file Interface.h.

void PortElement::setConnectedNode ( NodePtr  node)

Set the node to which this element is connected. The given node must belong to the same node graph. If the node argument is null, then any existing node connection will be cleared.

void PortElement::setNodeGraphString ( const string node)
inline

Set the node graph string of this element.

Definition at line 93 of file Interface.h.

void PortElement::setNodeName ( const string node)
inline

Set the node name string of this element, creating a connection to the Node with the given name within the same NodeGraph.

Definition at line 71 of file Interface.h.

void PortElement::setOutputString ( const string output)
inline

Set the output string of this element.

Definition at line 115 of file Interface.h.

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

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

Reimplemented from ValueElement.

Reimplemented in Output, and Input.

static bool PortElement::validChannelsCharacters ( const string channels,
const string sourceType 
)
static

Return true if the given channels characters are valid for the given source type string.

static bool PortElement::validChannelsString ( const string channels,
const string sourceType,
const string destinationType 
)
static

Return true if the given channels string is valid for the given source and destination type strings.

Member Data Documentation

const string PortElement::CHANNELS_ATTRIBUTE
static

Definition at line 189 of file Interface.h.

const string PortElement::NODE_GRAPH_ATTRIBUTE
static

Definition at line 187 of file Interface.h.

const string PortElement::NODE_NAME_ATTRIBUTE
static

Definition at line 186 of file Interface.h.

const string PortElement::OUTPUT_ATTRIBUTE
static

Definition at line 188 of file Interface.h.


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