fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / OpenFlight / OSGOFDatabase.h
blob67ae072eb98cefbd0c22cc93f7d0fa4851abe062
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2008 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 _OSGOFDATABASE_H_
40 #define _OSGOFDATABASE_H_
42 #include <istream>
44 #include "OSGFileIODef.h"
45 #include "OSGContainerForwards.h"
47 #include "OSGOFRecords.h"
48 #include "OSGOFPalettes.h"
49 #include "OSGOFPrimaryRecords.h"
51 #include <stack>
53 OSG_BEGIN_NAMESPACE
55 //---------------------------------------------------------------------------
56 // Class
57 //---------------------------------------------------------------------------
59 class OSG_FILEIO_DLLMAPPING OFDatabase
61 public:
63 enum VertexUnits
65 VU_Meters = 0,
66 VU_Kilometers = 1,
67 VU_Feet = 4,
68 VU_Inches = 5,
69 VU_NauticalMiles = 8
72 /*---------------------------------------------------------------------*/
74 OFDatabase(void);
75 ~OFDatabase(void);
77 /*---------------------------------------------------------------------*/
79 bool read (std::istream &is);
80 NodeTransitPtr convert(void );
82 /*---------------------------------------------------------------------*/
84 void pushLevel(void);
85 void popLevel (void);
87 /*---------------------------------------------------------------------*/
89 VertexUnits getTargetUnits(void ) const;
90 void setTargetUnits(VertexUnits units);
92 Real32 getUnitScale (void ) const;
93 void setUnitScale (Real32 scale);
95 /*---------------------------------------------------------------------*/
97 const OFColorPaletteRecord *getColorPalette (void );
98 const OFVertexPaletteRecord *getVertexPalette(void );
100 const OFTexturePaletteRecord *getTexRecord (UInt32 uiIdx);
101 const OFMaterialPaletteRecord *getMatRecord (UInt32 uiIdx);
103 void addColorPaletteRecord (OFColorPaletteRecord *colPal );
104 void addVertexPaletteRecord (OFVertexPaletteRecord *vertPal);
105 void addTexturePaletteRecord (OFTexturePaletteRecord *texPal );
106 void addMaterialPaletteRecord(OFMaterialPaletteRecord *matPal );
108 /*---------------------------------------------------------------------*/
109 protected:
111 OFHeaderRecordRCPtr _pHeader;
112 std::stack<OFRecord *> _sRecords;
114 OFRecordRCPtr _pCurr;
115 OFRecordRCPtr _pCurrPrimary;
117 OFColorPaletteRCPtr _pColorPalette;
118 OFVertexPaletteRCPtr _pVertexPalette;
119 OFTexturePaletteRCPtr _pTexturePalette;
120 OFMaterialPaletteRCPtr _pMaterialPalette;
122 VertexUnits _targetUnits;
123 Real32 _unitScale;
125 // OpCode without object
127 static const UInt16 OFContinuationOC = 23;
130 OSG_END_NAMESPACE
132 #endif // _OSGOFDATABASE_H