1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAStreamWriter. 5 6 Licensed under the MIT Open Source License, 7 for details please see LICENSE file or the website 8 http://www.opensource.org/licenses/mit-license.php 9 */ 10 11 #ifndef __COLLADASTREAMWRITER_BASE_INPUT_ELEMENT_H__ 12 #define __COLLADASTREAMWRITER_BASE_INPUT_ELEMENT_H__ 13 14 #include "COLLADASWPrerequisites.h" 15 #include "COLLADASWBaseElement.h" 16 #include "COLLADASWInputList.h" 17 #include "COLLADASWConstants.h" 18 19 namespace COLLADASW 20 { 21 22 /** Template class representing a base input element. */ 23 class BaseInputElement : public BaseElement 24 { 25 26 private: 27 28 /** List of all the inputs*/ 29 InputList mInputList; 30 31 public: 32 33 /** 34 * Constructor. 35 * @param streamWriter Pointer to the stream. 36 */ BaseInputElement(StreamWriter * streamWriter,const String & elementName)37 BaseInputElement ( StreamWriter* streamWriter, const String& elementName ) 38 : BaseElement ( streamWriter, elementName ) 39 , mInputList ( streamWriter ) 40 {} 41 42 /** 43 * Destructor. 44 */ ~BaseInputElement()45 virtual ~BaseInputElement() {}; 46 47 /** Returns a reference to the input list */ getInputList()48 InputList& getInputList() 49 { 50 return mInputList; 51 } 52 53 /** Adds the element to the stream */ 54 void add(); 55 56 }; 57 58 //--------------------------------------------------------------- 59 60 /** 61 * Template class to define the typedefs. 62 */ 63 template<const String& elementName> 64 class BaseInputElementTemplate : public BaseInputElement 65 { 66 public: BaseInputElementTemplate(StreamWriter * streamWriter)67 BaseInputElementTemplate ( StreamWriter* streamWriter ) 68 : BaseInputElement( streamWriter, elementName ) {}; 69 }; 70 71 //--------------------------------------------------------------- 72 /** Vertices input element for the geometry. */ 73 typedef BaseInputElementTemplate<CSWC::CSW_ELEMENT_VERTICES> VerticesElement; 74 75 /** Joints input element for the controller. */ 76 typedef BaseInputElementTemplate<CSWC::CSW_ELEMENT_JOINTS> JointsElement; 77 78 /** Joints input element for the controller. */ 79 typedef BaseInputElementTemplate<CSWC::CSW_ELEMENT_TARGETS> TargetsElement; 80 81 82 } //namespace COLLADASW 83 84 85 #endif //__COLLADASTREAMWRITER_BASE_INPUT_ELEMENT_H__ 86