fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / Collada / OSGColladaSource.h
blobbb5fb0bc34fa16ccb609e46f7a4b15d673425a55
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2009 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGCOLLADASOURCE_H_
40 #define _OSGCOLLADASOURCE_H_
42 #include "OSGConfig.h"
44 #if defined(OSG_WITH_COLLADA) || defined(OSG_DO_DOC)
46 #include "OSGColladaElement.h"
47 #include "OSGColladaElementFactoryHelper.h"
48 #include "OSGGeoVectorProperty.h"
49 #include "OSGAnimKeyFrameDataSource.h"
51 OSG_BEGIN_NAMESPACE
53 /*! \ingroup GrpFileIOCollada
54 \nohierarchy
57 class OSG_FILEIO_DLLMAPPING ColladaSource : public ColladaElement
59 /*========================== PUBLIC =================================*/
60 public:
61 /*---------------------------------------------------------------------*/
62 /*! \name Types */
63 /*! \{ */
65 typedef ColladaElement Inherited;
66 typedef ColladaSource Self;
68 OSG_GEN_INTERNAL_MEMOBJPTR(ColladaSource);
70 typedef std::vector<std::string> NameStore;
71 typedef NameStore::iterator NameStoreIt;
72 typedef NameStore::const_iterator NameStoreConstIt;
74 typedef std::vector<Matrix> MatrixStore;
75 typedef MatrixStore::iterator MatrixStoreIt;
76 typedef MatrixStore::const_iterator MatrixStoreConstIt;
78 typedef std::vector<Real32> FloatStore;
79 typedef FloatStore::iterator FloatStoreIt;
80 typedef FloatStore::const_iterator FloatStoreConstIt;
82 /*! \} */
83 /*---------------------------------------------------------------------*/
84 /*! \name Create */
85 /*! \{ */
87 static ColladaElementTransitPtr
88 create(daeElement *elem, ColladaGlobal *global);
90 /*! \} */
91 /*---------------------------------------------------------------------*/
92 /*! \name Reading */
93 /*! \{ */
95 virtual void read(ColladaElement *colElemParent);
97 /*! \} */
98 /*---------------------------------------------------------------------*/
99 /*! \name Access */
100 /*! \{ */
102 GeoVectorProperty *getProperty (const std::string &semantic);
103 AnimKeyFrameDataSource *getDataSource(const std::string &semantic);
105 const NameStore &getNameStore (void);
106 const MatrixStore &getMatrixStore(void);
107 const FloatStore &getFloatStore (void);
109 std::string getNameValue (UInt32 idx );
110 bool getNameValue (UInt32 idx, std::string &nameVal );
112 Real32 getFloatValue (UInt32 idx );
113 bool getFloatValue (UInt32 idx, Real32 &floatVal);
115 Matrix getMatrixValue(UInt32 idx );
116 bool getMatrixValue(UInt32 idx, Matrix &matVal );
118 /*! \} */
119 /*========================= PROTECTED ===============================*/
120 protected:
121 /*---------------------------------------------------------------------*/
122 /*! \name Constructors/Destructor */
123 /*! \{ */
125 ColladaSource(daeElement *elem, ColladaGlobal *global);
126 virtual ~ColladaSource(void );
128 /*! \} */
129 /*---------------------------------------------------------------------*/
131 // map semantic to a property holding data of this source in the
132 // appropriate form for the semantic
133 typedef std::map<std::string,
134 GeoVectorPropertyUnrecPtr> PropertyMap;
135 typedef PropertyMap::iterator PropertyMapIt;
136 typedef PropertyMap::const_iterator PropertyMapConstIt;
138 typedef std::map<std::string,
139 AnimKeyFrameDataSourceUnrecPtr> DataSourceMap;
140 typedef DataSourceMap::iterator DataSourceMapIt;
141 typedef DataSourceMap::const_iterator DataSourceMapConstIt;
143 typedef std::vector<Int16> StrideMap;
144 typedef StrideMap::iterator StrideMapIt;
145 typedef StrideMap::const_iterator StrideMapConstIt;
148 GeoVectorProperty *fillProperty (const std::string &semantic);
149 AnimKeyFrameDataSource *fillDataSource (const std::string &semantic);
150 void fillNameStore (void );
151 void fillMatrixStore(void );
152 void fillFloatStore (void );
155 static ColladaElementRegistrationHelper _regHelper;
157 UInt32 _offset;
158 UInt32 _count;
159 UInt32 _stride;
160 UInt32 _elemSize;
161 StrideMap _strideMap;
163 PropertyMap _propMap;
164 DataSourceMap _dataMap;
165 NameStore _nameStore;
166 MatrixStore _matrixStore;
167 FloatStore _floatStore;
170 OSG_GEN_MEMOBJPTR(ColladaSource);
172 OSG_END_NAMESPACE
174 // #include "OSGColladaSource.inl"
176 #endif // OSG_WITH_COLLADA
178 #endif // _OSGCOLLADASOURCE_H_