Home | History | Annotate | Download | only in dom
      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 __domController_h__
     10 #define __domController_h__
     11 
     12 #include <dae/daeDocument.h>
     13 #include <dom/domTypes.h>
     14 #include <dom/domElements.h>
     15 
     16 #include <dom/domAsset.h>
     17 #include <dom/domSkin.h>
     18 #include <dom/domMorph.h>
     19 #include <dom/domExtra.h>
     20 class DAE;
     21 
     22 /**
     23  * The controller element categorizes the declaration of generic control information.
     24  * A controller is a device or mechanism that manages and directs the operations
     25  * of another object.
     26  */
     27 class domController : public daeElement
     28 {
     29 public:
     30 	virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::CONTROLLER; }
     31 	static daeInt ID() { return 655; }
     32 	virtual daeInt typeID() const { return ID(); }
     33 protected:  // Attributes
     34 /**
     35  *  The id attribute is a text string containing the unique identifier of
     36  * this element. This value  must be unique within the instance document.
     37  * Optional attribute.
     38  */
     39 	xsID attrId;
     40 /**
     41  *  The name attribute is the text string name of this element. Optional attribute.
     42  */
     43 	xsNCName attrName;
     44 
     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 	/**
     74 	 * Used to store information needed for some content model objects.
     75 	 */
     76 	daeTArray< daeCharArray * > _CMData;
     77 
     78 
     79 public:	//Accessors and Mutators
     80 	/**
     81 	 * Gets the id attribute.
     82 	 * @return Returns a xsID of the id attribute.
     83 	 */
     84 	xsID getId() const { return attrId; }
     85 	/**
     86 	 * Sets the id attribute.
     87 	 * @param atId The new value for the id attribute.
     88 	 */
     89 	void setId( xsID atId ) { *(daeStringRef*)&attrId = atId; _validAttributeArray[0] = true;
     90 		if( _document != NULL ) _document->changeElementID( this, attrId );
     91 	}
     92 
     93 	/**
     94 	 * Gets the name attribute.
     95 	 * @return Returns a xsNCName of the name attribute.
     96 	 */
     97 	xsNCName getName() const { return attrName; }
     98 	/**
     99 	 * Sets the name attribute.
    100 	 * @param atName The new value for the name attribute.
    101 	 */
    102 	void setName( xsNCName atName ) { *(daeStringRef*)&attrName = atName; _validAttributeArray[1] = true; }
    103 
    104 	/**
    105 	 * Gets the asset element.
    106 	 * @return a daeSmartRef to the asset element.
    107 	 */
    108 	const domAssetRef getAsset() const { return elemAsset; }
    109 	/**
    110 	 * Gets the skin element.
    111 	 * @return a daeSmartRef to the skin element.
    112 	 */
    113 	const domSkinRef getSkin() const { return elemSkin; }
    114 	/**
    115 	 * Gets the morph element.
    116 	 * @return a daeSmartRef to the morph element.
    117 	 */
    118 	const domMorphRef getMorph() const { return elemMorph; }
    119 	/**
    120 	 * Gets the extra element array.
    121 	 * @return Returns a reference to the array of extra elements.
    122 	 */
    123 	domExtra_Array &getExtra_array() { return elemExtra_array; }
    124 	/**
    125 	 * Gets the extra element array.
    126 	 * @return Returns a constant reference to the array of extra elements.
    127 	 */
    128 	const domExtra_Array &getExtra_array() const { return elemExtra_array; }
    129 	/**
    130 	 * Gets the _contents array.
    131 	 * @return Returns a reference to the _contents element array.
    132 	 */
    133 	daeElementRefArray &getContents() { return _contents; }
    134 	/**
    135 	 * Gets the _contents array.
    136 	 * @return Returns a constant reference to the _contents element array.
    137 	 */
    138 	const daeElementRefArray &getContents() const { return _contents; }
    139 
    140 protected:
    141 	/**
    142 	 * Constructor
    143 	 */
    144 	domController(DAE& dae) : daeElement(dae), attrId(), attrName(), elemAsset(), elemSkin(), elemMorph(), elemExtra_array() {}
    145 	/**
    146 	 * Destructor
    147 	 */
    148 	virtual ~domController() { daeElement::deleteCMDataArray(_CMData); }
    149 	/**
    150 	 * Overloaded assignment operator
    151 	 */
    152 	virtual domController &operator=( const domController &cpy ) { (void)cpy; return *this; }
    153 
    154 public: // STATIC METHODS
    155 	/**
    156 	 * Creates an instance of this class and returns a daeElementRef referencing it.
    157 	 * @return a daeElementRef referencing an instance of this object.
    158 	 */
    159 	static DLLSPEC daeElementRef create(DAE& dae);
    160 	/**
    161 	 * Creates a daeMetaElement object that describes this element in the meta object reflection framework.
    162 	 * If a daeMetaElement already exists it will return that instead of creating a new one.
    163 	 * @return A daeMetaElement describing this COLLADA element.
    164 	 */
    165 	static DLLSPEC daeMetaElement* registerElement(DAE& dae);
    166 };
    167 
    168 
    169 #endif
    170