HDK
|
#include <Interface.h>
Public Member Functions | |
virtual | ~InterfaceElement () |
NodeDef String | |
void | setNodeDefString (const string &nodeDef) |
Set the NodeDef string for the interface. More... | |
bool | hasNodeDefString () const |
Return true if the given interface has a NodeDef string. More... | |
const string & | getNodeDefString () const |
Return the NodeDef string for the interface. More... | |
Inputs | |
InputPtr | addInput (const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING) |
InputPtr | getInput (const string &name) const |
Return the Input, if any, with the given name. More... | |
vector< InputPtr > | getInputs () const |
Return a vector of all Input elements. More... | |
size_t | getInputCount () const |
Return the number of Input elements. More... | |
void | removeInput (const string &name) |
Remove the Input, if any, with the given name. More... | |
InputPtr | getActiveInput (const string &name) const |
vector< InputPtr > | getActiveInputs () const |
Outputs | |
OutputPtr | addOutput (const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING) |
OutputPtr | getOutput (const string &name) const |
Return the Output, if any, with the given name. More... | |
vector< OutputPtr > | getOutputs () const |
Return a vector of all Output elements. More... | |
size_t | getOutputCount () const |
Return the number of Output elements. More... | |
void | removeOutput (const string &name) |
Remove the Output, if any, with the given name. More... | |
OutputPtr | getActiveOutput (const string &name) const |
vector< OutputPtr > | getActiveOutputs () const |
void | setConnectedOutput (const string &inputName, OutputPtr output) |
OutputPtr | getConnectedOutput (const string &inputName) const |
Tokens | |
TokenPtr | addToken (const string &name=EMPTY_STRING) |
TokenPtr | getToken (const string &name) const |
Return the Token, if any, with the given name. More... | |
vector< TokenPtr > | getTokens () const |
Return a vector of all Token elements. More... | |
void | removeToken (const string &name) |
Remove the Token, if any, with the given name. More... | |
TokenPtr | getActiveToken (const string &name) const |
vector< TokenPtr > | getActiveTokens () const |
Value Elements | |
ValueElementPtr | getValueElement (const string &name) const |
Return the ValueElement, if any, with the given name. More... | |
ValueElementPtr | getActiveValueElement (const string &name) const |
vector< ValueElementPtr > | getActiveValueElements () const |
Values | |
template<class T > | |
InputPtr | setInputValue (const string &name, const T &value, const string &type=EMPTY_STRING) |
ValuePtr | getInputValue (const string &name, const string &target=EMPTY_STRING) const |
TokenPtr | setTokenValue (const string &name, const string &value) |
string | getTokenValue (const string &name) |
Target | |
void | setTarget (const string &target) |
Set the target string of this interface. More... | |
bool | hasTarget () const |
Return true if the given interface has a target string. More... | |
const string & | getTarget () const |
Return the target string of this interface. More... | |
Version | |
void | setVersionString (const string &version) |
Set the version string of this interface. More... | |
bool | hasVersionString () const |
Return true if this interface has a version string. More... | |
const string & | getVersionString () const |
Return the version string of this interface. More... | |
void | setVersionIntegers (int majorVersion, int minorVersion) |
Set the major and minor versions as an integer pair. More... | |
virtual std::pair< int, int > | getVersionIntegers () const |
Return the major and minor versions as an integer pair. More... | |
Default Version | |
void | setDefaultVersion (bool defaultVersion) |
Set the default version flag of this element. More... | |
bool | getDefaultVersion () const |
Return the default version flag of this element. More... | |
Utility | |
virtual ConstInterfaceElementPtr | getDeclaration (const string &target=EMPTY_STRING) const |
void | clearContent () override |
Clear all attributes and descendants from this element. More... | |
bool | hasExactInputMatch (ConstInterfaceElementPtr declaration, string *message=nullptr) const |
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 string & | getType () 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 | |
Element & | operator= (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 string & | getCategory () const |
void | setName (const string &name) |
const string & | getName () 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 string & | getFilePrefix () const |
Return the element's file prefix string. More... | |
const string & | getActiveFilePrefix () 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 string & | getGeomPrefix () const |
Return the element's geom prefix string. More... | |
const string & | getActiveGeomPrefix () 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 string & | getColorSpace () const |
Return the element's color space string. More... | |
const string & | getActiveColorSpace () 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 string & | getInheritString () 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 string & | getNamespace () 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< T > | asA () |
Dynamic cast to an instance of the given subclass. More... | |
template<class T > | |
shared_ptr< const T > | asA () const |
Dynamic cast to a const instance of the given subclass. More... | |
template<class T > | |
shared_ptr< T > | addChild (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< T > | getChildOfType (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 string & | getAttribute (const string &attrib) const |
const StringVec & | getAttributeNames () 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 T > | getAncestorOfType () 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 string & | getSourceUri () const |
Return the element's source URI. More... | |
const string & | getActiveSourceUri () const |
virtual bool | validate (string *message=nullptr) const |
void | copyContentFrom (const ConstElementPtr &source) |
string | createValidChildName (string name) const |
StringResolverPtr | createStringResolver (const string &geom=EMPTY_STRING) const |
string | asString () const |
Static Public Attributes | |
static const string | NODE_DEF_ATTRIBUTE |
static const string | TARGET_ATTRIBUTE |
static const string | VERSION_ATTRIBUTE |
static const string | DEFAULT_VERSION_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 | NodeDefPtr = shared_ptr< NodeDef > |
using | ConstNodeDefPtr = shared_ptr< const NodeDef > |
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 | |
InterfaceElement (ElementPtr parent, const string &category, const string &name) | |
void | registerChildElement (ElementPtr child) override |
void | unregisterChildElement (ElementPtr child) override |
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< T > | resolveNameReference (const string &name, ConstElementPtr parent=nullptr) const |
void | validateRequire (bool expression, bool &res, string *message, const string &errorDesc) const |
ElementPtr | getSelfNonConst () const |
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 |
The base class for interface elements such as Node, NodeDef, and NodeGraph.
An InterfaceElement supports a set of Input and Output elements, with an API for setting their values.
Definition at line 317 of file Interface.h.
|
protected |
Definition at line 332 of file Interface.h.
|
protected |
Definition at line 331 of file Interface.h.
|
inlineprotected |
Definition at line 320 of file Interface.h.
|
inlinevirtual |
Definition at line 328 of file Interface.h.
|
inline |
Add an Input to this interface.
name | The name of the new Input. If no name is specified, then a unique name will automatically be generated. |
type | An optional type string. |
Definition at line 366 of file Interface.h.
|
inline |
Add an Output to this interface.
name | The name of the new Output. If no name is specified, then a unique name will automatically be generated. |
type | An optional type string. |
Definition at line 416 of file Interface.h.
|
inline |
Add a Token to this interface.
name | The name of the new Token. If no name is specified, then a unique name will automatically be generated. |
Definition at line 474 of file Interface.h.
|
overridevirtual |
Clear all attributes and descendants from this element.
Reimplemented from Element.
Return the first Input with the given name that belongs to this interface, taking interface inheritance into account.
vector<InputPtr> InterfaceElement::getActiveInputs | ( | ) | const |
Return a vector of all Input elements that belong to this interface, taking inheritance into account.
Return the first Output with the given name that belongs to this interface, taking interface inheritance into account.
vector<OutputPtr> InterfaceElement::getActiveOutputs | ( | ) | const |
Return a vector of all Output elements that belong to this interface, taking inheritance into account.
Return the first Token with the given name that belongs to this interface, taking interface inheritance into account.
vector<TokenPtr> InterfaceElement::getActiveTokens | ( | ) | const |
Return a vector of all Token elements that belong to this interface, taking inheritance into account.
ValueElementPtr InterfaceElement::getActiveValueElement | ( | const string & | name | ) | const |
vector<ValueElementPtr> InterfaceElement::getActiveValueElements | ( | ) | const |
Return the output connected to the given input. If the given input is not present, then an empty OutputPtr is returned.
|
virtual |
Return the first declaration of this interface, optionally filtered by the given target name.
target | An optional target name, which will be used to filter the declarations that are considered. |
Reimplemented in NodeGraph, Implementation, NodeDef, and Node.
|
inline |
Return the default version flag of this element.
Definition at line 625 of file Interface.h.
Return the Input, if any, with the given name.
Definition at line 375 of file Interface.h.
|
inline |
Return the number of Input elements.
Definition at line 387 of file Interface.h.
|
inline |
Return a vector of all Input elements.
Definition at line 381 of file Interface.h.
ValuePtr InterfaceElement::getInputValue | ( | const string & | name, |
const string & | target = EMPTY_STRING |
||
) | const |
Return the typed value of an input by its name, taking both the calling element and its declaration into account.
name | The name of the input to be evaluated. |
target | An optional target name, which will be used to filter the declarations that are considered. |
|
inline |
Return the NodeDef string for the interface.
Definition at line 351 of file Interface.h.
Return the Output, if any, with the given name.
Definition at line 425 of file Interface.h.
|
inline |
Return the number of Output elements.
Definition at line 437 of file Interface.h.
|
inline |
Return a vector of all Output elements.
Definition at line 431 of file Interface.h.
|
inline |
Return the target string of this interface.
Definition at line 581 of file Interface.h.
Return the Token, if any, with the given name.
Definition at line 480 of file Interface.h.
|
inline |
Return a vector of all Token elements.
Definition at line 486 of file Interface.h.
Return the string value of a Token by its name, or an empty string if the given Token is not present.
Definition at line 558 of file Interface.h.
|
inline |
Return the ValueElement, if any, with the given name.
Definition at line 510 of file Interface.h.
Return the major and minor versions as an integer pair.
Reimplemented in Document.
|
inline |
Return the version string of this interface.
Definition at line 603 of file Interface.h.
bool InterfaceElement::hasExactInputMatch | ( | ConstInterfaceElementPtr | declaration, |
string * | message = nullptr |
||
) | const |
Return true if this instance has an exact input match with the given declaration, where each input of this the instance corresponds to a declaration input of the same name and type.
If an exact input match is not found, and the optional message argument is provided, then an error message will be appended to the given string.
|
inline |
Return true if the given interface has a NodeDef string.
Definition at line 345 of file Interface.h.
|
inline |
Return true if the given interface has a target string.
Definition at line 575 of file Interface.h.
|
inline |
Return true if this interface has a version string.
Definition at line 597 of file Interface.h.
|
overrideprotectedvirtual |
Reimplemented from Element.
Remove the Input, if any, with the given name.
Definition at line 393 of file Interface.h.
Remove the Output, if any, with the given name.
Definition at line 443 of file Interface.h.
Remove the Token, if any, with the given name.
Definition at line 492 of file Interface.h.
Set the output to which the given input is connected, creating a child input if needed. If the node argument is null, then any existing output connection on the input will be cleared.
|
inline |
Set the default version flag of this element.
Definition at line 619 of file Interface.h.
InputPtr InterfaceElement::setInputValue | ( | const string & | name, |
const T & | value, | ||
const string & | type = EMPTY_STRING |
||
) |
Set the typed value of an input by its name, creating a child element to hold the input if needed.
Definition at line 670 of file Interface.h.
Set the NodeDef string for the interface.
Definition at line 339 of file Interface.h.
Set the target string of this interface.
Definition at line 569 of file Interface.h.
Set the string value of a Token by its name, creating a child element to hold the Token if needed.
Definition at line 547 of file Interface.h.
Set the major and minor versions as an integer pair.
Set the version string of this interface.
Definition at line 591 of file Interface.h.
|
overrideprotectedvirtual |
Reimplemented from Element.
|
static |
Definition at line 659 of file Interface.h.
|
static |
Definition at line 656 of file Interface.h.
|
static |
Definition at line 657 of file Interface.h.
|
static |
Definition at line 658 of file Interface.h.