fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Dynamics / Animation / OSGTimeSensorBase.cpp
blobaa47b3c4f258aac9928f9c3548a85c68666cf064
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class TimeSensor!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGTimeSensorBase.h"
67 #include "OSGTimeSensor.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::TimeSensor
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var bool TimeSensorBase::_sfEnabled
89 /*! \var bool TimeSensorBase::_sfIsActive
93 /*! \var bool TimeSensorBase::_sfLoop
97 /*! \var Real32 TimeSensorBase::_sfFraction
101 /*! \var Time TimeSensorBase::_sfStartTime
105 /*! \var Time TimeSensorBase::_sfStopTime
109 /*! \var Time TimeSensorBase::_sfCycleTime
113 /*! \var Time TimeSensorBase::_sfTime
117 /*! \var Time TimeSensorBase::_sfCycleInterval
121 /*! \var Time TimeSensorBase::_sfChangeFractionBy
126 /***************************************************************************\
127 * FieldType/FieldTrait Instantiation *
128 \***************************************************************************/
130 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
131 PointerType FieldTraits<TimeSensor *, nsOSG>::_type(
132 "TimeSensorPtr",
133 "NodeCorePtr",
134 TimeSensor::getClassType(),
135 nsOSG);
136 #endif
138 OSG_FIELDTRAITS_GETTYPE_NS(TimeSensor *, nsOSG)
140 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
141 TimeSensor *,
142 nsOSG)
144 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
145 TimeSensor *,
146 nsOSG)
148 /***************************************************************************\
149 * Field Description *
150 \***************************************************************************/
152 void TimeSensorBase::classDescInserter(TypeObject &oType)
154 Inherited::classDescInserter(oType);
156 FieldDescriptionBase *pDesc = NULL;
159 pDesc = new SFBool::Description(
160 SFBool::getClassType(),
161 "enabled",
163 EnabledFieldId, EnabledFieldMask,
164 true,
165 (Field::FStdAccess | Field::FThreadLocal),
166 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleEnabled),
167 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleEnabled));
169 oType.addInitialDesc(pDesc);
171 pDesc = new SFBool::Description(
172 SFBool::getClassType(),
173 "isActive",
175 IsActiveFieldId, IsActiveFieldMask,
176 true,
177 (Field::FStdAccess | Field::FThreadLocal),
178 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleIsActive),
179 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleIsActive));
181 oType.addInitialDesc(pDesc);
183 pDesc = new SFBool::Description(
184 SFBool::getClassType(),
185 "loop",
187 LoopFieldId, LoopFieldMask,
188 true,
189 (Field::FStdAccess | Field::FThreadLocal),
190 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleLoop),
191 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleLoop));
193 oType.addInitialDesc(pDesc);
195 pDesc = new SFReal32::Description(
196 SFReal32::getClassType(),
197 "fraction",
199 FractionFieldId, FractionFieldMask,
200 true,
201 (Field::FStdAccess | Field::FThreadLocal),
202 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleFraction),
203 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleFraction));
205 oType.addInitialDesc(pDesc);
207 pDesc = new SFTime::Description(
208 SFTime::getClassType(),
209 "startTime",
211 StartTimeFieldId, StartTimeFieldMask,
212 true,
213 (Field::FStdAccess | Field::FThreadLocal),
214 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleStartTime),
215 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleStartTime));
217 oType.addInitialDesc(pDesc);
219 pDesc = new SFTime::Description(
220 SFTime::getClassType(),
221 "stopTime",
223 StopTimeFieldId, StopTimeFieldMask,
224 true,
225 (Field::FStdAccess | Field::FThreadLocal),
226 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleStopTime),
227 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleStopTime));
229 oType.addInitialDesc(pDesc);
231 pDesc = new SFTime::Description(
232 SFTime::getClassType(),
233 "cycleTime",
235 CycleTimeFieldId, CycleTimeFieldMask,
236 true,
237 (Field::FStdAccess | Field::FThreadLocal),
238 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleCycleTime),
239 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleCycleTime));
241 oType.addInitialDesc(pDesc);
243 pDesc = new SFTime::Description(
244 SFTime::getClassType(),
245 "time",
247 TimeFieldId, TimeFieldMask,
248 true,
249 (Field::FStdAccess | Field::FThreadLocal),
250 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleTime),
251 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleTime));
253 oType.addInitialDesc(pDesc);
255 pDesc = new SFTime::Description(
256 SFTime::getClassType(),
257 "cycleInterval",
259 CycleIntervalFieldId, CycleIntervalFieldMask,
260 true,
261 (Field::FStdAccess | Field::FThreadLocal),
262 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleCycleInterval),
263 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleCycleInterval));
265 oType.addInitialDesc(pDesc);
267 pDesc = new SFTime::Description(
268 SFTime::getClassType(),
269 "changeFractionBy",
271 ChangeFractionByFieldId, ChangeFractionByFieldMask,
272 true,
273 (Field::FStdAccess | Field::FThreadLocal),
274 static_cast<FieldEditMethodSig>(&TimeSensor::editHandleChangeFractionBy),
275 static_cast<FieldGetMethodSig >(&TimeSensor::getHandleChangeFractionBy));
277 oType.addInitialDesc(pDesc);
281 TimeSensorBase::TypeObject TimeSensorBase::_type(
282 TimeSensorBase::getClassname(),
283 Inherited::getClassname(),
284 "NULL",
285 nsOSG, //Namespace
286 reinterpret_cast<PrototypeCreateF>(&TimeSensorBase::createEmptyLocal),
287 reinterpret_cast<InitContainerF>(&TimeSensor::initMethod),
288 reinterpret_cast<ExitContainerF>(&TimeSensor::exitMethod),
289 reinterpret_cast<InitalInsertDescFunc>(
290 reinterpret_cast<void *>(&TimeSensor::classDescInserter)),
291 false,
293 "<?xml version=\"1.0\"?>\n"
294 "\n"
295 "<FieldContainer\n"
296 " name=\"TimeSensor\"\n"
297 " parent=\"NodeCore\"\n"
298 " mixinparent=\"NodeCoreSensorParent\"\n"
299 " library=\"Dynamics\"\n"
300 " pointerfieldtypes=\"both\"\n"
301 " structure=\"concrete\"\n"
302 " systemcomponent=\"true\"\n"
303 " parentsystemcomponent=\"true\"\n"
304 " decoratable=\"false\"\n"
305 " useLocalIncludes=\"false\"\n"
306 " isNodeCore=\"true\"\n"
307 " isBundle=\"false\"\n"
308 " parentFields=\"none\"\n"
309 " docGroupBase=\"GrpDynamicsAnimation\"\n"
310 " >\n"
311 " <Field\n"
312 " name=\"enabled\"\n"
313 " type=\"bool\"\n"
314 " cardinality=\"single\"\n"
315 " visibility=\"internal\"\n"
316 " access=\"public\"\n"
317 " defaultValue=\"true\"\n"
318 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
319 " >\n"
320 " </Field>\n"
321 " <Field\n"
322 " name=\"isActive\"\n"
323 " type=\"bool\"\n"
324 " cardinality=\"single\"\n"
325 " visibility=\"internal\"\n"
326 " access=\"public\"\n"
327 " defaultValue=\"false\"\n"
328 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
329 " >\n"
330 " </Field>\n"
331 " <Field\n"
332 " name=\"loop\"\n"
333 " type=\"bool\"\n"
334 " cardinality=\"single\"\n"
335 " visibility=\"internal\"\n"
336 " access=\"public\"\n"
337 " defaultValue=\"false\"\n"
338 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
339 " >\n"
340 " </Field>\n"
341 " <Field\n"
342 " name=\"fraction\"\n"
343 " type=\"Real32\"\n"
344 " cardinality=\"single\"\n"
345 " visibility=\"internal\"\n"
346 " access=\"public\"\n"
347 " defaultValue=\"0.0\"\n"
348 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
349 " >\n"
350 " </Field>\n"
351 " <Field\n"
352 " name=\"startTime\"\n"
353 " type=\"Time\"\n"
354 " cardinality=\"single\"\n"
355 " visibility=\"internal\"\n"
356 " access=\"public\"\n"
357 " defaultValue=\"0.0\"\n"
358 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
359 " >\n"
360 " </Field>\n"
361 " <Field\n"
362 " name=\"stopTime\"\n"
363 " type=\"Time\"\n"
364 " cardinality=\"single\"\n"
365 " visibility=\"internal\"\n"
366 " access=\"public\"\n"
367 " defaultValue=\"0.0\"\n"
368 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
369 " >\n"
370 " </Field>\n"
371 " <Field\n"
372 " name=\"cycleTime\"\n"
373 " type=\"Time\"\n"
374 " cardinality=\"single\"\n"
375 " visibility=\"internal\"\n"
376 " access=\"public\"\n"
377 " defaultValue=\"0.0\"\n"
378 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
379 " >\n"
380 " </Field>\n"
381 " <Field\n"
382 " name=\"time\"\n"
383 " type=\"Time\"\n"
384 " cardinality=\"single\"\n"
385 " visibility=\"internal\"\n"
386 " access=\"public\"\n"
387 " defaultValue=\"0.0\"\n"
388 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
389 " >\n"
390 " </Field>\n"
391 " <Field\n"
392 " name=\"cycleInterval\"\n"
393 " type=\"Time\"\n"
394 " cardinality=\"single\"\n"
395 " visibility=\"internal\"\n"
396 " access=\"public\"\n"
397 " defaultValue=\"1.0\"\n"
398 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
399 " >\n"
400 " </Field>\n"
401 " <Field\n"
402 " name=\"changeFractionBy\"\n"
403 " type=\"Time\"\n"
404 " cardinality=\"single\"\n"
405 " visibility=\"internal\"\n"
406 " access=\"public\"\n"
407 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
408 " >\n"
409 " </Field>\n"
410 "</FieldContainer>\n",
414 /*------------------------------ get -----------------------------------*/
416 FieldContainerType &TimeSensorBase::getType(void)
418 return _type;
421 const FieldContainerType &TimeSensorBase::getType(void) const
423 return _type;
426 UInt32 TimeSensorBase::getContainerSize(void) const
428 return sizeof(TimeSensor);
431 /*------------------------- decorator get ------------------------------*/
434 SFBool *TimeSensorBase::editSFEnabled(void)
436 editSField(EnabledFieldMask);
438 return &_sfEnabled;
441 const SFBool *TimeSensorBase::getSFEnabled(void) const
443 return &_sfEnabled;
447 SFBool *TimeSensorBase::editSFIsActive(void)
449 editSField(IsActiveFieldMask);
451 return &_sfIsActive;
454 const SFBool *TimeSensorBase::getSFIsActive(void) const
456 return &_sfIsActive;
460 SFBool *TimeSensorBase::editSFLoop(void)
462 editSField(LoopFieldMask);
464 return &_sfLoop;
467 const SFBool *TimeSensorBase::getSFLoop(void) const
469 return &_sfLoop;
473 SFReal32 *TimeSensorBase::editSFFraction(void)
475 editSField(FractionFieldMask);
477 return &_sfFraction;
480 const SFReal32 *TimeSensorBase::getSFFraction(void) const
482 return &_sfFraction;
486 SFTime *TimeSensorBase::editSFStartTime(void)
488 editSField(StartTimeFieldMask);
490 return &_sfStartTime;
493 const SFTime *TimeSensorBase::getSFStartTime(void) const
495 return &_sfStartTime;
499 SFTime *TimeSensorBase::editSFStopTime(void)
501 editSField(StopTimeFieldMask);
503 return &_sfStopTime;
506 const SFTime *TimeSensorBase::getSFStopTime(void) const
508 return &_sfStopTime;
512 SFTime *TimeSensorBase::editSFCycleTime(void)
514 editSField(CycleTimeFieldMask);
516 return &_sfCycleTime;
519 const SFTime *TimeSensorBase::getSFCycleTime(void) const
521 return &_sfCycleTime;
525 SFTime *TimeSensorBase::editSFTime(void)
527 editSField(TimeFieldMask);
529 return &_sfTime;
532 const SFTime *TimeSensorBase::getSFTime(void) const
534 return &_sfTime;
538 SFTime *TimeSensorBase::editSFCycleInterval(void)
540 editSField(CycleIntervalFieldMask);
542 return &_sfCycleInterval;
545 const SFTime *TimeSensorBase::getSFCycleInterval(void) const
547 return &_sfCycleInterval;
551 SFTime *TimeSensorBase::editSFChangeFractionBy(void)
553 editSField(ChangeFractionByFieldMask);
555 return &_sfChangeFractionBy;
558 const SFTime *TimeSensorBase::getSFChangeFractionBy(void) const
560 return &_sfChangeFractionBy;
568 /*------------------------------ access -----------------------------------*/
570 SizeT TimeSensorBase::getBinSize(ConstFieldMaskArg whichField)
572 SizeT returnValue = Inherited::getBinSize(whichField);
574 if(FieldBits::NoField != (EnabledFieldMask & whichField))
576 returnValue += _sfEnabled.getBinSize();
578 if(FieldBits::NoField != (IsActiveFieldMask & whichField))
580 returnValue += _sfIsActive.getBinSize();
582 if(FieldBits::NoField != (LoopFieldMask & whichField))
584 returnValue += _sfLoop.getBinSize();
586 if(FieldBits::NoField != (FractionFieldMask & whichField))
588 returnValue += _sfFraction.getBinSize();
590 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
592 returnValue += _sfStartTime.getBinSize();
594 if(FieldBits::NoField != (StopTimeFieldMask & whichField))
596 returnValue += _sfStopTime.getBinSize();
598 if(FieldBits::NoField != (CycleTimeFieldMask & whichField))
600 returnValue += _sfCycleTime.getBinSize();
602 if(FieldBits::NoField != (TimeFieldMask & whichField))
604 returnValue += _sfTime.getBinSize();
606 if(FieldBits::NoField != (CycleIntervalFieldMask & whichField))
608 returnValue += _sfCycleInterval.getBinSize();
610 if(FieldBits::NoField != (ChangeFractionByFieldMask & whichField))
612 returnValue += _sfChangeFractionBy.getBinSize();
615 return returnValue;
618 void TimeSensorBase::copyToBin(BinaryDataHandler &pMem,
619 ConstFieldMaskArg whichField)
621 Inherited::copyToBin(pMem, whichField);
623 if(FieldBits::NoField != (EnabledFieldMask & whichField))
625 _sfEnabled.copyToBin(pMem);
627 if(FieldBits::NoField != (IsActiveFieldMask & whichField))
629 _sfIsActive.copyToBin(pMem);
631 if(FieldBits::NoField != (LoopFieldMask & whichField))
633 _sfLoop.copyToBin(pMem);
635 if(FieldBits::NoField != (FractionFieldMask & whichField))
637 _sfFraction.copyToBin(pMem);
639 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
641 _sfStartTime.copyToBin(pMem);
643 if(FieldBits::NoField != (StopTimeFieldMask & whichField))
645 _sfStopTime.copyToBin(pMem);
647 if(FieldBits::NoField != (CycleTimeFieldMask & whichField))
649 _sfCycleTime.copyToBin(pMem);
651 if(FieldBits::NoField != (TimeFieldMask & whichField))
653 _sfTime.copyToBin(pMem);
655 if(FieldBits::NoField != (CycleIntervalFieldMask & whichField))
657 _sfCycleInterval.copyToBin(pMem);
659 if(FieldBits::NoField != (ChangeFractionByFieldMask & whichField))
661 _sfChangeFractionBy.copyToBin(pMem);
665 void TimeSensorBase::copyFromBin(BinaryDataHandler &pMem,
666 ConstFieldMaskArg whichField)
668 Inherited::copyFromBin(pMem, whichField);
670 if(FieldBits::NoField != (EnabledFieldMask & whichField))
672 editSField(EnabledFieldMask);
673 _sfEnabled.copyFromBin(pMem);
675 if(FieldBits::NoField != (IsActiveFieldMask & whichField))
677 editSField(IsActiveFieldMask);
678 _sfIsActive.copyFromBin(pMem);
680 if(FieldBits::NoField != (LoopFieldMask & whichField))
682 editSField(LoopFieldMask);
683 _sfLoop.copyFromBin(pMem);
685 if(FieldBits::NoField != (FractionFieldMask & whichField))
687 editSField(FractionFieldMask);
688 _sfFraction.copyFromBin(pMem);
690 if(FieldBits::NoField != (StartTimeFieldMask & whichField))
692 editSField(StartTimeFieldMask);
693 _sfStartTime.copyFromBin(pMem);
695 if(FieldBits::NoField != (StopTimeFieldMask & whichField))
697 editSField(StopTimeFieldMask);
698 _sfStopTime.copyFromBin(pMem);
700 if(FieldBits::NoField != (CycleTimeFieldMask & whichField))
702 editSField(CycleTimeFieldMask);
703 _sfCycleTime.copyFromBin(pMem);
705 if(FieldBits::NoField != (TimeFieldMask & whichField))
707 editSField(TimeFieldMask);
708 _sfTime.copyFromBin(pMem);
710 if(FieldBits::NoField != (CycleIntervalFieldMask & whichField))
712 editSField(CycleIntervalFieldMask);
713 _sfCycleInterval.copyFromBin(pMem);
715 if(FieldBits::NoField != (ChangeFractionByFieldMask & whichField))
717 editSField(ChangeFractionByFieldMask);
718 _sfChangeFractionBy.copyFromBin(pMem);
722 //! create a new instance of the class
723 TimeSensorTransitPtr TimeSensorBase::createLocal(BitVector bFlags)
725 TimeSensorTransitPtr fc;
727 if(getClassType().getPrototype() != NULL)
729 FieldContainerTransitPtr tmpPtr =
730 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
732 fc = dynamic_pointer_cast<TimeSensor>(tmpPtr);
735 return fc;
738 //! create a new instance of the class, copy the container flags
739 TimeSensorTransitPtr TimeSensorBase::createDependent(BitVector bFlags)
741 TimeSensorTransitPtr fc;
743 if(getClassType().getPrototype() != NULL)
745 FieldContainerTransitPtr tmpPtr =
746 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
748 fc = dynamic_pointer_cast<TimeSensor>(tmpPtr);
751 return fc;
754 //! create a new instance of the class
755 TimeSensorTransitPtr TimeSensorBase::create(void)
757 TimeSensorTransitPtr fc;
759 if(getClassType().getPrototype() != NULL)
761 FieldContainerTransitPtr tmpPtr =
762 getClassType().getPrototype()-> shallowCopy();
764 fc = dynamic_pointer_cast<TimeSensor>(tmpPtr);
767 return fc;
770 TimeSensor *TimeSensorBase::createEmptyLocal(BitVector bFlags)
772 TimeSensor *returnValue;
774 newPtr<TimeSensor>(returnValue, bFlags);
776 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
778 return returnValue;
781 //! create an empty new instance of the class, do not copy the prototype
782 TimeSensor *TimeSensorBase::createEmpty(void)
784 TimeSensor *returnValue;
786 newPtr<TimeSensor>(returnValue, Thread::getCurrentLocalFlags());
788 returnValue->_pFieldFlags->_bNamespaceMask &=
789 ~Thread::getCurrentLocalFlags();
791 return returnValue;
795 FieldContainerTransitPtr TimeSensorBase::shallowCopyLocal(
796 BitVector bFlags) const
798 TimeSensor *tmpPtr;
800 newPtr(tmpPtr, dynamic_cast<const TimeSensor *>(this), bFlags);
802 FieldContainerTransitPtr returnValue(tmpPtr);
804 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
806 return returnValue;
809 FieldContainerTransitPtr TimeSensorBase::shallowCopyDependent(
810 BitVector bFlags) const
812 TimeSensor *tmpPtr;
814 newPtr(tmpPtr, dynamic_cast<const TimeSensor *>(this), ~bFlags);
816 FieldContainerTransitPtr returnValue(tmpPtr);
818 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
820 return returnValue;
823 FieldContainerTransitPtr TimeSensorBase::shallowCopy(void) const
825 TimeSensor *tmpPtr;
827 newPtr(tmpPtr,
828 dynamic_cast<const TimeSensor *>(this),
829 Thread::getCurrentLocalFlags());
831 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
833 FieldContainerTransitPtr returnValue(tmpPtr);
835 return returnValue;
841 /*------------------------- constructors ----------------------------------*/
843 TimeSensorBase::TimeSensorBase(void) :
844 Inherited(),
845 _sfEnabled (bool(true)),
846 _sfIsActive (bool(false)),
847 _sfLoop (bool(false)),
848 _sfFraction (Real32(0.0)),
849 _sfStartTime (Time(0.0)),
850 _sfStopTime (Time(0.0)),
851 _sfCycleTime (Time(0.0)),
852 _sfTime (Time(0.0)),
853 _sfCycleInterval (Time(1.0)),
854 _sfChangeFractionBy ()
858 TimeSensorBase::TimeSensorBase(const TimeSensorBase &source) :
859 Inherited(source),
860 _sfEnabled (source._sfEnabled ),
861 _sfIsActive (source._sfIsActive ),
862 _sfLoop (source._sfLoop ),
863 _sfFraction (source._sfFraction ),
864 _sfStartTime (source._sfStartTime ),
865 _sfStopTime (source._sfStopTime ),
866 _sfCycleTime (source._sfCycleTime ),
867 _sfTime (source._sfTime ),
868 _sfCycleInterval (source._sfCycleInterval ),
869 _sfChangeFractionBy (source._sfChangeFractionBy )
874 /*-------------------------- destructors ----------------------------------*/
876 TimeSensorBase::~TimeSensorBase(void)
881 GetFieldHandlePtr TimeSensorBase::getHandleEnabled (void) const
883 SFBool::GetHandlePtr returnValue(
884 new SFBool::GetHandle(
885 &_sfEnabled,
886 this->getType().getFieldDesc(EnabledFieldId),
887 const_cast<TimeSensorBase *>(this)));
889 return returnValue;
892 EditFieldHandlePtr TimeSensorBase::editHandleEnabled (void)
894 SFBool::EditHandlePtr returnValue(
895 new SFBool::EditHandle(
896 &_sfEnabled,
897 this->getType().getFieldDesc(EnabledFieldId),
898 this));
901 editSField(EnabledFieldMask);
903 return returnValue;
906 GetFieldHandlePtr TimeSensorBase::getHandleIsActive (void) const
908 SFBool::GetHandlePtr returnValue(
909 new SFBool::GetHandle(
910 &_sfIsActive,
911 this->getType().getFieldDesc(IsActiveFieldId),
912 const_cast<TimeSensorBase *>(this)));
914 return returnValue;
917 EditFieldHandlePtr TimeSensorBase::editHandleIsActive (void)
919 SFBool::EditHandlePtr returnValue(
920 new SFBool::EditHandle(
921 &_sfIsActive,
922 this->getType().getFieldDesc(IsActiveFieldId),
923 this));
926 editSField(IsActiveFieldMask);
928 return returnValue;
931 GetFieldHandlePtr TimeSensorBase::getHandleLoop (void) const
933 SFBool::GetHandlePtr returnValue(
934 new SFBool::GetHandle(
935 &_sfLoop,
936 this->getType().getFieldDesc(LoopFieldId),
937 const_cast<TimeSensorBase *>(this)));
939 return returnValue;
942 EditFieldHandlePtr TimeSensorBase::editHandleLoop (void)
944 SFBool::EditHandlePtr returnValue(
945 new SFBool::EditHandle(
946 &_sfLoop,
947 this->getType().getFieldDesc(LoopFieldId),
948 this));
951 editSField(LoopFieldMask);
953 return returnValue;
956 GetFieldHandlePtr TimeSensorBase::getHandleFraction (void) const
958 SFReal32::GetHandlePtr returnValue(
959 new SFReal32::GetHandle(
960 &_sfFraction,
961 this->getType().getFieldDesc(FractionFieldId),
962 const_cast<TimeSensorBase *>(this)));
964 return returnValue;
967 EditFieldHandlePtr TimeSensorBase::editHandleFraction (void)
969 SFReal32::EditHandlePtr returnValue(
970 new SFReal32::EditHandle(
971 &_sfFraction,
972 this->getType().getFieldDesc(FractionFieldId),
973 this));
976 editSField(FractionFieldMask);
978 return returnValue;
981 GetFieldHandlePtr TimeSensorBase::getHandleStartTime (void) const
983 SFTime::GetHandlePtr returnValue(
984 new SFTime::GetHandle(
985 &_sfStartTime,
986 this->getType().getFieldDesc(StartTimeFieldId),
987 const_cast<TimeSensorBase *>(this)));
989 return returnValue;
992 EditFieldHandlePtr TimeSensorBase::editHandleStartTime (void)
994 SFTime::EditHandlePtr returnValue(
995 new SFTime::EditHandle(
996 &_sfStartTime,
997 this->getType().getFieldDesc(StartTimeFieldId),
998 this));
1001 editSField(StartTimeFieldMask);
1003 return returnValue;
1006 GetFieldHandlePtr TimeSensorBase::getHandleStopTime (void) const
1008 SFTime::GetHandlePtr returnValue(
1009 new SFTime::GetHandle(
1010 &_sfStopTime,
1011 this->getType().getFieldDesc(StopTimeFieldId),
1012 const_cast<TimeSensorBase *>(this)));
1014 return returnValue;
1017 EditFieldHandlePtr TimeSensorBase::editHandleStopTime (void)
1019 SFTime::EditHandlePtr returnValue(
1020 new SFTime::EditHandle(
1021 &_sfStopTime,
1022 this->getType().getFieldDesc(StopTimeFieldId),
1023 this));
1026 editSField(StopTimeFieldMask);
1028 return returnValue;
1031 GetFieldHandlePtr TimeSensorBase::getHandleCycleTime (void) const
1033 SFTime::GetHandlePtr returnValue(
1034 new SFTime::GetHandle(
1035 &_sfCycleTime,
1036 this->getType().getFieldDesc(CycleTimeFieldId),
1037 const_cast<TimeSensorBase *>(this)));
1039 return returnValue;
1042 EditFieldHandlePtr TimeSensorBase::editHandleCycleTime (void)
1044 SFTime::EditHandlePtr returnValue(
1045 new SFTime::EditHandle(
1046 &_sfCycleTime,
1047 this->getType().getFieldDesc(CycleTimeFieldId),
1048 this));
1051 editSField(CycleTimeFieldMask);
1053 return returnValue;
1056 GetFieldHandlePtr TimeSensorBase::getHandleTime (void) const
1058 SFTime::GetHandlePtr returnValue(
1059 new SFTime::GetHandle(
1060 &_sfTime,
1061 this->getType().getFieldDesc(TimeFieldId),
1062 const_cast<TimeSensorBase *>(this)));
1064 return returnValue;
1067 EditFieldHandlePtr TimeSensorBase::editHandleTime (void)
1069 SFTime::EditHandlePtr returnValue(
1070 new SFTime::EditHandle(
1071 &_sfTime,
1072 this->getType().getFieldDesc(TimeFieldId),
1073 this));
1076 editSField(TimeFieldMask);
1078 return returnValue;
1081 GetFieldHandlePtr TimeSensorBase::getHandleCycleInterval (void) const
1083 SFTime::GetHandlePtr returnValue(
1084 new SFTime::GetHandle(
1085 &_sfCycleInterval,
1086 this->getType().getFieldDesc(CycleIntervalFieldId),
1087 const_cast<TimeSensorBase *>(this)));
1089 return returnValue;
1092 EditFieldHandlePtr TimeSensorBase::editHandleCycleInterval (void)
1094 SFTime::EditHandlePtr returnValue(
1095 new SFTime::EditHandle(
1096 &_sfCycleInterval,
1097 this->getType().getFieldDesc(CycleIntervalFieldId),
1098 this));
1101 editSField(CycleIntervalFieldMask);
1103 return returnValue;
1106 GetFieldHandlePtr TimeSensorBase::getHandleChangeFractionBy (void) const
1108 SFTime::GetHandlePtr returnValue(
1109 new SFTime::GetHandle(
1110 &_sfChangeFractionBy,
1111 this->getType().getFieldDesc(ChangeFractionByFieldId),
1112 const_cast<TimeSensorBase *>(this)));
1114 return returnValue;
1117 EditFieldHandlePtr TimeSensorBase::editHandleChangeFractionBy(void)
1119 SFTime::EditHandlePtr returnValue(
1120 new SFTime::EditHandle(
1121 &_sfChangeFractionBy,
1122 this->getType().getFieldDesc(ChangeFractionByFieldId),
1123 this));
1126 editSField(ChangeFractionByFieldMask);
1128 return returnValue;
1132 #ifdef OSG_MT_CPTR_ASPECT
1133 void TimeSensorBase::execSyncV( FieldContainer &oFrom,
1134 ConstFieldMaskArg whichField,
1135 AspectOffsetStore &oOffsets,
1136 ConstFieldMaskArg syncMode,
1137 const UInt32 uiSyncInfo)
1139 TimeSensor *pThis = static_cast<TimeSensor *>(this);
1141 pThis->execSync(static_cast<TimeSensor *>(&oFrom),
1142 whichField,
1143 oOffsets,
1144 syncMode,
1145 uiSyncInfo);
1147 #endif
1150 #ifdef OSG_MT_CPTR_ASPECT
1151 FieldContainer *TimeSensorBase::createAspectCopy(
1152 const FieldContainer *pRefAspect) const
1154 TimeSensor *returnValue;
1156 newAspectCopy(returnValue,
1157 dynamic_cast<const TimeSensor *>(pRefAspect),
1158 dynamic_cast<const TimeSensor *>(this));
1160 return returnValue;
1162 #endif
1164 void TimeSensorBase::resolveLinks(void)
1166 Inherited::resolveLinks();
1172 OSG_END_NAMESPACE