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

OSGFieldContainerTypeImpl.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 _OSGFIELDCONTAINERTYPEIMPL_H_
00040 #define _OSGFIELDCONTAINERTYPEIMPL_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #ifdef OSG_DOC_FILES_IN_MODULE
00046 
00049 #endif
00050 
00051 #include <OSGSystemDef.h>
00052 #include <OSGBaseTypes.h>
00053 #include <OSGIDStringLink.h>
00054 #include <OSGDataType.h>
00055 
00056 #include <map>
00057 
00058 OSG_BEGIN_NAMESPACE
00059 
00060 class FieldDescription;
00061 
00065 typedef void              (*InitContainerF)  (void);
00066 
00070 typedef FieldContainerPtr (*PrototypeCreateF)(void);
00071 
00075 class OSG_SYSTEMLIB_DLLMAPPING FieldContainerType : public DataType
00076 {
00077     /*==========================  PUBLIC  =================================*/
00078 
00079   public :
00080 
00081     /*---------------------------------------------------------------------*/
00085     FieldContainerType(const Char8       *szName,
00086                        const Char8       *szParentName      = NULL,
00087                        const Char8       *szGroupName       = NULL,
00088                        PrototypeCreateF   fPrototypeCreate  = NULL,
00089                        InitContainerF     fInitMethod       = NULL,
00090                        FieldDescription **pDesc             = NULL,
00091                        UInt32             uiDescByteCounter = 0,
00092                        bool               bDescsAddable     = false);
00093 
00094     FieldContainerType(const FieldContainerType &source);
00095 
00097     /*---------------------------------------------------------------------*/
00101     virtual ~FieldContainerType(void); 
00102 
00104     /*---------------------------------------------------------------------*/
00108     UInt16              getGroupId(void) const;
00109     FieldContainerType *getParent (void) const;
00110 
00112     /*---------------------------------------------------------------------*/
00116           FieldDescription *getFieldDescription (UInt32 uiFieldId);
00117     const FieldDescription *getFieldDescription (UInt32 uiFieldId) const;
00118 
00119           FieldDescription *findFieldDescription(const Char8 *szFieldName);
00120 
00121     const FieldDescription *findFieldDescription(
00122         const Char8 *szFieldName) const; 
00123 
00124     UInt32                 getNumFieldDescs(void) const;
00125 
00126     UInt32                 addDescription  (const FieldDescription &desc     );
00127     bool                   subDescription  (      UInt32            uiFieldId);
00128 
00130     /*---------------------------------------------------------------------*/
00134     FieldContainerPtr getPrototype(void                        ) const;
00135     bool              setPrototype(FieldContainerPtr pPrototype);
00136 
00138     /*---------------------------------------------------------------------*/
00142     bool isInitialized(void                           ) const;
00143 
00144     bool isAbstract   (void                           ) const;
00145 
00146     bool isDerivedFrom(const TypeBase           &other) const;
00147     bool isDerivedFrom(const FieldContainerType &other) const;    
00148 
00149     bool isNode       (void                           ) const;
00150     bool isNodeCore   (void                           ) const;
00151     bool isAttachment (void                           ) const;
00152 
00154     /*---------------------------------------------------------------------*/
00158     FieldContainerPtr createFieldContainer(void) const;
00159     NodePtr           createNode          (void) const;
00160     NodeCorePtr       createNodeCore      (void) const;
00161     AttachmentPtr     createAttachment    (void) const;
00162 
00164     /*---------------------------------------------------------------------*/
00168     virtual void dump(      UInt32    uiIndent = 0, 
00169                       const BitVector bvFlags  = 0) const;
00170 
00172     /*=========================  PROTECTED  ===============================*/
00173 
00174   protected:
00175 
00176     enum BaseType
00177     {
00178         IsFieldContainer,
00179         IsNode,
00180         IsNodeCore,
00181         IsAttachment
00182     };
00183 
00184     typedef std::map   <IDStringLink, FieldDescription *> DescMap;
00185     typedef std::vector<              FieldDescription *> DescVec;
00186 
00187     typedef DescMap::iterator                             DescMapIt;
00188     typedef DescVec::iterator                             DescVecIt;
00189 
00190     typedef DescMap::const_iterator                       DescMapConstIt;
00191     typedef DescVec::const_iterator                       DescVecConstIt;
00192 
00193     /*---------------------------------------------------------------------*/
00197     UInt16              _uiGroupId;
00198 
00199     bool                _bInitialized;
00200     bool                _bDescsAddable;
00201 
00202     BaseType            _baseType;
00203 
00204     FieldContainerType *_pParent;
00205     IDString            _szParentName;
00206     IDString            _szGroupName;
00207 
00208     FieldContainerPtr   _pPrototype;
00209     PrototypeCreateF    _fPrototypeCreate;
00210 
00211     FieldDescription  **_pDesc;
00212     UInt32              _uiDescByteCounter;
00213 
00214     DescMap             _mDescMap;
00215     DescVec             _vDescVec;
00216 
00217     bool                _bCopy;
00218 
00220     /*---------------------------------------------------------------------*/
00224     void registerType(const Char8 *szGroupName);
00225 
00227     /*---------------------------------------------------------------------*/
00231     bool initPrototype   (void);
00232     bool initBaseType    (void);
00233     bool initFields      (void);
00234     bool initParentFields(void);
00235 
00236     bool initialize      (void);
00237     void terminate       (void);
00238 
00240     /*==========================  PRIVATE  ================================*/
00241 
00242   private:
00243 
00244     typedef DataType Inherited;
00245 
00246     friend class FieldContainerFactory;
00247 
00249     void operator =(const FieldContainerType &source);
00250 };
00251 
00252 OSG_END_NAMESPACE
00253 
00254 #define OSGFIELDCONTAINERTYPE_HEADER_CVSID "@(#)$Id: $"
00255 
00256 #endif /* _OSGFIELDCONTAINERTYPE_H_ */

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