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 void swap (MField &right);
00216
00218
00222 reference operator [](UInt32 index);
00223 const_reference operator [](UInt32 index) const;
00224
00226
00230 void operator =(const MField &source);
00231
00233
00237 virtual void pushValueByStr(const Char8 *str );
00238 virtual std::string &getValueByStr ( std::string &str ) const;
00239 virtual std::string &getValueByStr ( std::string &str,
00240 StringConversionStateBase &state) const;
00241 virtual std::string &getValueByStr ( std::string &str,
00242 UInt32 index) const;
00243
00245
00249 #if !defined(OSG_FIXED_MFIELDSYNC)
00250 void syncWith (Self &source );
00251 #else
00252 void syncWith ( Self &source,
00253 const SyncInfo &sInfo );
00254
00255
00256
00257
00258
00259
00260
00261 void beginEdit (UInt32 uiAspect,
00262 UInt32 uiCopyOffset);
00263
00264 Self *resolveShare (UInt32 uiAspect,
00265 UInt32 uiCopyOffset);
00266
00267 void terminateShare(UInt32 uiAspect,
00268 UInt32 uiCopyOffset);
00269 #endif
00270
00272
00276 UInt32 getBinSize (void ) const;
00277
00278 void copyToBin (BinaryDataHandler &pMem) const;
00279 void copyFromBin(BinaryDataHandler &pMem);
00280
00282
00286 virtual void dump (void) const;
00287
00289
00290
00291 protected:
00292
00293 typedef Field Inherited;
00294
00295
00296
00297
00298 static const FieldType _fieldType;
00299
00300 StorageType _values;
00301
00302 UInt32 _uiSharedWith;
00303
00304
00305 static Field *create(void);
00306
00307
00308
00309 private:
00310
00311 friend class FieldContainer;
00312 };
00313
00314 OSG_END_NAMESPACE
00315
00316 #include <OSGMField.inl>
00317
00318 #define OSGMFIELD_HEADER_CVSID "@(#)$Id: $"
00319
00320 #endif
00321