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 _OSGMFIELD_H_
00040 #define _OSGMFIELD_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGBase.h>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGBaseFunctions.h>
00048 #include <OSGField.h>
00049 #include <OSGMFieldVector.h>
00050 #include <OSGStringConversionStateBase.h>
00051
00052 #include <vector>
00053 #include <string>
00054
00055 OSG_BEGIN_NAMESPACE
00056
00057 #ifdef OSG_DOC_FILES_IN_MODULE
00058
00062 #endif
00063
00064 class BinaryDataHandler;
00065
00071 template <class FieldTypeT, Int32 fieldNameSpace = 0>
00072 class MField : public Field
00073 {
00074
00075
00076 public:
00077
00078 typedef MFieldVector<FieldTypeT> StorageType;
00079 typedef typename StorageType::Inherited StorageTypeParent;
00080
00081 typedef typename StorageType::iterator iterator;
00082 typedef typename StorageType::const_iterator const_iterator;
00083
00084 typedef typename
00085 StorageType::reverse_iterator reverse_iterator;
00086 typedef typename
00087 StorageType::const_reverse_iterator const_reverse_iterator;
00088
00089
00090 typedef typename StorageType::reference reference;
00091 typedef typename StorageType::const_reference const_reference;
00092
00093
00094 typedef typename osgIF<fieldNameSpace == 0,
00095 FieldDataTraits <FieldTypeT>,
00096 InvalidTrait >::_IRet MF0Trait;
00097
00098 typedef typename osgIF<fieldNameSpace == 1,
00099 FieldDataTraits1<FieldTypeT>,
00100 MF0Trait >::_IRet MF1Trait;
00101
00102 typedef typename osgIF<fieldNameSpace == 2,
00103 FieldDataTraits2<FieldTypeT>,
00104 MF1Trait >::_IRet MFieldTraits;
00105
00106 typedef MField<FieldTypeT, fieldNameSpace> Self;
00107
00108 typedef FieldTypeT StoredType;
00109
00110 typedef typename MFieldTraits::ArgumentType ArgumentType;
00111
00112
00116 static const FieldType &getClassType(void);
00117
00119
00123 MField(void);
00124 MField(const MField &obj);
00125 explicit MField(const UInt32 size);
00126
00128
00132 virtual ~MField(void);
00133
00135
00139 #ifndef OSG_DISABLE_DEPRECATED
00140 reference getValue (const UInt32 index);
00141 const_reference getValue (const UInt32 index) const;
00142 #endif
00143
00144 virtual UInt32 getSize ( void ) const;
00145
00146 StorageType &getValues( void );
00147 const StorageType &getValues( void ) const;
00148
00149 virtual const FieldType &getType ( void ) const;
00150
00151 virtual bool isEmpty ( void ) const;
00152
00154
00158 void setValues (const StorageType &value);
00159 void setValues (const StorageTypeParent &value);
00160 void setValues (const Self &obj );
00161
00162 virtual void setAbstrValue(const Field &obj );
00163
00164
00165 #ifndef OSG_DISABLE_DEPRECATED
00166 void setValue ( ArgumentType value,
00167 const UInt32 index);
00168
00169 void addValue ( ArgumentType value);
00170 #endif
00171
00173
00177 iterator begin (void );
00178 iterator end (void );
00179
00180 reverse_iterator rbegin (void );
00181 reverse_iterator rend (void );
00182
00183
00184 const_iterator begin (void ) const;
00185 const_iterator end (void ) const;
00186
00187 const_reverse_iterator rbegin (void ) const;
00188 const_reverse_iterator rend (void ) const;
00189
00190
00191 reference front (void );
00192 const_reference front (void ) const;
00193
00194 reference back (void );
00195 const_reference back (void ) const;
00196
00197 void clear (void );
00198
00199 iterator insert (iterator pos,
00200 ArgumentType value );
00201 iterator erase (iterator pos );
00202
00203 iterator find (ArgumentType value );
00204 const_iterator find (ArgumentType value ) const;
00205
00206 void push_back(ArgumentType value );
00207
00208 void resize (size_t newsize,
00209 FieldTypeT t = FieldTypeT());
00210 void reserve (size_t newsize );
00211
00212 UInt32 size (void ) const;
00213 UInt32 capacity (void ) const;
00214 bool empty (void ) const;
00215
00217
00221 reference operator [](UInt32 index);
00222 const_reference operator [](UInt32 index) const;
00223
00225
00229 void operator =(const MField &source);
00230
00232
00236 virtual void pushValueByStr(const Char8 *str );
00237 virtual std::string &getValueByStr ( std::string &str ) const;
00238 virtual std::string &getValueByStr ( std::string &str,
00239 StringConversionStateBase &state) const;
00240 virtual std::string &getValueByStr ( std::string &str,
00241 UInt32 index) const;
00242
00244
00248 #if !defined(OSG_FIXED_MFIELDSYNC)
00249 void syncWith (Self &source );
00250 #else
00251 void syncWith ( Self &source,
00252 const SyncInfo &sInfo );
00253
00254
00255
00256
00257
00258
00259
00260 void beginEdit (UInt32 uiAspect,
00261 UInt32 uiCopyOffset);
00262
00263 Self *resolveShare (UInt32 uiAspect,
00264 UInt32 uiCopyOffset);
00265
00266 void terminateShare(UInt32 uiAspect,
00267 UInt32 uiCopyOffset);
00268 #endif
00269
00271
00275 UInt32 getBinSize (void ) const;
00276
00277 void copyToBin (BinaryDataHandler &pMem) const;
00278 void copyFromBin(BinaryDataHandler &pMem);
00279
00281
00285 virtual void dump (void) const;
00286
00288
00289
00290 protected:
00291
00292 typedef Field Inherited;
00293
00294
00295
00296
00297 static const FieldType _fieldType;
00298
00299 StorageType _values;
00300
00301 UInt32 _uiSharedWith;
00302
00303
00304 static Field *create(void);
00305
00306
00307
00308 private:
00309
00310 friend class FieldContainer;
00311 };
00312
00313 OSG_END_NAMESPACE
00314
00315 #include <OSGMField.inl>
00316
00317 #define OSGMFIELD_HEADER_CVSID "@(#)$Id: $"
00318
00319 #endif
00320