1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 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 _OSGSYSMFIELDS_H_
40 #define _OSGSYSMFIELDS_H_
45 #include "OSGMField.h"
46 #include "OSGSysFieldTraits.h"
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
52 /*! \ingroup GrpBaseFieldMulti
53 \warning the getValue and operator[] functions may not return what
54 you expect them to return. Descent STL implementation will
55 certainly not return 'bool &' nor 'const bool &'.
58 typedef MField
<bool, 2> MFBool
;
60 #if defined(OSG_NEED_BOOL_MFIELD_SPEZ)
62 void MField
<bool, 2>::syncWith(Self
&source
,
63 ConstFieldMaskArg syncMode
,
65 AspectOffsetStore
&oOffsets
)
70 SizeT MField
<bool, 2>::getBinSize(void) const
72 return sizeof(UInt32
) + // num elements
73 sizeof(UInt8
) * _values
.size();
77 void MField
<bool, 2>::copyToBin(BinaryDataHandler
&pMem
) const
79 UInt32 n
= UInt32(_values
.size());
83 for(UInt32 i
= 0; i
< n
; ++i
)
85 UInt8 bval
= _values
[i
];
92 void MField
<bool, 2>::copyFromBin(BinaryDataHandler
&pMem
)
102 _values
.resize(n
, tmpVal
);
109 for(UInt32 i
= 0; i
< n
; ++i
)
111 pMem
.getValue(tmpBVal
);
113 _values
[i
] = (tmpBVal
!= 0);
119 /*! \ingroup GrpBaseFieldMulti */
120 typedef MField
<Int8
> MFInt8
;
123 /*! \ingroup GrpBaseFieldMulti */
124 typedef MField
<UInt8
> MFUInt8
;
127 /*! \ingroup GrpBaseFieldMulti */
128 typedef MField
<Int16
> MFInt16
;
131 /*! \ingroup GrpBaseFieldMulti */
132 typedef MField
<UInt16
> MFUInt16
;
135 /*! \ingroup GrpBaseFieldMulti */
136 typedef MField
<Int32
> MFInt32
;
139 /*! \ingroup GrpBaseFieldMulti */
140 typedef MField
<UInt32
> MFUInt32
;
143 /*! \ingroup GrpBaseFieldMulti */
144 typedef MField
<Int64
> MFInt64
;
147 /*! \ingroup GrpBaseFieldMulti */
148 typedef MField
<UInt64
> MFUInt64
;
151 /*! \ingroup GrpBaseFieldMulti */
152 typedef MField
<Real16
> MFReal16
;
155 /*! \ingroup GrpBaseFieldMulti */
156 typedef MField
<Real32
> MFReal32
;
159 /*! \ingroup GrpBaseFieldMulti */
160 typedef MField
<Fixed32
> MFFixed32
;
163 /*! \ingroup GrpBaseFieldMulti */
164 typedef MField
<Real64
> MFReal64
;
167 /*! \ingroup GrpBaseFieldMulti */
168 typedef MField
<void *> MFVoidP
;
170 #else // these are the doxygen hacks
172 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase
173 \warning the getValue and operator[] functions may not return what
174 you expect them to return. Descent STL implementation will
175 certainly not return 'bool &' nor 'const bool &'.
177 struct MFBool
: public MField
<bool, 2> {};
178 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
179 struct MFInt8
: public MField
<Int8
> {};
180 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
181 struct MFUInt8
: public MField
<UInt8
> {};
182 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
183 struct MFInt16
: public MField
<Int16
> {};
184 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
185 struct MFUInt16
: public MField
<UInt16
> {};
186 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
187 struct MFInt32
: public MField
<Int32
> {};
188 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
189 struct MFUInt32
: public MField
<UInt32
> {};
190 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
191 struct MFInt64
: public MField
<Int64
> {};
192 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
193 struct MFUInt64
: public MField
<UInt64
> {};
194 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
195 struct MFReal16
: public MField
<Real16
> {};
196 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
197 struct MFReal32
: public MField
<Real32
> {};
198 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
199 struct MFFixed32
: public MField
<Fixed32
> {};
200 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
201 struct MFReal64
: public MField
<Real64
> {};
202 /*! \ingroup GrpBaseFieldMulti \ingroup GrpLibOSGBase */
203 struct MFVoidP
: public MField
<void *> {};
205 #endif // these are the doxygen hacks
209 #endif /* _OSGSYSMFIELDS_H_ */