00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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
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
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
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