1 /* 2 * Copyright 2006 Sony Computer Entertainment Inc. 3 * 4 * Licensed under the MIT Open Source License, for details please see license.txt or the website 5 * http://www.opensource.org/licenses/mit-license.php 6 * 7 */ 8 9 #ifndef __domGlsl_newarray_type_h__ 10 #define __domGlsl_newarray_type_h__ 11 12 #include <dae/daeDocument.h> 13 #include <dom/domTypes.h> 14 #include <dom/domElements.h> 15 16 #include <dom/domGlsl_param_type.h> 17 #include <dom/domGlsl_newarray_type.h> 18 class DAE; 19 20 /** 21 * The glsl_newarray_type is used to creates a parameter of a one-dimensional 22 * array type. 23 */ 24 class domGlsl_newarray_type_complexType 25 { 26 protected: // Attribute 27 /** 28 * The length attribute specifies the length of the array. 29 */ 30 xsPositiveInteger attrLength; 31 32 protected: // Elements 33 domGlsl_param_type_Array elemGlsl_param_type_array; 34 /** 35 * You may recursively nest glsl_newarray elements to create multidimensional 36 * arrays. @see domArray 37 */ 38 domGlsl_newarray_type_Array elemArray_array; 39 /** 40 * Used to preserve order in elements that do not specify strict sequencing of sub-elements. 41 */ 42 daeElementRefArray _contents; 43 /** 44 * Used to preserve order in elements that have a complex content model. 45 */ 46 daeUIntArray _contentsOrder; 47 48 /** 49 * Used to store information needed for some content model objects. 50 */ 51 daeTArray< daeCharArray * > _CMData; 52 53 54 public: //Accessors and Mutators 55 /** 56 * Gets the length attribute. 57 * @return Returns a xsPositiveInteger of the length attribute. 58 */ 59 xsPositiveInteger getLength() const { return attrLength; } 60 /** 61 * Sets the length attribute. 62 * @param atLength The new value for the length attribute. 63 */ 64 void setLength( xsPositiveInteger atLength ) { attrLength = atLength; } 65 66 /** 67 * Gets the glsl_param_type element array. 68 * @return Returns a reference to the array of glsl_param_type elements. 69 */ 70 domGlsl_param_type_Array &getGlsl_param_type_array() { return elemGlsl_param_type_array; } 71 /** 72 * Gets the glsl_param_type element array. 73 * @return Returns a constant reference to the array of glsl_param_type elements. 74 */ 75 const domGlsl_param_type_Array &getGlsl_param_type_array() const { return elemGlsl_param_type_array; } 76 /** 77 * Gets the array element array. 78 * @return Returns a reference to the array of array elements. 79 */ 80 domGlsl_newarray_type_Array &getArray_array() { return elemArray_array; } 81 /** 82 * Gets the array element array. 83 * @return Returns a constant reference to the array of array elements. 84 */ 85 const domGlsl_newarray_type_Array &getArray_array() const { return elemArray_array; } 86 /** 87 * Gets the _contents array. 88 * @return Returns a reference to the _contents element array. 89 */ 90 daeElementRefArray &getContents() { return _contents; } 91 /** 92 * Gets the _contents array. 93 * @return Returns a constant reference to the _contents element array. 94 */ 95 const daeElementRefArray &getContents() const { return _contents; } 96 97 protected: 98 /** 99 * Constructor 100 */ 101 domGlsl_newarray_type_complexType(DAE& dae, daeElement* elt) : attrLength(), elemGlsl_param_type_array(), elemArray_array() {} 102 /** 103 * Destructor 104 */ 105 virtual ~domGlsl_newarray_type_complexType() { daeElement::deleteCMDataArray(_CMData); } 106 /** 107 * Overloaded assignment operator 108 */ 109 virtual domGlsl_newarray_type_complexType &operator=( const domGlsl_newarray_type_complexType &cpy ) { (void)cpy; return *this; } 110 }; 111 112 /** 113 * An element of type domGlsl_newarray_type_complexType. 114 */ 115 class domGlsl_newarray_type : public daeElement, public domGlsl_newarray_type_complexType 116 { 117 public: 118 virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::GLSL_NEWARRAY_TYPE; } 119 static daeInt ID() { return 103; } 120 virtual daeInt typeID() const { return ID(); } 121 122 public: //Accessors and Mutators 123 /** 124 * Gets the length attribute. 125 * @return Returns a xsPositiveInteger of the length attribute. 126 */ 127 xsPositiveInteger getLength() const { return attrLength; } 128 /** 129 * Sets the length attribute. 130 * @param atLength The new value for the length attribute. 131 */ 132 void setLength( xsPositiveInteger atLength ) { attrLength = atLength; _validAttributeArray[0] = true; } 133 134 protected: 135 /** 136 * Constructor 137 */ 138 domGlsl_newarray_type(DAE& dae) : daeElement(dae), domGlsl_newarray_type_complexType(dae, this) {} 139 /** 140 * Destructor 141 */ 142 virtual ~domGlsl_newarray_type() {} 143 /** 144 * Overloaded assignment operator 145 */ 146 virtual domGlsl_newarray_type &operator=( const domGlsl_newarray_type &cpy ) { (void)cpy; return *this; } 147 148 public: // STATIC METHODS 149 /** 150 * Creates an instance of this class and returns a daeElementRef referencing it. 151 * @return a daeElementRef referencing an instance of this object. 152 */ 153 static DLLSPEC daeElementRef create(DAE& dae); 154 /** 155 * Creates a daeMetaElement object that describes this element in the meta object reflection framework. 156 * If a daeMetaElement already exists it will return that instead of creating a new one. 157 * @return A daeMetaElement describing this COLLADA element. 158 */ 159 static DLLSPEC daeMetaElement* registerElement(DAE& dae); 160 }; 161 162 163 #endif 164