Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGOSGWriter.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *                     Copyright 2000-2002 by OpenSG Forum                   *
00006  *                                                                           *
00007  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00008  *                                                                           *
00009 \*---------------------------------------------------------------------------*/
00010 /*---------------------------------------------------------------------------*\
00011  *                                License                                    *
00012  *                                                                           *
00013  * This library is free software; you can redistribute it and/or modify it   *
00014  * under the terms of the GNU Library General Public License as published    *
00015  * by the Free Software Foundation, version 2.                               *
00016  *                                                                           *
00017  * This library is distributed in the hope that it will be useful, but       *
00018  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00020  * Library General Public License for more details.                          *
00021  *                                                                           *
00022  * You should have received a copy of the GNU Library General Public         *
00023  * License along with this library; if not, write to the Free Software       *
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00025  *                                                                           *
00026 \*---------------------------------------------------------------------------*/
00027 /*---------------------------------------------------------------------------*\
00028  *                                Changes                                    *
00029  *                                                                           *
00030  *                                                                           *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef _OSGOSGWRITER_H_
00038 #define _OSGOSGWRITER_H_
00039 #ifdef __sgi
00040 #pragma once
00041 #endif
00042 
00043 #include <OSGConfig.h>
00044 
00045 #include <iostream>
00046 
00047 #include <string>
00048 #include <map>
00049 #include <vector>
00050 
00051 #include <OSGNode.h>
00052 #include <OSGNodeCore.h>
00053 #include <OSGFieldContainer.h>
00054 #include <OSGSFFieldContainerPtr.h>
00055 #include <OSGMFFieldContainerPtr.h>
00056 #include <OSGIndenter.h>
00057 #include <OSGStandardStringConversionState.h>
00058 
00059 OSG_BEGIN_NAMESPACE
00060 
00065 class OSG_SYSTEMLIB_DLLMAPPING OSGWriter
00066 {
00067     /*==========================  PUBLIC  =================================*/
00068   public:
00069 
00070     /*---------------------------------------------------------------------*/
00074     OSGWriter(std::ostream &stream, UInt32 indentStep=4);
00075 
00077     /*---------------------------------------------------------------------*/
00081     ~OSGWriter(void);
00082 
00084     /*---------------------------------------------------------------------*/
00088     void write(            FieldContainerPtr  container );
00089     void write(std::vector<FieldContainerPtr> containers);
00090     
00092     /*=========================  PROTECTED  ===============================*/
00093   protected:
00094       
00095     static const UInt32 DefaultSFWidth;
00096     static const UInt32 DefaultMFWidth; 
00097 
00098     struct FCInfoHelper
00099     {
00100         bool        written;
00101         bool        hasName;
00102         std::string containerName;
00103         
00104         void        setName      (const FieldContainerPtr pFC);
00105                      
00106         FCInfoHelper(void);
00107     };
00108     
00109     typedef std::map<FieldContainerPtr, FCInfoHelper> FCInfoHelperMap;
00110 
00111     /*---------------------------------------------------------------------*/
00115     FCInfoHelperMap                _visitedFCMap;
00116     StandardStringConversionState  _state;
00117     Indenter                       _indent;
00118     std::ostream                  &_outStream;
00119 
00120     void visitContainer(const FieldContainerPtr pFC      );
00121     void visitField    (const Field*            pF       );
00122 
00123     void writeContainer(const FieldContainerPtr pFC      );
00124     void writeField    (const Field*            pF,
00125             const FieldDescription* fieldDesc);
00126 
00128     /*==========================  PRIVATE  ================================*/
00129   private:
00130 
00132     OSGWriter(const OSGWriter &source);
00134     void operator =(const OSGWriter &source);
00135 };
00136 
00137 OSG_END_NAMESPACE
00138 
00139 #define OSGOSGWRITER_HEADER_CVSID "@(#)$Id: OSGOSGWriter.h,v 1.6 2002/02/04 20:14:05 dirk Exp $"
00140     
00141 #endif /* _OSGOSGWRITER_H_ */
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 

Generated on Thu Aug 25 04:08:02 2005 for OpenSG by  doxygen 1.4.3