fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / OSG / OSGOSGWriter.h
bloba072da7b5bde6dc5aaa7e2d45ac3a577b9d5eda9
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright 2000-2002 by OpenSG Forum *
6 * *
7 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
8 * *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11 * License *
12 * *
13 * This library is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU Library General Public License as published *
15 * by the Free Software Foundation, version 2. *
16 * *
17 * This library is distributed in the hope that it will be useful, but *
18 * WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
20 * Library General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU Library General Public *
23 * License along with this library; if not, write to the Free Software *
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
25 * *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28 * Changes *
29 * *
30 * *
31 * *
32 * *
33 * *
34 * *
35 \*---------------------------------------------------------------------------*/
37 #ifndef _OSGOSGWRITER_H_
38 #define _OSGOSGWRITER_H_
39 #ifdef __sgi
40 #pragma once
41 #endif
43 #include "OSGConfig.h"
45 #include <iostream>
47 #include <string>
48 #include <map>
49 #include <vector>
51 #include "OSGNode.h"
52 #include "OSGNodeCore.h"
53 #include "OSGFieldContainer.h"
54 #include "OSGSystemDef.h"
56 OSG_BEGIN_NAMESPACE
58 /*! \brief Brief OSGWriter
59 \ingroup GrpSystemFileIOOSG
60 \ingroup GrpLibOSGSystem
63 class OSG_SYSTEM_DLLMAPPING OSGWriter
65 /*========================== PUBLIC =================================*/
67 public:
69 /*---------------------------------------------------------------------*/
70 /*! \name Constructors */
71 /*! \{ */
73 OSGWriter(OutStream &stream, UInt32 indentStep = 4);
75 /*! \} */
76 /*---------------------------------------------------------------------*/
77 /*! \name Destructor */
78 /*! \{ */
80 ~OSGWriter(void);
82 /*! \} */
83 /*---------------------------------------------------------------------*/
84 /*! \name Write */
85 /*! \{ */
87 void write( FieldContainer * container );
88 void write(std::vector<FieldContainer *> containers);
90 /*! \} */
91 /*========================= PROTECTED ===============================*/
93 protected:
95 static const UInt32 DefaultSFWidth;
96 static const UInt32 DefaultMFWidth;
98 /*! \nohierarchy
101 struct FCInfoHelper
103 bool written;
104 bool hasName;
105 std::string containerName;
107 void setName (FieldContainer * const pFC);
109 FCInfoHelper(void);
112 typedef std::map<FieldContainer *, FCInfoHelper> FCInfoHelperMap;
114 /*---------------------------------------------------------------------*/
115 /*! \name Member */
116 /*! \{ */
118 FCInfoHelperMap _visitedFCMap;
119 OutStream &_outStream;
121 void visitContainer(FieldContainer * const pFC );
122 void visitField (GetFieldHandlePtr hF );
124 void writeContainer(FieldContainer * const pFC ,
125 bool bIndent);
126 void writeField (GetFieldHandlePtr hF );
128 /*! \} */
129 /*========================== PRIVATE ================================*/
131 private:
133 /*!\brief prohibit default function (move to 'public' if needed) */
134 OSGWriter(const OSGWriter &source);
135 /*!\brief prohibit default function (move to 'public' if needed) */
136 void operator =(const OSGWriter &source);
139 OSG_END_NAMESPACE
141 #endif /* _OSGOSGWRITER_H_ */