OSGSField.h
Go to the documentation of this file.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 "OSGField.h"
00046 #include "OSGFieldTraits.h"
00047 #include "OSGFieldType.h"
00048 #include "OSGFieldHandle.h"
00049
00050 #include <boost/shared_ptr.hpp>
00051
00052 OSG_BEGIN_NAMESPACE
00053
00054 #ifdef OSG_DOC_FILES_IN_MODULE
00055
00059 #endif
00060
00066 template<class ValueT, Int32 iNamespace = 0>
00067 class SField : public Field
00068 {
00069
00070
00071 public:
00072
00073 typedef FieldTraits <ValueT, iNamespace> SFieldTraits;
00074 typedef SField <ValueT, iNamespace> Self;
00075
00076 typedef ValueT StoredType;
00077 typedef ValueT &reference;
00078 typedef const ValueT &const_reference;
00079
00080 typedef typename SFieldTraits::ArgumentType ArgumentType;
00081
00082 typedef FieldDescription<SFieldTraits,
00083 SingleField > Description;
00084
00085 typedef EditSFieldHandle <Self > EditHandle;
00086 typedef boost::shared_ptr<EditHandle> EditHandlePtr;
00087
00088
00089 typedef GetSFieldHandle <Self > GetHandle;
00090 typedef boost::shared_ptr<GetHandle> GetHandlePtr;
00091
00092
00093
00094 static const Int32 Namespace = iNamespace;
00095
00096 static const bool isSField = true;
00097 static const bool isMField = false;
00098
00099 static const bool isPointerField = false;
00100
00101
00105 static const FieldType &getClassType(void);
00106
00108
00112 SField(void );
00113 SField(const SField &obj );
00114 explicit SField( ArgumentType value);
00115
00117
00121 ~SField(void);
00122
00124
00128 reference getValue(void);
00129 const_reference getValue(void) const;
00130
00132
00136 void setValue ( ArgumentType value);
00137 void setValue (const Self &obj );
00138
00139 void setValueFromCString(const Char8 *str );
00140
00142
00146 void pushValueToString (std::string &str) const;
00147 void pushValueFromStream(std::istream &str);
00148 void pushValueToStream (OutStream &str) const;
00149 void pushSizeToStream (OutStream &str) const;
00150
00152
00156 UInt32 getBinSize (void ) const;
00157
00158 void copyToBin (BinaryDataHandler &pMem) const;
00159 void copyFromBin(BinaryDataHandler &pMem);
00160
00162
00166 #ifdef OSG_MT_CPTR_ASPECT
00167 void syncWith(Self &source);
00168 #endif
00169
00171
00175 bool operator ==(const SField &source) const;
00176
00178
00182 void operator =(const SField &source);
00183
00185
00186
00187 protected:
00188
00189
00193 typedef Field Inherited;
00194
00196
00200 static FieldType _fieldType;
00201
00202 ValueT _fieldValue;
00203
00204 #if defined(OSG_TMPL_STATIC_MEMBER_NEEDS_HELPER_FCT)
00205 const FieldType &fieldTypeExportHelper(void);
00206 #endif
00207
00209
00210
00211 private:
00212 };
00213
00214 OSG_END_NAMESPACE
00215
00216 #include "OSGSField.inl"
00217
00218 #endif