domController.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * Copyright 2006 Sony Computer Entertainment Inc.
  3. *
  4. * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
  5. * file except in compliance with the License. You may obtain a copy of the License at:
  6. * http://research.scea.com/scea_shared_source_license.html
  7. *
  8. * Unless required by applicable law or agreed to in writing, software distributed under the License
  9. * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied. See the License for the specific language governing permissions and limitations under the
  11. * License.
  12. */
  13. #ifndef __domController_h__
  14. #define __domController_h__
  15. #include <dae/daeDocument.h>
  16. #include <dom/domTypes.h>
  17. #include <dom/domElements.h>
  18. #include <dom/domAsset.h>
  19. #include <dom/domSkin.h>
  20. #include <dom/domMorph.h>
  21. #include <dom/domExtra.h>
  22. class DAE;
  23. /**
  24. * The controller element categorizes the declaration of generic control information.
  25. * A controller is a device or mechanism that manages and directs the operations
  26. * of another object.
  27. */
  28. class domController : public daeElement
  29. {
  30. public:
  31. virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::CONTROLLER; }
  32. static daeInt ID() { return 655; }
  33. virtual daeInt typeID() const { return ID(); }
  34. protected: // Attributes
  35. /**
  36. * The id attribute is a text string containing the unique identifier of
  37. * this element. This value must be unique within the instance document.
  38. * Optional attribute.
  39. */
  40. xsID attrId;
  41. /**
  42. * The name attribute is the text string name of this element. Optional attribute.
  43. */
  44. xsNCName attrName;
  45. protected: // Elements
  46. /**
  47. * The controller element may contain an asset element. @see domAsset
  48. */
  49. domAssetRef elemAsset;
  50. /**
  51. * The controller element may contain either a skin element or a morph element.
  52. * @see domSkin
  53. */
  54. domSkinRef elemSkin;
  55. /**
  56. * The controller element may contain either a skin element or a morph element.
  57. * @see domMorph
  58. */
  59. domMorphRef elemMorph;
  60. /**
  61. * The extra element may appear any number of times. @see domExtra
  62. */
  63. domExtra_Array elemExtra_array;
  64. /**
  65. * Used to preserve order in elements that do not specify strict sequencing of sub-elements.
  66. */
  67. daeElementRefArray _contents;
  68. /**
  69. * Used to preserve order in elements that have a complex content model.
  70. */
  71. daeUIntArray _contentsOrder;
  72. /**
  73. * Used to store information needed for some content model objects.
  74. */
  75. daeTArray< daeCharArray * > _CMData;
  76. public: //Accessors and Mutators
  77. /**
  78. * Gets the id attribute.
  79. * @return Returns a xsID of the id attribute.
  80. */
  81. xsID getId() const { return attrId; }
  82. /**
  83. * Sets the id attribute.
  84. * @param atId The new value for the id attribute.
  85. */
  86. void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
  87. if( _document != NULL ) _document->changeElementID( this, attrId );
  88. }
  89. /**
  90. * Gets the name attribute.
  91. * @return Returns a xsNCName of the name attribute.
  92. */
  93. xsNCName getName() const { return attrName; }
  94. /**
  95. * Sets the name attribute.
  96. * @param atName The new value for the name attribute.
  97. */
  98. void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
  99. /**
  100. * Gets the asset element.
  101. * @return a daeSmartRef to the asset element.
  102. */
  103. const domAssetRef getAsset() const { return elemAsset; }
  104. /**
  105. * Gets the skin element.
  106. * @return a daeSmartRef to the skin element.
  107. */
  108. const domSkinRef getSkin() const { return elemSkin; }
  109. /**
  110. * Gets the morph element.
  111. * @return a daeSmartRef to the morph element.
  112. */
  113. const domMorphRef getMorph() const { return elemMorph; }
  114. /**
  115. * Gets the extra element array.
  116. * @return Returns a reference to the array of extra elements.
  117. */
  118. domExtra_Array &getExtra_array() { return elemExtra_array; }
  119. /**
  120. * Gets the extra element array.
  121. * @return Returns a constant reference to the array of extra elements.
  122. */
  123. const domExtra_Array &getExtra_array() const { return elemExtra_array; }
  124. /**
  125. * Gets the _contents array.
  126. * @return Returns a reference to the _contents element array.
  127. */
  128. daeElementRefArray &getContents() { return _contents; }
  129. /**
  130. * Gets the _contents array.
  131. * @return Returns a constant reference to the _contents element array.
  132. */
  133. const daeElementRefArray &getContents() const { return _contents; }
  134. protected:
  135. /**
  136. * Constructor
  137. */
  138. domController(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemSkin(), elemMorph(), elemExtra_array() {}
  139. /**
  140. * Destructor
  141. */
  142. virtual ~domController() { daeElement::deleteCMDataArray(_CMData); }
  143. /**
  144. * Overloaded assignment operator
  145. */
  146. virtual domController &operator=( const domController &cpy ) { (void)cpy; return *this; }
  147. public: // STATIC METHODS
  148. /**
  149. * Creates an instance of this class and returns a daeElementRef referencing it.
  150. * @return a daeElementRef referencing an instance of this object.
  151. */
  152. static DLLSPEC daeElementRef create(DAE& dae);
  153. /**
  154. * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
  155. * If a daeMetaElement already exists it will return that instead of creating a new one.
  156. * @return A daeMetaElement describing this COLLADA element.
  157. */
  158. static DLLSPEC daeMetaElement* registerElement(DAE& dae);
  159. };
  160. #endif