added: travMask to csm viewport
[opensg.git] / Source / Base / Field / OSGSysMFields.h
blob058a8e1339ceb2b75f9bafa8b911cc50e6d90e52
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGSYSMFIELDS_H_
40 #define _OSGSYSMFIELDS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGMField.h"
46 #include "OSGSysFieldTraits.h"
48 OSG_BEGIN_NAMESPACE
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)
61 template <> inline
62 void MField<bool, 2>::syncWith(Self &source,
63 ConstFieldMaskArg syncMode,
64 UInt32 uiSyncInfo,
65 AspectOffsetStore &oOffsets )
69 template <> inline
70 SizeT MField<bool, 2>::getBinSize(void) const
72 return sizeof(UInt32) + // num elements
73 sizeof(UInt8) * _values.size();
76 template <> inline
77 void MField<bool, 2>::copyToBin(BinaryDataHandler &pMem) const
79 UInt32 n = UInt32(_values.size());
81 pMem.putValue(n);
83 for(UInt32 i = 0; i < n; ++i)
85 UInt8 bval = _values[i];
87 pMem.putValue(bval);
91 template <> inline
92 void MField<bool, 2>::copyFromBin(BinaryDataHandler &pMem)
94 UInt32 n;
96 pMem .getValue(n);
97 _values.clear ( );
99 #ifdef __hpux
100 bool tmpVal;
102 _values.resize(n, tmpVal);
103 #else
104 _values.resize(n);
105 #endif
107 UInt8 tmpBVal;
109 for(UInt32 i = 0; i < n; ++i)
111 pMem.getValue(tmpBVal);
113 _values[i] = (tmpBVal != 0);
116 #endif
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
207 OSG_END_NAMESPACE
209 #endif /* _OSGSYSMFIELDS_H_ */