1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 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 _OSGLIMITEDCOUNTERS_H_
40 #define _OSGLIMITEDCOUNTERS_H_
46 #include "OSGConfig.h"
47 #include "OSGContribCSMDef.h"
49 #include "OSGCounters.h" // Parent
51 #include "OSGSysFields.h" // Loop type
56 //! \brief LimitedReal32Counter Base Class.
59 class LimitedCounterImpl
: public CounterImpl
<typename
Desc::BaseCounterDesc
>
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 =================================*/
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 */
108 static FieldContainerType
&getClassType (void);
109 static UInt32
getClassTypeId (void);
110 static UInt16
getClassGroupId(void);
111 static const Char8
*getClassname (void);
114 /*---------------------------------------------------------------------*/
115 /*! \name FieldContainer Get */
118 virtual FieldContainerType
&getType (void);
119 virtual const FieldContainerType
&getType (void) const;
121 virtual UInt32
getContainerSize(void) const;
124 /*---------------------------------------------------------------------*/
125 /*! \name Field Get */
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;
149 /*---------------------------------------------------------------------*/
150 /*! \name Field Set */
153 void setUpperLimit (const LimitType value
);
154 void setLowerLimit (const LimitType value
);
155 void setLoop (const bool value
);
158 /*---------------------------------------------------------------------*/
159 /*! \name Ptr MField Set */
162 virtual void changed(ConstFieldMaskArg whichField
,
167 /*---------------------------------------------------------------------*/
168 /*! \name Binary Access */
171 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
172 virtual void copyToBin (BinaryDataHandler
&pMem
,
173 ConstFieldMaskArg whichField
);
174 virtual void copyFromBin(BinaryDataHandler
&pMem
,
175 ConstFieldMaskArg whichField
);
179 /*---------------------------------------------------------------------*/
180 /*! \name Construction */
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
);
192 /*---------------------------------------------------------------------*/
196 virtual FieldContainerTransitPtr
shallowCopy (void) const;
197 virtual FieldContainerTransitPtr
shallowCopyLocal(
198 BitVector bFlags
= FCLocal::All
) const;
199 virtual FieldContainerTransitPtr
shallowCopyDependent(
200 BitVector bFlags
) const;
203 /*========================= PROTECTED ===============================*/
207 static TypeObject _type
;
209 static void classDescInserter(TypeObject
&oType
);
211 /*---------------------------------------------------------------------*/
215 SFLimitType _sfUpperLimit
;
216 SFLimitType _sfLowerLimit
;
220 /*---------------------------------------------------------------------*/
221 /*! \name Constructors */
224 LimitedCounterImpl(void);
225 LimitedCounterImpl(const LimitedCounterImpl
&source
);
228 /*---------------------------------------------------------------------*/
229 /*! \name Destructors */
232 virtual ~LimitedCounterImpl(void);
235 /*---------------------------------------------------------------------*/
236 /*! \name onCreate */
241 /*---------------------------------------------------------------------*/
242 /*! \name Generic Field Access */
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);
253 /*---------------------------------------------------------------------*/
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
);
272 /*---------------------------------------------------------------------*/
277 /*---------------------------------------------------------------------*/
278 /*! \name Aspect Create */
281 #ifdef OSG_MT_CPTR_ASPECT
282 virtual FieldContainer
*createAspectCopy(
283 const FieldContainer
*pRefAspect
) const;
287 /*---------------------------------------------------------------------*/
291 /*---------------------------------------------------------------------*/
295 virtual void resolveLinks(void);
298 /*---------------------------------------------------------------------*/
302 static void initMethod(InitPhase ePhase
);
306 /*========================== 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
;
357 #include "OSGLimitedCounters.inl"
359 #endif /* _OSGLIMITEDCOUNTERS_H_ */