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

OSGLoader.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGLOADER_H_
00040 #define _OSGLOADER_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <OSGSystemDef.h>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGScanParseSkel.h>
00048 #include <OSGScanParseFieldTypeMapper.h>
00049 
00050 #include <OSGNodePtr.h>
00051 #include <OSGField.h>
00052 #include <OSGFieldContainer.h>
00053 
00054 #include <stack>
00055 #include <map>
00056 #include <string>
00057 
00058 OSG_BEGIN_NAMESPACE
00059 
00064 class OSG_SYSTEMLIB_DLLMAPPING OSGLoader :
00065     public ScanParseFieldTypeMapper<ScanParseSkel>
00066 {
00067     /*==========================  PRIVATE  ================================*/
00068   private:
00069 
00070     typedef ScanParseFieldTypeMapper<ScanParseSkel    > Inherited;
00071     typedef std::map                <std::string,
00072                                      FieldContainerPtr> NamedFCMap;
00073     typedef OSGLoader                                   Self;
00074 
00075   public :
00076 
00077     /*---------------------------------------------------------------------*/
00081     OSGLoader(void);
00082 
00084     /*---------------------------------------------------------------------*/
00088     virtual ~OSGLoader(void);
00089 
00091     /*---------------------------------------------------------------------*/
00095     virtual void scanStream       (std::istream &is);
00096 
00097     virtual void    beginNode         (const Char8  *szNodeTypename,
00098                                        const Char8  *szNodename       );
00099 
00100     virtual void    endNode           (void);
00101 
00102     virtual void    use               (const Char8  *szName           );
00103 
00104     virtual void    beginField        (const Char8  *szFieldname,
00105                                        const UInt32  uiFieldTypeId    );
00106 
00107     virtual void    endField          (void                           );
00108 
00109     virtual void    addFieldValue     (const Char8  *szFieldVal       );
00110 
00111     virtual Int32   mapExtIntFieldType(const Char8  *szFieldname,
00112                                        const Int32   iFieldTypeId     );
00113 
00114     virtual UInt32  getFieldType      (const Char8  *szFieldname      );
00115 
00117     /*---------------------------------------------------------------------*/
00121     virtual      NodePtr                   getRootNode (void);
00122     virtual std::vector<FieldContainerPtr> getRootNodes(void);
00123 
00124     virtual      FieldContainerPtr         getReference (const Char8 *szName);
00125 
00127     /*=========================  PROTECTED  ===============================*/
00128   protected:
00129 
00130     /*---------------------------------------------------------------------*/
00134           FieldContainerPtr                     _pCurrentFC;
00135           NodePtr                               _pRootNode;
00136           Field                                *_pCurrentField;
00137     const FieldDescription                     *_pCurrentFieldDesc;
00138           NamedFCMap                            _defMap;
00139 
00140           std::stack<      FieldContainerPtr >  _fcStack;
00141           std::stack<      Field            *>  _fStack;
00142           std::stack<const FieldDescription *>  _fdStack;
00143 
00144     void              initFieldTypeMapper   (      void                      );
00145 
00146     void              setFieldContainerValue(      FieldContainerPtr pNewNode);
00147 
00149     /*==========================  PRIVATE  ================================*/
00150   private:
00151 
00153     OSGLoader(const OSGLoader &source);
00155     void operator =(const OSGLoader &source);
00156 };
00157 
00158 //---------------------------------------------------------------------------
00159 //   Exported Types
00160 //---------------------------------------------------------------------------
00161 
00162 // class pointer
00163 
00164 typedef OSGLoader *OSGLoaderP;
00165 
00166 OSG_END_NAMESPACE
00167 
00168 #define OSGLOADER_HEADER_CVSID "@(#)$Id: $"
00169 
00170 #endif /* _OSGLOADER_H_ */

Generated on Thu Aug 25 04:07:09 2005 for OpenSG by  doxygen 1.4.3