1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2008 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGANYFIELDS_H_
40 #define _OSGANYFIELDS_H_
42 #include "OSGBaseDef.h"
43 #include "OSGBaseTypes.h"
44 #include "OSGFieldTraits.h"
45 #include "OSGSField.h"
46 #include "OSGMField.h"
52 /*! \ingroup GrpBaseBaseBaseTypes
53 \ingroup GrpLibOSGBase
59 bool operator ==(const OSGAny
&) const
66 /*! \ingroup GrpBaseFieldTraits
67 \ingroup GrpLibOSGBase
71 struct FieldTraits
<OSGAny
> : public FieldTraitsTemplateBase
<OSGAny
>
75 static DataType _type
;
79 typedef FieldTraits
<OSGAny
> Self
;
81 enum { Convertible
= Self::NotConvertible
};
83 static OSG_BASE_DLLMAPPING
84 DataType
&getType (void);
86 static const Char8
*getSName (void) { return "SFAny"; }
88 static const Char8
*getMName (void) { return "MFAny"; }
90 static OSGAny
getDefault (void) { return OSGAny(); }
93 static SizeT
getBinSize (const OSGAny
&oObject
)
98 static SizeT
getBinSize (const OSGAny
*pObjectStore
,
103 for(SizeT i
= 0; i
< uiNumObjects
; ++i
)
105 size
+= getBinSize(pObjectStore
[i
]);
112 static void copyToBin( BinaryDataHandler
&pMem
,
113 const OSGAny
&oObject
)
117 pMem
.putValue(uiTmp
);
120 static void copyToBin( BinaryDataHandler
&pMem
,
121 const OSGAny
*pObjectStore
,
124 for(SizeT i
= 0; i
< uiNumObjects
; ++i
)
126 copyToBin(pMem
, pObjectStore
[i
]);
130 static void copyFromBin(BinaryDataHandler
&pMem
,
135 pMem
.getValue(uiTmp
);
138 static void copyFromBin(BinaryDataHandler
&pMem
,
139 OSGAny
*pObjectStore
,
142 for(SizeT i
= 0; i
< uiNumObjects
; ++i
)
144 copyFromBin(pMem
, pObjectStore
[i
]);
149 #ifndef DOXYGEN_SHOULD_SKIP_THIS
151 /*! \ingroup GrpBaseFieldSingle */
152 typedef SField
<OSGAny
> SFOSGAny
;
153 /*! \ingroup GrpBaseFieldMulti */
154 typedef MField
<OSGAny
> MFOSGAny
;
156 #else // these are the doxygen hacks
158 /*! \ingroup GrpBaseFieldSingle \ingroup GrpLibOSGBase */
159 struct SFOSGAny
: public SField
<OSGAny
> {};
160 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
161 struct MFOSGAny
: public MField
<OSGAny
> {};
163 #endif // these are the doxygen hacks