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 _OSGSFIELD_H_
00040 #define _OSGSFIELD_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGBase.h>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGBaseFunctions.h>
00048 #include <OSGStringConversionStateBase.h>
00049
00050 #include <vector>
00051 #include <string>
00052
00053 #include <OSGField.h>
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 SField : public Field
00073 {
00074
00075
00076 public:
00077
00078 typedef typename osgIF<fieldNameSpace == 0,
00079 FieldDataTraits <FieldTypeT>,
00080 InvalidTrait >::_IRet SF0Trait;
00081
00082 typedef typename osgIF<fieldNameSpace == 1,
00083 FieldDataTraits1<FieldTypeT>,
00084 SF0Trait >::_IRet SF1Trait;
00085
00086 typedef typename osgIF<fieldNameSpace == 2,
00087 FieldDataTraits2<FieldTypeT>,
00088 SF1Trait >::_IRet SFieldTraits;
00089
00090 typedef SField<FieldTypeT, fieldNameSpace> Self;
00091
00092
00093
00094 typedef FieldTypeT StoredType;
00095 typedef FieldTypeT &reference;
00096 typedef const FieldTypeT &const_reference;
00097 typedef typename SFieldTraits::ArgumentType ArgumentType;
00098
00099
00103 static const FieldType &getClassType(void);
00104
00106
00110 SField(void );
00111 SField(const SField &obj );
00112 explicit SField( ArgumentType value);
00113
00115
00119 virtual ~SField(void);
00120
00122
00126 virtual UInt32 getSize (void) const;
00127
00128 reference getValue(void);
00129 const_reference getValue(void) const;
00130
00131 virtual const FieldType &getType (void) const;
00132
00133 virtual bool isEmpty (void) const;
00134
00136
00140 void setValue ( ArgumentType value);
00141 void setValue (const Self &obj );
00142
00143 virtual void setAbstrValue(const Field &obj );
00144
00146
00150 virtual void pushValueByStr(const Char8 *str );
00151 virtual std::string &getValueByStr ( std::string &str ) const;
00152 virtual std::string &getValueByStr ( std::string &str,
00153 StringConversionStateBase &state) const;
00154 virtual std::string &getValueByStr ( std::string &str,
00155 UInt32 index) const;
00156
00158
00162 void syncWith(Self &source);
00163
00165
00169 UInt32 getBinSize (void );
00170
00171 void copyToBin (BinaryDataHandler &pMem);
00172 void copyFromBin(BinaryDataHandler &pMem);
00173
00175
00179 void operator =(const SField &source);
00180
00182
00186 virtual void dump(void) const;
00187
00189
00190
00191 protected:
00192
00193 typedef Field Inherited;
00194
00195
00196
00197
00198 static const FieldType _fieldType;
00199
00200 FieldTypeT _value;
00201
00202 static Field *create(void);
00203
00204
00205
00206
00207
00208 private:
00209 };
00210
00211 OSG_END_NAMESPACE
00212
00213 #include <OSGSField.inl>
00214
00215 #define OSGSFIELD_HEADER_CVSID "@(#)$Id: $"
00216
00217 #endif
00218