fixed: gcc8 compile issues
[opensg.git] / Source / Contrib / ComplexSceneManager / VRMLNodes / OSGLimitedCounters.h
blob6455b5febd11c37812d318fc0efbe306a561cfba
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 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 _OSGLIMITEDCOUNTERS_H_
40 #define _OSGLIMITEDCOUNTERS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
46 #include "OSGConfig.h"
47 #include "OSGContribCSMDef.h"
49 #include "OSGCounters.h" // Parent
51 #include "OSGSysFields.h" // Loop type
53 OSG_BEGIN_NAMESPACE
56 //! \brief LimitedReal32Counter Base Class.
58 template<class Desc>
59 class LimitedCounterImpl : public CounterImpl<typename Desc::BaseCounterDesc>
61 public:
63 typedef CounterImpl<typename Desc::BaseCounterDesc> Inherited;
64 typedef CounterImpl<typename Desc::BaseCounterDesc> ParentContainer;
65 typedef LimitedCounterImpl Self;
67 typedef typename Inherited::TypeObject TypeObject;
68 typedef typename TypeObject::InitPhase InitPhase;
70 OSG_GEN_INTERNALPTR(Self);
72 /*========================== PUBLIC =================================*/
74 public:
76 enum
78 UpperLimitFieldId = Inherited::NextFieldId,
79 LowerLimitFieldId = UpperLimitFieldId + 1,
80 LoopFieldId = LowerLimitFieldId + 1,
81 NextFieldId = LoopFieldId + 1
84 static const OSG::BitVector UpperLimitFieldMask =
85 (TypeTraits<BitVector>::One << UpperLimitFieldId);
87 static const OSG::BitVector LowerLimitFieldMask =
88 (TypeTraits<BitVector>::One << LowerLimitFieldId);
90 static const OSG::BitVector LoopFieldMask =
91 (TypeTraits<BitVector>::One << LoopFieldId);
93 static const OSG::BitVector NextFieldMask =
94 (TypeTraits<BitVector>::One << NextFieldId);
96 typedef typename Desc::SFLimitType SFLimitType;
97 typedef typename Desc::SFLimitType SFUpperLimitType;
98 typedef typename Desc::SFLimitType SFLowerLimitType;
100 typedef SFBool SFLoopType;
102 typedef typename SFLimitType::StoredType LimitType;
104 /*---------------------------------------------------------------------*/
105 /*! \name Class Get */
106 /*! \{ */
108 static FieldContainerType &getClassType (void);
109 static UInt32 getClassTypeId (void);
110 static UInt16 getClassGroupId(void);
111 static const Char8 *getClassname (void);
113 /*! \} */
114 /*---------------------------------------------------------------------*/
115 /*! \name FieldContainer Get */
116 /*! \{ */
118 virtual FieldContainerType &getType (void);
119 virtual const FieldContainerType &getType (void) const;
121 virtual UInt32 getContainerSize(void) const;
123 /*! \} */
124 /*---------------------------------------------------------------------*/
125 /*! \name Field Get */
126 /*! \{ */
129 SFLimitType *editSFUpperLimit (void);
130 const SFLimitType *getSFUpperLimit (void) const;
132 SFLimitType *editSFLowerLimit (void);
133 const SFLimitType *getSFLowerLimit (void) const;
135 SFBool *editSFLoop (void);
136 const SFBool *getSFLoop (void) const;
139 LimitType &editUpperLimit (void);
140 LimitType getUpperLimit (void) const;
142 LimitType &editLowerLimit (void);
143 LimitType getLowerLimit (void) const;
145 bool &editLoop (void);
146 bool getLoop (void) const;
148 /*! \} */
149 /*---------------------------------------------------------------------*/
150 /*! \name Field Set */
151 /*! \{ */
153 void setUpperLimit (const LimitType value);
154 void setLowerLimit (const LimitType value);
155 void setLoop (const bool value);
157 /*! \} */
158 /*---------------------------------------------------------------------*/
159 /*! \name Ptr MField Set */
160 /*! \{ */
162 virtual void changed(ConstFieldMaskArg whichField,
163 UInt32 origin,
164 BitVector details );
166 /*! \} */
167 /*---------------------------------------------------------------------*/
168 /*! \name Binary Access */
169 /*! \{ */
171 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
172 virtual void copyToBin (BinaryDataHandler &pMem,
173 ConstFieldMaskArg whichField);
174 virtual void copyFromBin(BinaryDataHandler &pMem,
175 ConstFieldMaskArg whichField);
178 /*! \} */
179 /*---------------------------------------------------------------------*/
180 /*! \name Construction */
181 /*! \{ */
183 static ObjTransitPtr create (void);
184 static Self *createEmpty (void);
186 static ObjTransitPtr createLocal (BitVector bFlags = FCLocal::All);
187 static ObjTransitPtr createDependent (BitVector bFlags );
189 static Self *createEmptyLocal(BitVector bFlags = FCLocal::All);
191 /*! \} */
192 /*---------------------------------------------------------------------*/
193 /*! \name Copy */
194 /*! \{ */
196 virtual FieldContainerTransitPtr shallowCopy (void) const;
197 virtual FieldContainerTransitPtr shallowCopyLocal(
198 BitVector bFlags = FCLocal::All) const;
199 virtual FieldContainerTransitPtr shallowCopyDependent(
200 BitVector bFlags ) const;
202 /*! \} */
203 /*========================= PROTECTED ===============================*/
205 protected:
207 static TypeObject _type;
209 static void classDescInserter(TypeObject &oType);
211 /*---------------------------------------------------------------------*/
212 /*! \name Fields */
213 /*! \{ */
215 SFLimitType _sfUpperLimit;
216 SFLimitType _sfLowerLimit;
217 SFBool _sfLoop;
219 /*! \} */
220 /*---------------------------------------------------------------------*/
221 /*! \name Constructors */
222 /*! \{ */
224 LimitedCounterImpl(void);
225 LimitedCounterImpl(const LimitedCounterImpl &source);
227 /*! \} */
228 /*---------------------------------------------------------------------*/
229 /*! \name Destructors */
230 /*! \{ */
232 virtual ~LimitedCounterImpl(void);
234 /*! \} */
235 /*---------------------------------------------------------------------*/
236 /*! \name onCreate */
237 /*! \{ */
240 /*! \} */
241 /*---------------------------------------------------------------------*/
242 /*! \name Generic Field Access */
243 /*! \{ */
245 GetFieldHandlePtr getHandleUpperLimit (void) const;
246 EditFieldHandlePtr editHandleUpperLimit (void);
247 GetFieldHandlePtr getHandleLowerLimit (void) const;
248 EditFieldHandlePtr editHandleLowerLimit (void);
249 GetFieldHandlePtr getHandleLoop (void) const;
250 EditFieldHandlePtr editHandleLoop (void);
252 /*! \} */
253 /*---------------------------------------------------------------------*/
254 /*! \name Sync */
255 /*! \{ */
257 #ifdef OSG_MT_CPTR_ASPECT
258 virtual void execSyncV( FieldContainer &oFrom,
259 ConstFieldMaskArg whichField,
260 AspectOffsetStore &oOffsets,
261 ConstFieldMaskArg syncMode ,
262 const UInt32 uiSyncInfo);
264 void execSync ( Self *pFrom,
265 ConstFieldMaskArg whichField,
266 AspectOffsetStore &oOffsets,
267 ConstFieldMaskArg syncMode ,
268 const UInt32 uiSyncInfo);
269 #endif
271 /*! \} */
272 /*---------------------------------------------------------------------*/
273 /*! \name Edit */
274 /*! \{ */
276 /*! \} */
277 /*---------------------------------------------------------------------*/
278 /*! \name Aspect Create */
279 /*! \{ */
281 #ifdef OSG_MT_CPTR_ASPECT
282 virtual FieldContainer *createAspectCopy(
283 const FieldContainer *pRefAspect) const;
284 #endif
286 /*! \} */
287 /*---------------------------------------------------------------------*/
288 /*! \name Edit */
289 /*! \{ */
290 /*! \} */
291 /*---------------------------------------------------------------------*/
292 /*! \name Sync */
293 /*! \{ */
295 virtual void resolveLinks(void);
297 /*! \} */
298 /*---------------------------------------------------------------------*/
299 /*! \name Init */
300 /*! \{ */
302 static void initMethod(InitPhase ePhase);
304 /*! \} */
305 /*! \} */
306 /*========================== PRIVATE ================================*/
308 private:
310 friend class FieldContainer;
312 /*---------------------------------------------------------------------*/
314 // prohibit default functions (move to 'public' if you need one)
315 void operator =(const LimitedCounterImpl &source);
318 struct LimitedInt32CounterDesc
320 typedef Int32CounterDesc BaseCounterDesc;
321 typedef Int32CounterDesc::SFValueType SFLimitType;
323 static const Char8 *getClassname(void)
325 return "LimitedInt32Counter";
329 struct LimitedUInt32CounterDesc
331 typedef UInt32CounterDesc BaseCounterDesc;
332 typedef UInt32CounterDesc::SFValueType SFLimitType;
334 static const Char8 *getClassname(void)
336 return "LimitedUInt32Counter";
340 struct LimitedReal32CounterDesc
342 typedef Real32CounterDesc BaseCounterDesc;
343 typedef Real32CounterDesc::SFValueType SFLimitType;
345 static const Char8 *getClassname(void)
347 return "LimitedReal32Counter";
351 typedef LimitedCounterImpl<LimitedInt32CounterDesc > LimitedInt32Counter;
352 typedef LimitedCounterImpl<LimitedUInt32CounterDesc> LimitedUInt32Counter;
353 typedef LimitedCounterImpl<LimitedReal32CounterDesc> LimitedReal32Counter;
355 OSG_END_NAMESPACE
357 #include "OSGLimitedCounters.inl"
359 #endif /* _OSGLIMITEDCOUNTERS_H_ */