HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Definition.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_DEFINITION_H
7 #define MATERIALX_DEFINITION_H
8 
9 /// @file
10 /// Definition element subclasses
11 
12 #include <MaterialXCore/Export.h>
13 
15 
17 
18 extern MX_CORE_API const string COLOR_SEMANTIC;
19 extern MX_CORE_API const string SHADER_SEMANTIC;
20 
21 class NodeDef;
22 class Implementation;
23 class TypeDef;
24 class TargetDef;
25 class Member;
26 class Unit;
27 class UnitDef;
28 class UnitTypeDef;
29 class AttributeDef;
30 
31 /// A shared pointer to a NodeDef
32 using NodeDefPtr = shared_ptr<NodeDef>;
33 /// A shared pointer to a const NodeDef
34 using ConstNodeDefPtr = shared_ptr<const NodeDef>;
35 
36 /// A shared pointer to an Implementation
37 using ImplementationPtr = shared_ptr<Implementation>;
38 /// A shared pointer to a const Implementation
39 using ConstImplementationPtr = shared_ptr<const Implementation>;
40 
41 /// A shared pointer to a TypeDef
42 using TypeDefPtr = shared_ptr<TypeDef>;
43 /// A shared pointer to a const TypeDef
44 using ConstTypeDefPtr = shared_ptr<const TypeDef>;
45 
46 /// A shared pointer to a TargetDef
47 using TargetDefPtr = shared_ptr<TargetDef>;
48 /// A shared pointer to a const TargetDef
49 using ConstTargetDefPtr = shared_ptr<const TargetDef>;
50 
51 /// A shared pointer to a Member
52 using MemberPtr = shared_ptr<Member>;
53 /// A shared pointer to a const Member
54 using ConstMemberPtr = shared_ptr<const Member>;
55 
56 /// A shared pointer to a Unit
57 using UnitPtr = shared_ptr<Unit>;
58 /// A shared pointer to a const Unit
59 using ConstUnitPtr = shared_ptr<const Unit>;
60 
61 /// A shared pointer to a UnitDef
62 using UnitDefPtr = shared_ptr<UnitDef>;
63 /// A shared pointer to a const UnitDef
64 using ConstUnitDefPtr = shared_ptr<const UnitDef>;
65 
66 /// A shared pointer to a UnitTypeDef
67 using UnitTypeDefPtr = shared_ptr<UnitTypeDef>;
68 /// A shared pointer to a const UnitTypeDef
69 using ConstUnitTypeDefPtr = shared_ptr<const UnitTypeDef>;
70 
71 /// A shared pointer to an AttributeDef
72 using AttributeDefPtr = shared_ptr<AttributeDef>;
73 /// A shared pointer to a const AttributeDef
74 using AttributeDefDefPtr = shared_ptr<const AttributeDef>;
75 
76 /// @class NodeDef
77 /// A node definition element within a Document.
78 ///
79 /// A NodeDef provides the declaration of a node interface, which may then
80 /// be instantiated as a Node.
82 {
83  public:
84  NodeDef(ElementPtr parent, const string& name) :
85  InterfaceElement(parent, CATEGORY, name)
86  {
87  }
88  virtual ~NodeDef() { }
89 
90  /// @name Node String
91  /// @{
92 
93  /// Set the node string of the NodeDef.
94  void setNodeString(const string& node)
95  {
96  setAttribute(NODE_ATTRIBUTE, node);
97  }
98 
99  /// Return true if the given NodeDef has a node string.
100  bool hasNodeString() const
101  {
102  return hasAttribute(NODE_ATTRIBUTE);
103  }
104 
105  /// Return the node string of the NodeDef.
106  const string& getNodeString() const
107  {
108  return getAttribute(NODE_ATTRIBUTE);
109  }
110 
111  /// Return the element's output type.
112  const string& getType() const override;
113 
114  /// @}
115  /// @name Node Group
116  /// @{
117 
118  /// Set the node group of the NodeDef.
119  void setNodeGroup(const string& category)
120  {
121  setAttribute(NODE_GROUP_ATTRIBUTE, category);
122  }
123 
124  /// Return true if the given NodeDef has a node group.
125  bool hasNodeGroup() const
126  {
127  return hasAttribute(NODE_GROUP_ATTRIBUTE);
128  }
129 
130  /// Return the node group of the NodeDef.
131  const string& getNodeGroup() const
132  {
133  return getAttribute(NODE_GROUP_ATTRIBUTE);
134  }
135 
136  /// @}
137  /// @name Implementation References
138  /// @{
139 
140  /// Return the first implementation for this nodedef, optionally filtered
141  /// by the given target name. Resolving any indirection chain in the
142  /// implementations.
143  /// @param target An optional target name, which will be used to filter
144  /// the implementations that are considered.
145  /// @param resolveNodeGraph Allow resolution of Implementation elements
146  /// to their linked NodeGraph elements. Defaults to true.
147  /// @return An implementation for this nodedef, or an empty shared pointer
148  /// if none was found. Note that a node implementation may be either
149  /// an Implementation element or a NodeGraph element.
150  InterfaceElementPtr getImplementation(const string& target = EMPTY_STRING, bool resolveNodeGraph = true) const;
151 
152  /// @}
153  /// @name Hints
154  /// @{
155 
156  /// Return list of input hint pairs of the form { input_name, hint_string }
157  StringMap getInputHints() const;
158 
159  /// @}
160  /// @name Validation
161  /// @{
162 
163  /// Validate that the given element tree, including all descendants, is
164  /// consistent with the MaterialX specification.
165  bool validate(string* message = nullptr) const override;
166 
167  /// @}
168  /// @name Utility
169  /// @{
170 
171  /// Return true if the given version string is compatible with this
172  /// NodeDef. This may be used to test, for example, whether a NodeDef
173  /// and Node may be used together.
174  bool isVersionCompatible(const string& version) const;
175 
176  /// Return the first declaration of this interface, optionally filtered
177  /// by the given target name.
178  ConstInterfaceElementPtr getDeclaration(const string& target = EMPTY_STRING) const override;
179 
180  /// @}
181 
182  public:
183  static const string CATEGORY;
184  static const string NODE_ATTRIBUTE;
185  static const string NODE_GROUP_ATTRIBUTE;
186 
187  static const string TEXTURE_NODE_GROUP;
188  static const string PROCEDURAL_NODE_GROUP;
189  static const string GEOMETRIC_NODE_GROUP;
190  static const string ADJUSTMENT_NODE_GROUP;
191  static const string CONDITIONAL_NODE_GROUP;
192  static const string CHANNEL_NODE_GROUP;
193  static const string ORGANIZATION_NODE_GROUP;
194  static const string TRANSLATION_NODE_GROUP;
195 };
196 
197 /// @class Implementation
198 /// An implementation element within a Document.
199 ///
200 /// An Implementation is used to associate external source code with a specific
201 /// NodeDef, providing a definition for the node that may either be universal or
202 /// restricted to a specific target.
204 {
205  public:
206  Implementation(ElementPtr parent, const string& name) :
207  InterfaceElement(parent, CATEGORY, name)
208  {
209  }
210  virtual ~Implementation() { }
211 
212  /// @name File String
213  /// @{
214 
215  /// Set the file string for the Implementation.
216  void setFile(const string& file)
217  {
218  setAttribute(FILE_ATTRIBUTE, file);
219  }
220 
221  /// Return true if the given Implementation has a file string.
222  bool hasFile() const
223  {
224  return hasAttribute(FILE_ATTRIBUTE);
225  }
226 
227  /// Return the file string for the Implementation.
228  const string& getFile() const
229  {
230  return getAttribute(FILE_ATTRIBUTE);
231  }
232 
233  /// @}
234  /// @name Function String
235  /// @{
236 
237  /// Set the function string for the Implementation.
238  void setFunction(const string& function)
239  {
240  setAttribute(FUNCTION_ATTRIBUTE, function);
241  }
242 
243  /// Return true if the given Implementation has a function string.
244  bool hasFunction() const
245  {
246  return hasAttribute(FUNCTION_ATTRIBUTE);
247  }
248 
249  /// Return the function string for the Implementation.
250  const string& getFunction() const
251  {
252  return getAttribute(FUNCTION_ATTRIBUTE);
253  }
254 
255  /// @}
256  /// @name Nodegraph String
257  /// @{
258 
259  /// Set the nodegraph string for the Implementation.
260  void setNodeGraph(const string& nodegraph)
261  {
262  setAttribute(NODE_GRAPH_ATTRIBUTE, nodegraph);
263  }
264 
265  /// Return true if the given Implementation has a nodegraph string.
266  bool hasNodeGraph() const
267  {
268  return hasAttribute(NODE_GRAPH_ATTRIBUTE);
269  }
270 
271  /// Return the nodegraph string for the Implementation.
272  const string& getNodeGraph() const
273  {
275  }
276 
277  /// @}
278  /// @name NodeDef References
279  /// @{
280 
281  /// Set the NodeDef element referenced by the Implementation.
282  void setNodeDef(ConstNodeDefPtr nodeDef);
283 
284  /// Return the NodeDef element referenced by the Implementation.
285  NodeDefPtr getNodeDef() const;
286 
287  /// @}
288  /// @name Validation
289  /// @{
290 
291  /// Validate that the given element tree, including all descendants, is
292  /// consistent with the MaterialX specification.
293  bool validate(string* message = nullptr) const override;
294 
295  /// @}
296  /// @name Utility
297  /// @{
298 
299  /// Return the first declaration of this interface, optionally filtered
300  /// by the given target name.
301  ConstInterfaceElementPtr getDeclaration(const string& target = EMPTY_STRING) const override;
302 
303  /// @}
304 
305  public:
306  static const string CATEGORY;
307  static const string FILE_ATTRIBUTE;
308  static const string FUNCTION_ATTRIBUTE;
309  static const string NODE_GRAPH_ATTRIBUTE;
310 };
311 
312 /// @class TypeDef
313 /// A type definition element within a Document.
315 {
316  public:
317  TypeDef(ElementPtr parent, const string& name) :
318  Element(parent, CATEGORY, name)
319  {
320  }
321  virtual ~TypeDef() { }
322 
323  /// @name Semantic
324  /// @{
325 
326  /// Set the semantic string of the TypeDef.
327  void setSemantic(const string& semantic)
328  {
329  setAttribute(SEMANTIC_ATTRIBUTE, semantic);
330  }
331 
332  /// Return true if the given TypeDef has a semantic string.
333  bool hasSemantic() const
334  {
335  return hasAttribute(SEMANTIC_ATTRIBUTE);
336  }
337 
338  /// Return the semantic string of the TypeDef.
339  const string& getSemantic() const
340  {
341  return getAttribute(SEMANTIC_ATTRIBUTE);
342  }
343 
344  /// @}
345  /// @name Context
346  /// @{
347 
348  /// Set the context string of the TypeDef.
349  void setContext(const string& context)
350  {
351  setAttribute(CONTEXT_ATTRIBUTE, context);
352  }
353 
354  /// Return true if the given TypeDef has a context string.
355  bool hasContext() const
356  {
357  return hasAttribute(CONTEXT_ATTRIBUTE);
358  }
359 
360  /// Return the context string of the TypeDef.
361  const string& getContext() const
362  {
363  return getAttribute(CONTEXT_ATTRIBUTE);
364  }
365 
366  /// @}
367  /// @name Member Elements
368  /// @{
369 
370  /// Add a Member to the TypeDef.
371  /// @param name The name of the new Member.
372  /// If no name is specified, then a unique name will automatically be
373  /// generated.
374  /// @return A shared pointer to the new Member.
376  {
377  return addChild<Member>(name);
378  }
379 
380  /// Return the Member, if any, with the given name.
381  MemberPtr getMember(const string& name) const
382  {
383  return getChildOfType<Member>(name);
384  }
385 
386  /// Return a vector of all Member elements in the TypeDef.
387  vector<MemberPtr> getMembers() const
388  {
389  return getChildrenOfType<Member>();
390  }
391 
392  /// Remove the Member, if any, with the given name.
393  void removeMember(const string& name)
394  {
395  removeChildOfType<Member>(name);
396  }
397 
398  /// @}
399 
400  public:
401  static const string CATEGORY;
402  static const string SEMANTIC_ATTRIBUTE;
403  static const string CONTEXT_ATTRIBUTE;
404 };
405 
406 /// @class TargetDef
407 /// A definition of an implementation target.
409 {
410  public:
411  TargetDef(ElementPtr parent, const string& name) :
412  TypedElement(parent, CATEGORY, name)
413  {
414  }
415  virtual ~TargetDef() { }
416 
417  /// Return a vector of target names that is matching this targetdef
418  /// either by itself of by its inheritance.
419  /// The vector is ordered by priority starting with this targetdef
420  /// itself and then upwards in the inheritance hierarchy.
421  StringVec getMatchingTargets() const;
422 
423  public:
424  static const string CATEGORY;
425 };
426 
427 /// @class Member
428 /// A member element within a TypeDef.
430 {
431  public:
432  Member(ElementPtr parent, const string& name) :
433  ValueElement(parent, CATEGORY, name)
434  {
435  }
436  virtual ~Member() { }
437 
438  public:
439  static const string CATEGORY;
440 };
441 
442 /// @class Unit
443 /// A unit declaration within a UnitDef.
444 class MX_CORE_API Unit : public Element
445 {
446  public:
447  Unit(ElementPtr parent, const string& name) :
448  Element(parent, CATEGORY, name)
449  {
450  }
451  virtual ~Unit() { }
452 
453  public:
454  static const string CATEGORY;
455 };
456 
457 /// @class UnitDef
458 /// A unit definition element within a Document.
460 {
461  public:
462  UnitDef(ElementPtr parent, const string& name) :
463  Element(parent, CATEGORY, name)
464  {
465  }
466  virtual ~UnitDef() { }
467 
468  /// @name Unit Type methods
469  /// @{
470 
471  /// Set the element's unittype string.
472  void setUnitType(const string& type)
473  {
474  setAttribute(UNITTYPE_ATTRIBUTE, type);
475  }
476 
477  /// Return true if the given element has a unittype string.
478  bool hasUnitType() const
479  {
480  return hasAttribute(UNITTYPE_ATTRIBUTE);
481  }
482 
483  /// Return the element's type string.
484  const string& getUnitType() const
485  {
486  return getAttribute(UNITTYPE_ATTRIBUTE);
487  }
488 
489  /// @}
490  /// @name Unit methods
491  /// @{
492 
493  /// Add a Unit to the UnitDef.
494  /// @param name The name of the new Unit. An exception is thrown
495  /// if the name provided is an empty string.
496  /// @return A shared pointer to the new Unit.
497  UnitPtr addUnit(const string& name)
498  {
499  if (name.empty())
500  {
501  throw Exception("A unit definition name cannot be empty");
502  }
503  return addChild<Unit>(name);
504  }
505 
506  /// Return the Unit, if any, with the given name.
507  UnitPtr getUnit(const string& name) const
508  {
509  return getChildOfType<Unit>(name);
510  }
511 
512  /// Return a vector of all Unit elements in the UnitDef.
513  vector<UnitPtr> getUnits() const
514  {
515  return getChildrenOfType<Unit>();
516  }
517 
518  /// Remove the Unit, if any, with the given name.
519  void removeUnit(const string& name)
520  {
521  removeChildOfType<Unit>(name);
522  }
523 
524  /// @}
525 
526  public:
527  static const string CATEGORY;
528  static const string UNITTYPE_ATTRIBUTE;
529 };
530 
531 /// @class UnitTypeDef
532 /// A unit type definition element within a Document.
534 {
535  public:
536  UnitTypeDef(ElementPtr parent, const string& name) :
537  Element(parent, CATEGORY, name)
538  {
539  }
540  virtual ~UnitTypeDef() { }
541 
542  /// Find all UnitDefs for the UnitTypeDef
543  vector<UnitDefPtr> getUnitDefs() const;
544 
545  public:
546  static const string CATEGORY;
547 };
548 
549 /// @class AttributeDef
550 /// An attribute definition element within a Document.
552 {
553  public:
554  AttributeDef(ElementPtr parent, const string& name) :
555  TypedElement(parent, CATEGORY, name)
556  {
557  }
558  virtual ~AttributeDef() { }
559 
560  /// @name Attribute name
561  /// @{
562 
563  /// Set the element's attrname string.
564  void setAttrName(const string& name)
565  {
566  setAttribute(ATTRNAME_ATTRIBUTE, name);
567  }
568 
569  /// Return true if this element has an attrname string.
570  bool hasAttrName() const
571  {
572  return hasAttribute(ATTRNAME_ATTRIBUTE);
573  }
574 
575  /// Return the element's attrname string.
576  const string& getAttrName() const
577  {
578  return getAttribute(ATTRNAME_ATTRIBUTE);
579  }
580 
581  /// @}
582  /// @name Value String
583  /// @{
584 
585  /// Set the value string of an element.
586  void setValueString(const string& value)
587  {
588  setAttribute(VALUE_ATTRIBUTE, value);
589  }
590 
591  /// Return true if the given element has a value string.
592  bool hasValueString() const
593  {
594  return hasAttribute(VALUE_ATTRIBUTE);
595  }
596 
597  /// Get the value string of a element.
598  const string& getValueString() const
599  {
600  return getAttribute(VALUE_ATTRIBUTE);
601  }
602 
603  /// @}
604  /// @name Typed Value
605  /// @{
606 
607  /// Set the typed value of an element.
608  template <class T> void setValue(const T& value, const string& type = EMPTY_STRING)
609  {
610  setType(!type.empty() ? type : getTypeString<T>());
611  setValueString(toValueString(value));
612  }
613 
614  /// Set the typed value of an element from a C-style string.
615  void setValue(const char* value, const string& type = EMPTY_STRING)
616  {
617  setValue(value ? string(value) : EMPTY_STRING, type);
618  }
619 
620  /// Return true if the element possesses a typed value.
621  bool hasValue() const
622  {
623  return hasAttribute(VALUE_ATTRIBUTE);
624  }
625 
626  /// Return the typed value of an element as a generic value object, which
627  /// may be queried to access its data.
628  ///
629  /// @return A shared pointer to the typed value of this element, or an
630  /// empty shared pointer if no value is present.
631  ValuePtr getValue() const;
632 
633  /// @}
634  /// @name Elements
635  /// @{
636 
637  /// Set the element's elements string.
638  void setElements(const string& elements)
639  {
640  setAttribute(ELEMENTS_ATTRIBUTE, elements);
641  }
642 
643  /// Return true if the element has an elements string.
644  bool hasElements() const
645  {
646  return hasAttribute(ELEMENTS_ATTRIBUTE);
647  }
648 
649  /// Return the element's elements string.
650  const string& getElements() const
651  {
652  return getAttribute(ELEMENTS_ATTRIBUTE);
653  }
654 
655  /// @}
656  /// @name Exportable
657  /// @{
658 
659  /// Set the exportable boolean for the element.
660  void setExportable(bool value)
661  {
662  setTypedAttribute<bool>(EXPORTABLE_ATTRIBUTE, value);
663  }
664 
665  /// Return the exportable boolean for the element.
666  /// Defaults to false if exportable is not set.
667  bool getExportable() const
668  {
669  return getTypedAttribute<bool>(EXPORTABLE_ATTRIBUTE);
670  }
671 
672  /// @}
673 
674  public:
675  static const string CATEGORY;
676  static const string ATTRNAME_ATTRIBUTE;
677  static const string VALUE_ATTRIBUTE;
678  static const string ELEMENTS_ATTRIBUTE;
679  static const string EXPORTABLE_ATTRIBUTE;
680 };
681 
683 
684 #endif
static const string CATEGORY
Definition: Definition.h:183
shared_ptr< const UnitDef > ConstUnitDefPtr
A shared pointer to a const UnitDef.
Definition: Definition.h:64
static const string SEMANTIC_ATTRIBUTE
Definition: Definition.h:402
shared_ptr< const TypeDef > ConstTypeDefPtr
A shared pointer to a const TypeDef.
Definition: Definition.h:44
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
static const string FUNCTION_ATTRIBUTE
Definition: Definition.h:308
shared_ptr< const Implementation > ConstImplementationPtr
A shared pointer to a const Implementation.
Definition: Definition.h:39
virtual const string & getType() const
Return the element's type string.
Definition: Element.h:896
void setType(const string &type)
Set the element's type string.
Definition: Element.h:884
bool hasFile() const
Return true if the given Implementation has a file string.
Definition: Definition.h:222
static const string VALUE_ATTRIBUTE
Definition: Definition.h:677
const string & getNodeGraph() const
Return the nodegraph string for the Implementation.
Definition: Definition.h:272
const string & getFunction() const
Return the function string for the Implementation.
Definition: Definition.h:250
shared_ptr< TypeDef > TypeDefPtr
A shared pointer to a TypeDef.
Definition: Definition.h:42
UnitDef(ElementPtr parent, const string &name)
Definition: Definition.h:462
shared_ptr< TargetDef > TargetDefPtr
A shared pointer to a TargetDef.
Definition: Definition.h:47
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< string > StringVec
A vector of strings.
Definition: Library.h:61
void setNodeGroup(const string &category)
Set the node group of the NodeDef.
Definition: Definition.h:119
void setUnitType(const string &type)
Set the element's unittype string.
Definition: Definition.h:472
shared_ptr< const InterfaceElement > ConstInterfaceElementPtr
A shared pointer to a const InterfaceElement.
Definition: Interface.h:43
GLsizei const GLfloat * value
Definition: glcorearb.h:824
virtual ~AttributeDef()
Definition: Definition.h:558
shared_ptr< AttributeDef > AttributeDefPtr
A shared pointer to an AttributeDef.
Definition: Definition.h:72
void setNodeString(const string &node)
Set the node string of the NodeDef.
Definition: Definition.h:94
static const string PROCEDURAL_NODE_GROUP
Definition: Definition.h:188
shared_ptr< Member > MemberPtr
A shared pointer to a Member.
Definition: Definition.h:52
static const string NODE_GROUP_ATTRIBUTE
Definition: Definition.h:185
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
static const string CATEGORY
Definition: Definition.h:454
const string & getAttribute(const string &attrib) const
Definition: Element.h:491
void setContext(const string &context)
Set the context string of the TypeDef.
Definition: Definition.h:349
TargetDef(ElementPtr parent, const string &name)
Definition: Definition.h:411
shared_ptr< InterfaceElement > InterfaceElementPtr
A shared pointer to an InterfaceElement.
Definition: Interface.h:41
NodeDef(ElementPtr parent, const string &name)
Definition: Definition.h:84
virtual ~TargetDef()
Definition: Definition.h:415
class OCIOEXPORT Exception
#define MX_CORE_API
Definition: Export.h:18
void setFunction(const string &function)
Set the function string for the Implementation.
Definition: Definition.h:238
void setNodeGraph(const string &nodegraph)
Set the nodegraph string for the Implementation.
Definition: Definition.h:260
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:5578
shared_ptr< UnitTypeDef > UnitTypeDefPtr
A shared pointer to a UnitTypeDef.
Definition: Definition.h:67
virtual ~TypeDef()
Definition: Definition.h:321
MemberPtr getMember(const string &name) const
Return the Member, if any, with the given name.
Definition: Definition.h:381
bool hasValueString() const
Return true if the given element has a value string.
Definition: Definition.h:592
shared_ptr< const Member > ConstMemberPtr
A shared pointer to a const Member.
Definition: Definition.h:54
AttributeDef(ElementPtr parent, const string &name)
Definition: Definition.h:554
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string COLOR_SEMANTIC
const string & getAttrName() const
Return the element's attrname string.
Definition: Definition.h:576
MemberPtr addMember(const string &name=EMPTY_STRING)
Definition: Definition.h:375
virtual ~Member()
Definition: Definition.h:436
void removeMember(const string &name)
Remove the Member, if any, with the given name.
Definition: Definition.h:393
void setValueString(const string &value)
Set the value string of an element.
Definition: Definition.h:586
static const string GEOMETRIC_NODE_GROUP
Definition: Definition.h:189
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
void setValue(const char *value, const string &type=EMPTY_STRING)
Set the typed value of an element from a C-style string.
Definition: Definition.h:615
void setSemantic(const string &semantic)
Set the semantic string of the TypeDef.
Definition: Definition.h:327
void setValue(const T &value, const string &type=EMPTY_STRING)
Set the typed value of an element.
Definition: Definition.h:608
static const string FILE_ATTRIBUTE
Definition: Definition.h:307
virtual bool validate(string *message=nullptr) const
vector< UnitPtr > getUnits() const
Return a vector of all Unit elements in the UnitDef.
Definition: Definition.h:513
static const string CONTEXT_ATTRIBUTE
Definition: Definition.h:403
virtual ~UnitDef()
Definition: Definition.h:466
bool hasFunction() const
Return true if the given Implementation has a function string.
Definition: Definition.h:244
bool hasNodeGroup() const
Return true if the given NodeDef has a node group.
Definition: Definition.h:125
shared_ptr< Implementation > ImplementationPtr
A shared pointer to an Implementation.
Definition: Definition.h:37
shared_ptr< const UnitTypeDef > ConstUnitTypeDefPtr
A shared pointer to a const UnitTypeDef.
Definition: Definition.h:69
static const string ADJUSTMENT_NODE_GROUP
Definition: Definition.h:190
static const string NODE_GRAPH_ATTRIBUTE
Definition: Interface.h:164
static const string CATEGORY
Definition: Definition.h:401
bool hasUnitType() const
Return true if the given element has a unittype string.
Definition: Definition.h:478
GLenum target
Definition: glcorearb.h:1667
shared_ptr< const Unit > ConstUnitPtr
A shared pointer to a const Unit.
Definition: Definition.h:59
shared_ptr< UnitDef > UnitDefPtr
A shared pointer to a UnitDef.
Definition: Definition.h:62
static const string CATEGORY
Definition: Definition.h:527
static const string EXPORTABLE_ATTRIBUTE
Definition: Definition.h:679
static const string TRANSLATION_NODE_GROUP
Definition: Definition.h:194
vector< MemberPtr > getMembers() const
Return a vector of all Member elements in the TypeDef.
Definition: Definition.h:387
GLuint const GLchar * name
Definition: glcorearb.h:786
const string & getElements() const
Return the element's elements string.
Definition: Definition.h:650
bool hasNodeString() const
Return true if the given NodeDef has a node string.
Definition: Definition.h:100
static const string UNITTYPE_ATTRIBUTE
Definition: Definition.h:528
MX_CORE_API const string SHADER_SEMANTIC
GT_API const UT_StringHolder version
static const string NODE_ATTRIBUTE
Definition: Definition.h:184
virtual ~NodeDef()
Definition: Definition.h:88
bool hasContext() const
Return true if the given TypeDef has a context string.
Definition: Definition.h:355
void setAttribute(const string &attrib, const string &value)
Set the value string of the given attribute.
shared_ptr< const AttributeDef > AttributeDefDefPtr
A shared pointer to a const AttributeDef.
Definition: Definition.h:74
const string & getContext() const
Return the context string of the TypeDef.
Definition: Definition.h:361
static const string CATEGORY
Definition: Definition.h:439
void setElements(const string &elements)
Set the element's elements string.
Definition: Definition.h:638
bool hasNodeGraph() const
Return true if the given Implementation has a nodegraph string.
Definition: Definition.h:266
const string & getNodeString() const
Return the node string of the NodeDef.
Definition: Definition.h:106
static const string CONDITIONAL_NODE_GROUP
Definition: Definition.h:191
shared_ptr< Unit > UnitPtr
A shared pointer to a Unit.
Definition: Definition.h:57
bool hasAttribute(const string &attrib) const
Return true if the given attribute is present.
Definition: Element.h:484
bool getExportable() const
Definition: Definition.h:667
static const string NODE_GRAPH_ATTRIBUTE
Definition: Definition.h:309
virtual ~Unit()
Definition: Definition.h:451
bool hasAttrName() const
Return true if this element has an attrname string.
Definition: Definition.h:570
shared_ptr< const TargetDef > ConstTargetDefPtr
A shared pointer to a const TargetDef.
Definition: Definition.h:49
bool hasSemantic() const
Return true if the given TypeDef has a semantic string.
Definition: Definition.h:333
virtual ~Implementation()
Definition: Definition.h:210
const string & getFile() const
Return the file string for the Implementation.
Definition: Definition.h:228
virtual ConstInterfaceElementPtr getDeclaration(const string &target=EMPTY_STRING) const
const string & getUnitType() const
Return the element's type string.
Definition: Definition.h:484
static const string ORGANIZATION_NODE_GROUP
Definition: Definition.h:193
static const string ATTRNAME_ATTRIBUTE
Definition: Definition.h:676
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:63
const string & getSemantic() const
Return the semantic string of the TypeDef.
Definition: Definition.h:339
bool hasValue() const
Return true if the element possesses a typed value.
Definition: Definition.h:621
virtual ~UnitTypeDef()
Definition: Definition.h:540
Unit(ElementPtr parent, const string &name)
Definition: Definition.h:447
static const string CATEGORY
Definition: Definition.h:675
Member(ElementPtr parent, const string &name)
Definition: Definition.h:432
UnitTypeDef(ElementPtr parent, const string &name)
Definition: Definition.h:536
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
const string & getNodeGroup() const
Return the node group of the NodeDef.
Definition: Definition.h:131
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
TypeDef(ElementPtr parent, const string &name)
Definition: Definition.h:317
shared_ptr< const NodeDef > ConstNodeDefPtr
A shared pointer to a const NodeDef.
Definition: Definition.h:34
void setAttrName(const string &name)
Set the element's attrname string.
Definition: Definition.h:564
static const string CHANNEL_NODE_GROUP
Definition: Definition.h:192
Implementation(ElementPtr parent, const string &name)
Definition: Definition.h:206
void setExportable(bool value)
Set the exportable boolean for the element.
Definition: Definition.h:660
static const string CATEGORY
Definition: Definition.h:424
bool hasElements() const
Return true if the element has an elements string.
Definition: Definition.h:644
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:30
void setFile(const string &file)
Set the file string for the Implementation.
Definition: Definition.h:216
static const string ELEMENTS_ATTRIBUTE
Definition: Definition.h:678
void removeUnit(const string &name)
Remove the Unit, if any, with the given name.
Definition: Definition.h:519
UnitPtr addUnit(const string &name)
Definition: Definition.h:497
static const string CATEGORY
Definition: Definition.h:306
MX_CORE_API string toValueString(const T &data)
Convert the given data value to a value string.
const string & getValueString() const
Get the value string of a element.
Definition: Definition.h:598
static const string CATEGORY
Definition: Definition.h:546
UnitPtr getUnit(const string &name) const
Return the Unit, if any, with the given name.
Definition: Definition.h:507
static const string TEXTURE_NODE_GROUP
Definition: Definition.h:187
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.
Definition: Definition.h:32