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.
142  /// @param target An optional target name, which will be used to filter
143  /// the implementations that are considered.
144  /// @return An implementation for this nodedef, or an empty shared pointer
145  /// if none was found. Note that a node implementation may be either
146  /// an Implementation element or a NodeGraph element.
147  InterfaceElementPtr getImplementation(const string& target = EMPTY_STRING) const;
148 
149  /// @}
150  /// @name Validation
151  /// @{
152 
153  /// Validate that the given element tree, including all descendants, is
154  /// consistent with the MaterialX specification.
155  bool validate(string* message = nullptr) const override;
156 
157  /// @}
158  /// @name Utility
159  /// @{
160 
161  /// Return true if the given version string is compatible with this
162  /// NodeDef. This may be used to test, for example, whether a NodeDef
163  /// and Node may be used together.
164  bool isVersionCompatible(const string& version) const;
165 
166  /// Return the first declaration of this interface, optionally filtered
167  /// by the given target name.
168  ConstInterfaceElementPtr getDeclaration(const string& target = EMPTY_STRING) const override;
169 
170  /// @}
171 
172  public:
173  static const string CATEGORY;
174  static const string NODE_ATTRIBUTE;
175  static const string NODE_GROUP_ATTRIBUTE;
176 
177  static const string TEXTURE_NODE_GROUP;
178  static const string PROCEDURAL_NODE_GROUP;
179  static const string GEOMETRIC_NODE_GROUP;
180  static const string ADJUSTMENT_NODE_GROUP;
181  static const string CONDITIONAL_NODE_GROUP;
182  static const string ORGANIZATION_NODE_GROUP;
183  static const string TRANSLATION_NODE_GROUP;
184 };
185 
186 /// @class Implementation
187 /// An implementation element within a Document.
188 ///
189 /// An Implementation is used to associate external source code with a specific
190 /// NodeDef, providing a definition for the node that may either be universal or
191 /// restricted to a specific target.
193 {
194  public:
195  Implementation(ElementPtr parent, const string& name) :
196  InterfaceElement(parent, CATEGORY, name)
197  {
198  }
199  virtual ~Implementation() { }
200 
201  /// @name File String
202  /// @{
203 
204  /// Set the file string for the Implementation.
205  void setFile(const string& file)
206  {
207  setAttribute(FILE_ATTRIBUTE, file);
208  }
209 
210  /// Return true if the given Implementation has a file string.
211  bool hasFile() const
212  {
213  return hasAttribute(FILE_ATTRIBUTE);
214  }
215 
216  /// Return the file string for the Implementation.
217  const string& getFile() const
218  {
219  return getAttribute(FILE_ATTRIBUTE);
220  }
221 
222  /// @}
223  /// @name Function String
224  /// @{
225 
226  /// Set the function string for the Implementation.
227  void setFunction(const string& function)
228  {
229  setAttribute(FUNCTION_ATTRIBUTE, function);
230  }
231 
232  /// Return true if the given Implementation has a function string.
233  bool hasFunction() const
234  {
235  return hasAttribute(FUNCTION_ATTRIBUTE);
236  }
237 
238  /// Return the function string for the Implementation.
239  const string& getFunction() const
240  {
241  return getAttribute(FUNCTION_ATTRIBUTE);
242  }
243 
244  /// @}
245  /// @name Nodegraph String
246  /// @{
247 
248  /// Set the nodegraph string for the Implementation.
249  void setNodeGraph(const string& nodegraph)
250  {
251  setAttribute(NODE_GRAPH_ATTRIBUTE, nodegraph);
252  }
253 
254  /// Return true if the given Implementation has a nodegraph string.
255  bool hasNodeGraph() const
256  {
257  return hasAttribute(NODE_GRAPH_ATTRIBUTE);
258  }
259 
260  /// Return the nodegraph string for the Implementation.
261  const string& getNodeGraph() const
262  {
264  }
265 
266  /// @}
267  /// @name NodeDef References
268  /// @{
269 
270  /// Set the NodeDef element referenced by the Implementation.
271  void setNodeDef(ConstNodeDefPtr nodeDef);
272 
273  /// Return the NodeDef element referenced by the Implementation.
274  NodeDefPtr getNodeDef() const;
275 
276  /// @}
277  /// @name Validation
278  /// @{
279 
280  /// Validate that the given element tree, including all descendants, is
281  /// consistent with the MaterialX specification.
282  bool validate(string* message = nullptr) const override;
283 
284  /// @}
285  /// @name Utility
286  /// @{
287 
288  /// Return the first declaration of this interface, optionally filtered
289  /// by the given target name.
290  ConstInterfaceElementPtr getDeclaration(const string& target = EMPTY_STRING) const override;
291 
292  /// @}
293 
294  public:
295  static const string CATEGORY;
296  static const string FILE_ATTRIBUTE;
297  static const string FUNCTION_ATTRIBUTE;
298  static const string NODE_GRAPH_ATTRIBUTE;
299 };
300 
301 /// @class TypeDef
302 /// A type definition element within a Document.
304 {
305  public:
306  TypeDef(ElementPtr parent, const string& name) :
307  Element(parent, CATEGORY, name)
308  {
309  }
310  virtual ~TypeDef() { }
311 
312  /// @name Semantic
313  /// @{
314 
315  /// Set the semantic string of the TypeDef.
316  void setSemantic(const string& semantic)
317  {
318  setAttribute(SEMANTIC_ATTRIBUTE, semantic);
319  }
320 
321  /// Return true if the given TypeDef has a semantic string.
322  bool hasSemantic() const
323  {
324  return hasAttribute(SEMANTIC_ATTRIBUTE);
325  }
326 
327  /// Return the semantic string of the TypeDef.
328  const string& getSemantic() const
329  {
330  return getAttribute(SEMANTIC_ATTRIBUTE);
331  }
332 
333  /// @}
334  /// @name Context
335  /// @{
336 
337  /// Set the context string of the TypeDef.
338  void setContext(const string& context)
339  {
340  setAttribute(CONTEXT_ATTRIBUTE, context);
341  }
342 
343  /// Return true if the given TypeDef has a context string.
344  bool hasContext() const
345  {
346  return hasAttribute(CONTEXT_ATTRIBUTE);
347  }
348 
349  /// Return the context string of the TypeDef.
350  const string& getContext() const
351  {
352  return getAttribute(CONTEXT_ATTRIBUTE);
353  }
354 
355  /// @}
356  /// @name Member Elements
357  /// @{
358 
359  /// Add a Member to the TypeDef.
360  /// @param name The name of the new Member.
361  /// If no name is specified, then a unique name will automatically be
362  /// generated.
363  /// @return A shared pointer to the new Member.
365  {
366  return addChild<Member>(name);
367  }
368 
369  /// Return the Member, if any, with the given name.
370  MemberPtr getMember(const string& name) const
371  {
372  return getChildOfType<Member>(name);
373  }
374 
375  /// Return a vector of all Member elements in the TypeDef.
376  vector<MemberPtr> getMembers() const
377  {
378  return getChildrenOfType<Member>();
379  }
380 
381  /// Remove the Member, if any, with the given name.
382  void removeMember(const string& name)
383  {
384  removeChildOfType<Member>(name);
385  }
386 
387  /// @}
388 
389  public:
390  static const string CATEGORY;
391  static const string SEMANTIC_ATTRIBUTE;
392  static const string CONTEXT_ATTRIBUTE;
393 };
394 
395 /// @class TargetDef
396 /// A definition of an implementation target.
398 {
399  public:
400  TargetDef(ElementPtr parent, const string& name) :
401  TypedElement(parent, CATEGORY, name)
402  {
403  }
404  virtual ~TargetDef() { }
405 
406  /// Return a vector of target names that is matching this targetdef
407  /// either by itself of by its inheritance.
408  /// The vector is ordered by priority starting with this targetdef
409  /// itself and then upwards in the inheritance hierarchy.
410  StringVec getMatchingTargets() const;
411 
412  public:
413  static const string CATEGORY;
414 };
415 
416 /// @class Member
417 /// A member element within a TypeDef.
419 {
420  public:
421  Member(ElementPtr parent, const string& name) :
422  TypedElement(parent, CATEGORY, name)
423  {
424  }
425  virtual ~Member() { }
426 
427  public:
428  static const string CATEGORY;
429 };
430 
431 /// @class Unit
432 /// A unit declaration within a UnitDef.
433 class MX_CORE_API Unit : public Element
434 {
435  public:
436  Unit(ElementPtr parent, const string& name) :
437  Element(parent, CATEGORY, name)
438  {
439  }
440  virtual ~Unit() { }
441 
442  public:
443  static const string CATEGORY;
444 };
445 
446 /// @class UnitDef
447 /// A unit definition element within a Document.
449 {
450  public:
451  UnitDef(ElementPtr parent, const string& name) :
452  Element(parent, CATEGORY, name)
453  {
454  }
455  virtual ~UnitDef() { }
456 
457  /// @name Unit Type methods
458  /// @{
459 
460  /// Set the element's unittype string.
461  void setUnitType(const string& type)
462  {
463  setAttribute(UNITTYPE_ATTRIBUTE, type);
464  }
465 
466  /// Return true if the given element has a unittype string.
467  bool hasUnitType() const
468  {
469  return hasAttribute(UNITTYPE_ATTRIBUTE);
470  }
471 
472  /// Return the element's type string.
473  const string& getUnitType() const
474  {
475  return getAttribute(UNITTYPE_ATTRIBUTE);
476  }
477 
478  /// @}
479  /// @name Unit methods
480  /// @{
481 
482  /// Add a Unit to the UnitDef.
483  /// @param name The name of the new Unit. An exception is thrown
484  /// if the name provided is an empty string.
485  /// @return A shared pointer to the new Unit.
486  UnitPtr addUnit(const string& name)
487  {
488  if (name.empty())
489  {
490  throw Exception("A unit definition name cannot be empty");
491  }
492  return addChild<Unit>(name);
493  }
494 
495  /// Return the Unit, if any, with the given name.
496  UnitPtr getUnit(const string& name) const
497  {
498  return getChildOfType<Unit>(name);
499  }
500 
501  /// Return a vector of all Unit elements in the UnitDef.
502  vector<UnitPtr> getUnits() const
503  {
504  return getChildrenOfType<Unit>();
505  }
506 
507  /// Remove the Unit, if any, with the given name.
508  void removeUnit(const string& name)
509  {
510  removeChildOfType<Unit>(name);
511  }
512 
513  /// @}
514 
515  public:
516  static const string CATEGORY;
517  static const string UNITTYPE_ATTRIBUTE;
518 };
519 
520 /// @class UnitTypeDef
521 /// A unit type definition element within a Document.
523 {
524  public:
525  UnitTypeDef(ElementPtr parent, const string& name) :
526  Element(parent, CATEGORY, name)
527  {
528  }
529  virtual ~UnitTypeDef() { }
530 
531  /// Find all UnitDefs for the UnitTypeDef
532  vector<UnitDefPtr> getUnitDefs() const;
533 
534  public:
535  static const string CATEGORY;
536 };
537 
538 /// @class AttributeDef
539 /// An attribute definition element within a Document.
541 {
542  public:
543  AttributeDef(ElementPtr parent, const string& name) :
544  TypedElement(parent, CATEGORY, name)
545  {
546  }
547  virtual ~AttributeDef() { }
548 
549  /// @name Attribute name
550  /// @{
551 
552  /// Set the element's attrname string.
553  void setAttrName(const string& name)
554  {
555  setAttribute(ATTRNAME_ATTRIBUTE, name);
556  }
557 
558  /// Return true if this element has an attrname string.
559  bool hasAttrName() const
560  {
561  return hasAttribute(ATTRNAME_ATTRIBUTE);
562  }
563 
564  /// Return the element's attrname string.
565  const string& getAttrName() const
566  {
567  return getAttribute(ATTRNAME_ATTRIBUTE);
568  }
569 
570  /// @}
571  /// @name Value String
572  /// @{
573 
574  /// Set the value string of an element.
575  void setValueString(const string& value)
576  {
577  setAttribute(VALUE_ATTRIBUTE, value);
578  }
579 
580  /// Return true if the given element has a value string.
581  bool hasValueString() const
582  {
583  return hasAttribute(VALUE_ATTRIBUTE);
584  }
585 
586  /// Get the value string of a element.
587  const string& getValueString() const
588  {
589  return getAttribute(VALUE_ATTRIBUTE);
590  }
591 
592  /// @}
593  /// @name Typed Value
594  /// @{
595 
596  /// Set the typed value of an element.
597  template <class T> void setValue(const T& value, const string& type = EMPTY_STRING)
598  {
599  setType(!type.empty() ? type : getTypeString<T>());
600  setValueString(toValueString(value));
601  }
602 
603  /// Set the typed value of an element from a C-style string.
604  void setValue(const char* value, const string& type = EMPTY_STRING)
605  {
606  setValue(value ? string(value) : EMPTY_STRING, type);
607  }
608 
609  /// Return true if the element possesses a typed value.
610  bool hasValue() const
611  {
612  return hasAttribute(VALUE_ATTRIBUTE);
613  }
614 
615  /// Return the typed value of an element as a generic value object, which
616  /// may be queried to access its data.
617  ///
618  /// @return A shared pointer to the typed value of this element, or an
619  /// empty shared pointer if no value is present.
621  {
622  if (!hasValue())
623  return ValuePtr();
624  return Value::createValueFromStrings(getValueString(), getType());
625  }
626 
627  /// @}
628  /// @name Elements
629  /// @{
630 
631  /// Set the element's elements string.
632  void setElements(const string& elements)
633  {
634  setAttribute(ELEMENTS_ATTRIBUTE, elements);
635  }
636 
637  /// Return true if the element has an elements string.
638  bool hasElements() const
639  {
640  return hasAttribute(ELEMENTS_ATTRIBUTE);
641  }
642 
643  /// Return the element's elements string.
644  const string& getElements() const
645  {
646  return getAttribute(ELEMENTS_ATTRIBUTE);
647  }
648 
649  /// @}
650  /// @name Exportable
651  /// @{
652 
653  /// Set the exportable boolean for the element.
654  void setExportable(bool value)
655  {
656  setTypedAttribute<bool>(EXPORTABLE_ATTRIBUTE, value);
657  }
658 
659  /// Return the exportable boolean for the element.
660  /// Defaults to false if exportable is not set.
661  bool getExportable() const
662  {
663  return getTypedAttribute<bool>(EXPORTABLE_ATTRIBUTE);
664  }
665 
666  /// @}
667 
668  public:
669  static const string CATEGORY;
670  static const string ATTRNAME_ATTRIBUTE;
671  static const string VALUE_ATTRIBUTE;
672  static const string ELEMENTS_ATTRIBUTE;
673  static const string EXPORTABLE_ATTRIBUTE;
674 };
675 
677 
678 #endif
static const string CATEGORY
Definition: Definition.h:173
shared_ptr< const UnitDef > ConstUnitDefPtr
A shared pointer to a const UnitDef.
Definition: Definition.h:64
static const string SEMANTIC_ATTRIBUTE
Definition: Definition.h:391
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:297
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:867
void setType(const string &type)
Set the element's type string.
Definition: Element.h:855
bool hasFile() const
Return true if the given Implementation has a file string.
Definition: Definition.h:211
static const string VALUE_ATTRIBUTE
Definition: Definition.h:671
const string & getNodeGraph() const
Return the nodegraph string for the Implementation.
Definition: Definition.h:261
const string & getFunction() const
Return the function string for the Implementation.
Definition: Definition.h:239
shared_ptr< TypeDef > TypeDefPtr
A shared pointer to a TypeDef.
Definition: Definition.h:42
UnitDef(ElementPtr parent, const string &name)
Definition: Definition.h:451
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:57
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:461
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:547
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:178
shared_ptr< Member > MemberPtr
A shared pointer to a Member.
Definition: Definition.h:52
static const string NODE_GROUP_ATTRIBUTE
Definition: Definition.h:175
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
static const string CATEGORY
Definition: Definition.h:443
const string & getAttribute(const string &attrib) const
Definition: Element.h:504
void setContext(const string &context)
Set the context string of the TypeDef.
Definition: Definition.h:338
TargetDef(ElementPtr parent, const string &name)
Definition: Definition.h:400
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:404
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:227
void setNodeGraph(const string &nodegraph)
Set the nodegraph string for the Implementation.
Definition: Definition.h:249
shared_ptr< UnitTypeDef > UnitTypeDefPtr
A shared pointer to a UnitTypeDef.
Definition: Definition.h:67
virtual ~TypeDef()
Definition: Definition.h:310
MemberPtr getMember(const string &name) const
Return the Member, if any, with the given name.
Definition: Definition.h:370
bool hasValueString() const
Return true if the given element has a value string.
Definition: Definition.h:581
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:543
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string COLOR_SEMANTIC
const string & getAttrName() const
Return the element's attrname string.
Definition: Definition.h:565
MemberPtr addMember(const string &name=EMPTY_STRING)
Definition: Definition.h:364
virtual ~Member()
Definition: Definition.h:425
void removeMember(const string &name)
Remove the Member, if any, with the given name.
Definition: Definition.h:382
void setValueString(const string &value)
Set the value string of an element.
Definition: Definition.h:575
static const string GEOMETRIC_NODE_GROUP
Definition: Definition.h:179
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:604
void setSemantic(const string &semantic)
Set the semantic string of the TypeDef.
Definition: Definition.h:316
void setValue(const T &value, const string &type=EMPTY_STRING)
Set the typed value of an element.
Definition: Definition.h:597
static const string FILE_ATTRIBUTE
Definition: Definition.h:296
virtual bool validate(string *message=nullptr) const
vector< UnitPtr > getUnits() const
Return a vector of all Unit elements in the UnitDef.
Definition: Definition.h:502
static const string CONTEXT_ATTRIBUTE
Definition: Definition.h:392
virtual ~UnitDef()
Definition: Definition.h:455
bool hasFunction() const
Return true if the given Implementation has a function string.
Definition: Definition.h:233
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:180
static const string NODE_GRAPH_ATTRIBUTE
Definition: Interface.h:195
static const string CATEGORY
Definition: Definition.h:390
bool hasUnitType() const
Return true if the given element has a unittype string.
Definition: Definition.h:467
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:516
static const string EXPORTABLE_ATTRIBUTE
Definition: Definition.h:673
static const string TRANSLATION_NODE_GROUP
Definition: Definition.h:183
vector< MemberPtr > getMembers() const
Return a vector of all Member elements in the TypeDef.
Definition: Definition.h:376
GLuint const GLchar * name
Definition: glcorearb.h:786
const string & getElements() const
Return the element's elements string.
Definition: Definition.h:644
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:517
MX_CORE_API const string SHADER_SEMANTIC
static ValuePtr createValueFromStrings(const string &value, const string &type)
GT_API const UT_StringHolder version
ValuePtr getValue() const
Definition: Definition.h:620
static const string NODE_ATTRIBUTE
Definition: Definition.h:174
virtual ~NodeDef()
Definition: Definition.h:88
bool hasContext() const
Return true if the given TypeDef has a context string.
Definition: Definition.h:344
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:350
static const string CATEGORY
Definition: Definition.h:428
void setElements(const string &elements)
Set the element's elements string.
Definition: Definition.h:632
bool hasNodeGraph() const
Return true if the given Implementation has a nodegraph string.
Definition: Definition.h:255
const string & getNodeString() const
Return the node string of the NodeDef.
Definition: Definition.h:106
static const string CONDITIONAL_NODE_GROUP
Definition: Definition.h:181
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:497
bool getExportable() const
Definition: Definition.h:661
static const string NODE_GRAPH_ATTRIBUTE
Definition: Definition.h:298
virtual ~Unit()
Definition: Definition.h:440
bool hasAttrName() const
Return true if this element has an attrname string.
Definition: Definition.h:559
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:322
virtual ~Implementation()
Definition: Definition.h:199
const string & getFile() const
Return the file string for the Implementation.
Definition: Definition.h:217
virtual ConstInterfaceElementPtr getDeclaration(const string &target=EMPTY_STRING) const
const string & getUnitType() const
Return the element's type string.
Definition: Definition.h:473
static const string ORGANIZATION_NODE_GROUP
Definition: Definition.h:182
static const string ATTRNAME_ATTRIBUTE
Definition: Definition.h:670
const string & getSemantic() const
Return the semantic string of the TypeDef.
Definition: Definition.h:328
bool hasValue() const
Return true if the element possesses a typed value.
Definition: Definition.h:610
virtual ~UnitTypeDef()
Definition: Definition.h:529
Unit(ElementPtr parent, const string &name)
Definition: Definition.h:436
static const string CATEGORY
Definition: Definition.h:669
Member(ElementPtr parent, const string &name)
Definition: Definition.h:421
UnitTypeDef(ElementPtr parent, const string &name)
Definition: Definition.h:525
Definition: core.h:1131
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:306
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:553
Implementation(ElementPtr parent, const string &name)
Definition: Definition.h:195
void setExportable(bool value)
Set the exportable boolean for the element.
Definition: Definition.h:654
static const string CATEGORY
Definition: Definition.h:413
bool hasElements() const
Return true if the element has an elements string.
Definition: Definition.h:638
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:29
type
Definition: core.h:1059
void setFile(const string &file)
Set the file string for the Implementation.
Definition: Definition.h:205
static const string ELEMENTS_ATTRIBUTE
Definition: Definition.h:672
void removeUnit(const string &name)
Remove the Unit, if any, with the given name.
Definition: Definition.h:508
UnitPtr addUnit(const string &name)
Definition: Definition.h:486
static const string CATEGORY
Definition: Definition.h:295
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:587
static const string CATEGORY
Definition: Definition.h:535
UnitPtr getUnit(const string &name) const
Return the Unit, if any, with the given name.
Definition: Definition.h:496
static const string TEXTURE_NODE_GROUP
Definition: Definition.h:177
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.
Definition: Definition.h:32