fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FileIO / OSB / OSGNFIOSceneFileType.cpp
blob412144059c283eaaacd3021d8589396252a38e35
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002,2007 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 #include <cstdlib>
40 #include <cstdio>
42 #include "OSGConfig.h"
44 #include <iostream>
45 #include <fstream>
47 #include "OSGLog.h"
48 #include "OSGNode.h"
49 #include "OSGGeometry.h"
50 #include "OSGGeoProperty.h"
51 #include "OSGSimpleMaterial.h"
53 #include "OSGNFIOSceneFileType.h"
55 #include "OSGOSBDriver.h"
57 OSG_USING_NAMESPACE
59 /*! \class OSG::NFIOSceneFileType
60 \ingroup GrpSystemFileIO
62 Loader for the binary file type. (.osb)
65 #if defined(OSG_WIN32_ICL) && !defined(OSG_CHECK_FIELDSETARG)
66 #pragma warning(disable : 383)
67 #endif
69 /*-------------------------------------------------------------------------*/
70 /* static get */
72 /*! Returns the singleton instance.
74 NFIOSceneFileType &NFIOSceneFileType::the(void)
76 return _the;
79 /*-------------------------------------------------------------------------*/
80 /* destructor */
82 /*! Destructor, does nothing.
84 NFIOSceneFileType::~NFIOSceneFileType(void)
88 #ifdef __sgi
89 #pragma set woff 1209
90 #endif
92 /*-------------------------------------------------------------------------*/
93 /* read */
95 /*! Read from the given input stream.
96 \see OSG::NFIODriver
98 NodeTransitPtr NFIOSceneFileType::read( std::istream &is,
99 const Char8 *,
100 Resolver ) const
102 return OSBDriver::read(is, getOptions());
105 #ifdef __sgi
106 #pragma reset woff 1209
107 #endif
109 /*-------------------------------------------------------------------------*/
110 /* write */
112 /*! Writes the given \a node and its subtree to the given output stream.
113 \see OSG::NFIOBase
115 \param[in] node Root of the subtree to write.
116 \param[in] os Output stream to write to.
117 \param[in] fileNameOrExtension filename or file extension
118 \return True if the operation succeeded, false otherwise.
120 bool NFIOSceneFileType::write(Node * const node,
121 std::ostream &os,
122 Char8 const *fileNameOrExtension) const
124 return OSBDriver::write(node, os, getOptions());
127 /*-------------------------------------------------------------------------*/
128 /* Constructors */
130 /*! Constructor.
131 \see SceneFileType::SceneFileType
133 NFIOSceneFileType::NFIOSceneFileType(const Char8 *suffixArray[],
134 UInt16 suffixByteCount,
135 bool override,
136 UInt32 overridePriority,
137 UInt32 flags )
138 : SceneFileType(suffixArray, suffixByteCount, override,
139 overridePriority, flags)
143 /*! Copy constructor.
145 NFIOSceneFileType::NFIOSceneFileType(const NFIOSceneFileType &obj) :
146 SceneFileType(obj)
150 /*! Returns a descriptive name for the type of files read.
152 const Char8 *NFIOSceneFileType::getName(void) const
154 return "OSG Binary";
157 /*-------------------------------------------------------------------------*/
158 /* static elements */
160 const Char8 * NFIOSceneFileType::_suffixA[] = { "osb" };
161 NFIOSceneFileType NFIOSceneFileType::_the(_suffixA,
162 sizeof(_suffixA), false, 10,
163 OSG_READ_SUPPORTED |
164 OSG_WRITE_SUPPORTED);