osg::FieldDataTraits< void * > Struct Template Reference
[Field Data Traits]

#include <OSGSysFieldDataType.h>

Inheritance diagram for osg::FieldDataTraits< void * >:
osg::FieldTraitsRecurseBase< void * > osg::FieldTraits

List of all members.

Public Types

enum  { StringConvertable = 0x00 }
typedef FieldDataTraits< void * > Self
typedef void * ArgumentType
typedef void * FieldTypeT
enum  
enum  { ToStringConvertable = 0x01, FromStringConvertable = 0x02 }

Static Public Member Functions

static DataTypegetType (void)
static const Char8getSName (void)
static const Char8getMName (void)
static void * getDefault (void)
static bool getFromString (FieldTypeT &voidP, const Char8 *inStr)
static void putToString (const FieldTypeT &voidP, std::string &outStr)
static UInt32 getBinSize (const void *&oObject)
static UInt32 getBinSize (const void **pObjectStore, UInt32 uiNumObjects)
static void copyToBin (BinaryDataHandler &pMem, const void *&oObject)
static void copyToBin (BinaryDataHandler &pMem, const void **pObjectStore, UInt32 uiNumObjects)
static void copyFromBin (BinaryDataHandler &pMem, void *&oObject)
static void copyFromBin (BinaryDataHandler &pMem, void **pObjectStore, UInt32 uiNumObjects)
static bool getFromString (void *&outVal, const Char8 *inVal)
static void putToString (const void *&inVal, std::string &outStr)
static const Char8getPName (void)

Static Public Attributes

static DataType _type
static const UInt32 uiTest

Detailed Description

template<>
struct osg::FieldDataTraits< void * >

Definition at line 668 of file OSGSysFieldDataType.h.


Member Typedef Documentation

typedef FieldDataTraits<void *> osg::FieldDataTraits< void * >::Self

Definition at line 672 of file OSGSysFieldDataType.h.

typedef void* osg::FieldDataTraits< void * >::ArgumentType

Reimplemented from osg::FieldTraitsRecurseBase< void * >.

Definition at line 673 of file OSGSysFieldDataType.h.

typedef void* osg::FieldDataTraits< void * >::FieldTypeT

Definition at line 674 of file OSGSysFieldDataType.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
StringConvertable 

Definition at line 676 of file OSGSysFieldDataType.h.

00676 { StringConvertable = 0x00                        };

anonymous enum [inherited]

Definition at line 114 of file OSGFieldDataType.h.

00114 { bHasParent = 0x00 };

anonymous enum [inherited]
Enumerator:
ToStringConvertable 
FromStringConvertable 

Definition at line 69 of file OSGFieldDataType.h.

00070     {
00071         ToStringConvertable   = 0x01,
00072         FromStringConvertable = 0x02
00073     };


Member Function Documentation

static DataType& osg::FieldDataTraits< void * >::getType ( void   )  [inline, static]

Definition at line 678 of file OSGSysFieldDataType.h.

00678 { return _type;               }

static const Char8* osg::FieldDataTraits< void * >::getSName ( void   )  [inline, static]

Definition at line 680 of file OSGSysFieldDataType.h.

00680 { return "SFVoidP";           }

static const Char8* osg::FieldDataTraits< void * >::getMName ( void   )  [inline, static]

Definition at line 681 of file OSGSysFieldDataType.h.

00681 { return "MFVoidP";           }

static void* osg::FieldDataTraits< void * >::getDefault ( void   )  [inline, static]

Definition at line 683 of file OSGSysFieldDataType.h.

00683 { return NULL;                }

static bool osg::FieldDataTraits< void * >::getFromString ( FieldTypeT voidP,
const Char8 inStr 
) [inline, static]

Definition at line 685 of file OSGSysFieldDataType.h.

References FWARNING.

00687     {
00688         if(inStr[0] == '0' && tolower(inStr[1]) == 'x')
00689         {
00690             if(sscanf(inStr + 2, "%p", &voidP) != 1)
00691             {
00692                 voidP = NULL;
00693                 FWARNING(("FieldDataTraits<void *>::getFromString: '%s' "
00694                           "not understood!\n", inStr));
00695                 return false;
00696             }
00697         }
00698         else
00699         {
00700             if(sscanf(inStr, "%lu", 
00701                         reinterpret_cast<unsigned long *>(&voidP)) != 1)
00702             {
00703                 voidP = NULL;
00704                 FWARNING(("FieldDataTraits<void *>::getFromString: '%s' "
00705                           "not understood!\n", inStr));
00706                 return false;
00707             }
00708         }
00709 
00710         return true;
00711     }

static void osg::FieldDataTraits< void * >::putToString ( const FieldTypeT voidP,
std::string &  outStr 
) [inline, static]

Definition at line 713 of file OSGSysFieldDataType.h.

00715     {
00716         char buf[32];
00717         sprintf(buf, "%p", voidP);
00718         outStr = buf;
00719     }

static UInt32 osg::FieldTraitsRecurseBase< void * >::getBinSize ( const void * &  oObject  )  [inline, static, inherited]

Definition at line 130 of file OSGFieldDataType.h.

00131     {
00132         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00133 
00134         std::string value;
00135 
00136         MappedTrait::putToString(oObject, value);
00137 
00138         return value.length() + 1 + sizeof(UInt32);
00139     }

static UInt32 osg::FieldTraitsRecurseBase< void * >::getBinSize ( const void * *  pObjectStore,
UInt32  uiNumObjects 
) [inline, static, inherited]

Definition at line 141 of file OSGFieldDataType.h.

00143     {
00144         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00145 
00146         UInt32 size = 0;
00147 
00148         for(UInt32 i = 0; i < uiNumObjects; ++i)
00149         {
00150             size += MappedTrait::getBinSize(pObjectStore[i]);
00151         }
00152 
00153         return size;
00154     }

static void osg::FieldTraitsRecurseBase< void * >::copyToBin ( BinaryDataHandler pMem,
const void * &  oObject 
) [inline, static, inherited]

Definition at line 156 of file OSGFieldDataType.h.

00158     {
00159         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00160         
00161         std::string value;
00162 
00163         MappedTrait::putToString(oObject, value);
00164 
00165         pMem.putValue(value);
00166     }

static void osg::FieldTraitsRecurseBase< void * >::copyToBin ( BinaryDataHandler pMem,
const void * *  pObjectStore,
UInt32  uiNumObjects 
) [inline, static, inherited]

Definition at line 169 of file OSGFieldDataType.h.

00172     {
00173         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00174 
00175         // defaut: copy each element
00176         for(UInt32 i = 0; i < uiNumObjects; ++i)
00177         {
00178             MappedTrait::copyToBin(pMem, pObjectStore[i]);
00179         }
00180     }

static void osg::FieldTraitsRecurseBase< void * >::copyFromBin ( BinaryDataHandler pMem,
void * &  oObject 
) [inline, static, inherited]

Definition at line 182 of file OSGFieldDataType.h.

00184     {
00185         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00186 
00187         const Char8 *c = NULL;
00188 
00189         std::string value;
00190 
00191         pMem.getValue(value);
00192         c = value.c_str();
00193         MappedTrait::getFromString(oObject, c);
00194     }

static void osg::FieldTraitsRecurseBase< void * >::copyFromBin ( BinaryDataHandler pMem,
void * *  pObjectStore,
UInt32  uiNumObjects 
) [inline, static, inherited]

Definition at line 196 of file OSGFieldDataType.h.

00199     {
00200         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00201 
00202         // defaut: copy each element
00203         for(UInt32 i = 0; i < uiNumObjects; ++i)
00204         {
00205             MappedTrait::copyFromBin(pMem, pObjectStore[i]);
00206         }
00207     }

static bool osg::FieldTraitsRecurseBase< void * >::getFromString ( void * &  outVal,
const Char8 *  inVal 
) [inline, static, inherited]

Definition at line 209 of file OSGFieldDataType.h.

00211     {
00212         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00213 
00214         return MappedTrait::getFromString(outVal, inVal);
00215     }

static void osg::FieldTraitsRecurseBase< void * >::putToString ( const void * &  inVal,
std::string &  outStr 
) [inline, static, inherited]

Definition at line 217 of file OSGFieldDataType.h.

00219     {
00220         typedef FieldDataTraits<FieldTypeT> MappedTrait;
00221 
00222         MappedTrait::putToString(inVal, outStr);
00223     }

static const Char8* osg::FieldTraits::getPName ( void   )  [inline, static, inherited]

Definition at line 75 of file OSGFieldDataType.h.

00075 { return "Field"; }


Member Data Documentation

DataType osg::FieldDataTraits< void * >::_type [static]

Definition at line 671 of file OSGSysFieldDataType.h.

const UInt32 osg::FieldTraitsRecurseBase< void * >::uiTest [static, inherited]

Definition at line 117 of file OSGFieldDataType.h.


The documentation for this struct was generated from the following files:

Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1