fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Test / GroupLib / OSGInsertTestTaskBase.cpp
blob33f5184f2686cc13fecc389bf93a1aba111e5d22
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 /*****************************************************************************\
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 InsertTestTask!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #include "OSGConfig.h"
60 #include "OSGCSMWindow.h" // Window Class
62 #include "OSGInsertTestTaskBase.h"
63 #include "OSGInsertTestTask.h"
65 #include <boost/bind.hpp>
67 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
68 #pragma warning(disable:4355)
69 #endif
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::InsertTestTask
78 just dumps a message on traversal and render for testing
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var std::string InsertTestTaskBase::_sfMessage
89 /*! \var CSMWindow * InsertTestTaskBase::_sfWindow
93 /*! \var OSGAny InsertTestTaskBase::_sfTrigger
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits<InsertTestTask *, nsOSG>::_type(
104 "InsertTestTaskPtr",
105 "AttachmentContainerPtr",
106 InsertTestTask::getClassType(),
107 nsOSG);
108 #endif
110 OSG_FIELDTRAITS_GETTYPE_NS(InsertTestTask *, nsOSG)
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void InsertTestTaskBase::classDescInserter(TypeObject &oType)
118 FieldDescriptionBase *pDesc = NULL;
121 pDesc = new SFString::Description(
122 SFString::getClassType(),
123 "message",
125 MessageFieldId, MessageFieldMask,
126 false,
127 (Field::SFDefaultFlags | Field::FStdAccess),
128 static_cast<FieldEditMethodSig>(&InsertTestTask::editHandleMessage),
129 static_cast<FieldGetMethodSig >(&InsertTestTask::getHandleMessage));
131 oType.addInitialDesc(pDesc);
133 pDesc = new SFWeakCSMWindowPtr::Description(
134 SFWeakCSMWindowPtr::getClassType(),
135 "window",
137 WindowFieldId, WindowFieldMask,
138 false,
139 (Field::SFDefaultFlags | Field::FStdAccess),
140 static_cast<FieldEditMethodSig>(&InsertTestTask::editHandleWindow),
141 static_cast<FieldGetMethodSig >(&InsertTestTask::getHandleWindow));
143 oType.addInitialDesc(pDesc);
145 pDesc = new SFOSGAny::Description(
146 SFOSGAny::getClassType(),
147 "trigger",
149 TriggerFieldId, TriggerFieldMask,
150 true,
151 (Field::FStdAccess | Field::FThreadLocal),
152 static_cast<FieldEditMethodSig>(&InsertTestTask::editHandleTrigger),
153 static_cast<FieldGetMethodSig >(&InsertTestTask::getHandleTrigger));
155 oType.addInitialDesc(pDesc);
159 InsertTestTaskBase::TypeObject InsertTestTaskBase::_type(
160 InsertTestTaskBase::getClassname(),
161 Inherited::getClassname(),
162 "NULL",
163 nsOSG, //Namespace
164 reinterpret_cast<PrototypeCreateF>(&InsertTestTaskBase::createEmptyLocal),
165 InsertTestTask::initMethod,
166 InsertTestTask::exitMethod,
167 reinterpret_cast<InitalInsertDescFunc>(&InsertTestTask::classDescInserter),
168 false,
170 "<?xml version=\"1.0\"?>\n"
171 "\n"
172 "<FieldContainer\n"
173 " name=\"InsertTestTask\"\n"
174 " parent=\"AttachmentContainer\"\n"
175 " library=\"Group\"\n"
176 " pointerfieldtypes=\"none\"\n"
177 " structure=\"concrete\"\n"
178 " systemcomponent=\"true\"\n"
179 " parentsystemcomponent=\"true\"\n"
180 " decoratable=\"false\"\n"
181 " useLocalIncludes=\"false\"\n"
182 " isNodeCore=\"false\"\n"
183 " >\n"
184 " just dumps a message on traversal and render for testing\n"
185 " <Field\n"
186 " name=\"message\"\n"
187 " type=\"std::string\"\n"
188 " cardinality=\"single\"\n"
189 " visibility=\"external\"\n"
190 " access=\"public\"\n"
191 " >\n"
192 " </Field>\n"
193 " <Field\n"
194 " name=\"window\"\n"
195 " type=\"CSMWindow\"\n"
196 " cardinality=\"single\"\n"
197 " category=\"weakpointer\"\n"
198 " visibility=\"external\"\n"
199 " access=\"public\"\n"
200 " >\n"
201 " </Field>\n"
202 " <Field\n"
203 " name=\"trigger\"\n"
204 " type=\"OSGAny\"\n"
205 " cardinality=\"single\"\n"
206 " visibility=\"internal\"\n"
207 " access=\"protected\"\n"
208 " defaultValue=\"\"\n"
209 " fieldFlags=\"FStdAccess, FThreadLocal\"\n"
210 " >\n"
211 " </Field>\n"
212 "</FieldContainer>\n",
213 "just dumps a message on traversal and render for testing\n"
216 /*------------------------------ get -----------------------------------*/
218 FieldContainerType &InsertTestTaskBase::getType(void)
220 return _type;
223 const FieldContainerType &InsertTestTaskBase::getType(void) const
225 return _type;
228 UInt32 InsertTestTaskBase::getContainerSize(void) const
230 return sizeof(InsertTestTask);
233 /*------------------------- decorator get ------------------------------*/
236 SFString *InsertTestTaskBase::editSFMessage(void)
238 editSField(MessageFieldMask);
240 return &_sfMessage;
243 const SFString *InsertTestTaskBase::getSFMessage(void) const
245 return &_sfMessage;
249 //! Get the InsertTestTask::_sfWindow field.
250 const SFWeakCSMWindowPtr *InsertTestTaskBase::getSFWindow(void) const
252 return &_sfWindow;
255 SFWeakCSMWindowPtr *InsertTestTaskBase::editSFWindow (void)
257 editSField(WindowFieldMask);
259 return &_sfWindow;
262 SFOSGAny *InsertTestTaskBase::editSFTrigger(void)
264 editSField(TriggerFieldMask);
266 return &_sfTrigger;
269 const SFOSGAny *InsertTestTaskBase::getSFTrigger(void) const
271 return &_sfTrigger;
279 /*------------------------------ access -----------------------------------*/
281 SizeT InsertTestTaskBase::getBinSize(ConstFieldMaskArg whichField)
283 SizeT returnValue = Inherited::getBinSize(whichField);
285 if(FieldBits::NoField != (MessageFieldMask & whichField))
287 returnValue += _sfMessage.getBinSize();
289 if(FieldBits::NoField != (WindowFieldMask & whichField))
291 returnValue += _sfWindow.getBinSize();
293 if(FieldBits::NoField != (TriggerFieldMask & whichField))
295 returnValue += _sfTrigger.getBinSize();
298 return returnValue;
301 void InsertTestTaskBase::copyToBin(BinaryDataHandler &pMem,
302 ConstFieldMaskArg whichField)
304 Inherited::copyToBin(pMem, whichField);
306 if(FieldBits::NoField != (MessageFieldMask & whichField))
308 _sfMessage.copyToBin(pMem);
310 if(FieldBits::NoField != (WindowFieldMask & whichField))
312 _sfWindow.copyToBin(pMem);
314 if(FieldBits::NoField != (TriggerFieldMask & whichField))
316 _sfTrigger.copyToBin(pMem);
320 void InsertTestTaskBase::copyFromBin(BinaryDataHandler &pMem,
321 ConstFieldMaskArg whichField)
323 Inherited::copyFromBin(pMem, whichField);
325 if(FieldBits::NoField != (MessageFieldMask & whichField))
327 editSField(MessageFieldMask);
328 _sfMessage.copyFromBin(pMem);
330 if(FieldBits::NoField != (WindowFieldMask & whichField))
332 editSField(WindowFieldMask);
333 _sfWindow.copyFromBin(pMem);
335 if(FieldBits::NoField != (TriggerFieldMask & whichField))
337 editSField(TriggerFieldMask);
338 _sfTrigger.copyFromBin(pMem);
342 //! create a new instance of the class
343 InsertTestTaskTransitPtr InsertTestTaskBase::createLocal(BitVector bFlags)
345 InsertTestTaskTransitPtr fc;
347 if(getClassType().getPrototype() != NULL)
349 FieldContainerTransitPtr tmpPtr =
350 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
352 fc = dynamic_pointer_cast<InsertTestTask>(tmpPtr);
355 return fc;
358 //! create a new instance of the class, copy the container flags
359 InsertTestTaskTransitPtr InsertTestTaskBase::createDependent(BitVector bFlags)
361 InsertTestTaskTransitPtr fc;
363 if(getClassType().getPrototype() != NULL)
365 FieldContainerTransitPtr tmpPtr =
366 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
368 fc = dynamic_pointer_cast<InsertTestTask>(tmpPtr);
371 return fc;
374 //! create a new instance of the class
375 InsertTestTaskTransitPtr InsertTestTaskBase::create(void)
377 InsertTestTaskTransitPtr fc;
379 if(getClassType().getPrototype() != NULL)
381 FieldContainerTransitPtr tmpPtr =
382 getClassType().getPrototype()-> shallowCopy();
384 fc = dynamic_pointer_cast<InsertTestTask>(tmpPtr);
387 return fc;
390 InsertTestTask *InsertTestTaskBase::createEmptyLocal(BitVector bFlags)
392 InsertTestTask *returnValue;
394 newPtr<InsertTestTask>(returnValue, bFlags);
396 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
398 return returnValue;
401 //! create an empty new instance of the class, do not copy the prototype
402 InsertTestTask *InsertTestTaskBase::createEmpty(void)
404 InsertTestTask *returnValue;
406 newPtr<InsertTestTask>(returnValue, Thread::getCurrentLocalFlags());
408 returnValue->_pFieldFlags->_bNamespaceMask &=
409 ~Thread::getCurrentLocalFlags();
411 return returnValue;
415 FieldContainerTransitPtr InsertTestTaskBase::shallowCopyLocal(
416 BitVector bFlags) const
418 InsertTestTask *tmpPtr;
420 newPtr(tmpPtr, dynamic_cast<const InsertTestTask *>(this), bFlags);
422 FieldContainerTransitPtr returnValue(tmpPtr);
424 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
426 return returnValue;
429 FieldContainerTransitPtr InsertTestTaskBase::shallowCopyDependent(
430 BitVector bFlags) const
432 InsertTestTask *tmpPtr;
434 newPtr(tmpPtr, dynamic_cast<const InsertTestTask *>(this), ~bFlags);
436 FieldContainerTransitPtr returnValue(tmpPtr);
438 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
440 return returnValue;
443 FieldContainerTransitPtr InsertTestTaskBase::shallowCopy(void) const
445 InsertTestTask *tmpPtr;
447 newPtr(tmpPtr,
448 dynamic_cast<const InsertTestTask *>(this),
449 Thread::getCurrentLocalFlags());
451 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
453 FieldContainerTransitPtr returnValue(tmpPtr);
455 return returnValue;
461 /*------------------------- constructors ----------------------------------*/
463 InsertTestTaskBase::InsertTestTaskBase(void) :
464 Inherited(),
465 _sfMessage (),
466 _sfWindow (NULL),
467 _sfTrigger ()
471 InsertTestTaskBase::InsertTestTaskBase(const InsertTestTaskBase &source) :
472 Inherited(source),
473 _sfMessage (source._sfMessage ),
474 _sfWindow (NULL),
475 _sfTrigger (source._sfTrigger )
480 /*-------------------------- destructors ----------------------------------*/
482 InsertTestTaskBase::~InsertTestTaskBase(void)
486 void InsertTestTaskBase::onCreate(const InsertTestTask *source)
488 Inherited::onCreate(source);
490 if(source != NULL)
492 InsertTestTask *pThis = static_cast<InsertTestTask *>(this);
494 pThis->setWindow(source->getWindow());
498 GetFieldHandlePtr InsertTestTaskBase::getHandleMessage (void) const
500 SFString::GetHandlePtr returnValue(
501 new SFString::GetHandle(
502 &_sfMessage,
503 this->getType().getFieldDesc(MessageFieldId),
504 const_cast<InsertTestTaskBase *>(this)));
506 return returnValue;
509 EditFieldHandlePtr InsertTestTaskBase::editHandleMessage (void)
511 SFString::EditHandlePtr returnValue(
512 new SFString::EditHandle(
513 &_sfMessage,
514 this->getType().getFieldDesc(MessageFieldId),
515 this));
518 editSField(MessageFieldMask);
520 return returnValue;
523 GetFieldHandlePtr InsertTestTaskBase::getHandleWindow (void) const
525 SFWeakCSMWindowPtr::GetHandlePtr returnValue(
526 new SFWeakCSMWindowPtr::GetHandle(
527 &_sfWindow,
528 this->getType().getFieldDesc(WindowFieldId),
529 const_cast<InsertTestTaskBase *>(this)));
531 return returnValue;
534 EditFieldHandlePtr InsertTestTaskBase::editHandleWindow (void)
536 SFWeakCSMWindowPtr::EditHandlePtr returnValue(
537 new SFWeakCSMWindowPtr::EditHandle(
538 &_sfWindow,
539 this->getType().getFieldDesc(WindowFieldId),
540 this));
542 returnValue->setSetMethod(
543 boost::bind(&InsertTestTask::setWindow,
544 static_cast<InsertTestTask *>(this), _1));
546 editSField(WindowFieldMask);
548 return returnValue;
551 GetFieldHandlePtr InsertTestTaskBase::getHandleTrigger (void) const
553 SFOSGAny::GetHandlePtr returnValue(
554 new SFOSGAny::GetHandle(
555 &_sfTrigger,
556 this->getType().getFieldDesc(TriggerFieldId),
557 const_cast<InsertTestTaskBase *>(this)));
559 return returnValue;
562 EditFieldHandlePtr InsertTestTaskBase::editHandleTrigger (void)
564 SFOSGAny::EditHandlePtr returnValue(
565 new SFOSGAny::EditHandle(
566 &_sfTrigger,
567 this->getType().getFieldDesc(TriggerFieldId),
568 this));
571 editSField(TriggerFieldMask);
573 return returnValue;
577 #ifdef OSG_MT_CPTR_ASPECT
578 void InsertTestTaskBase::execSyncV( FieldContainer &oFrom,
579 ConstFieldMaskArg whichField,
580 AspectOffsetStore &oOffsets,
581 ConstFieldMaskArg syncMode,
582 const UInt32 uiSyncInfo)
584 InsertTestTask *pThis = static_cast<InsertTestTask *>(this);
586 pThis->execSync(static_cast<InsertTestTask *>(&oFrom),
587 whichField,
588 oOffsets,
589 syncMode,
590 uiSyncInfo);
592 #endif
595 #ifdef OSG_MT_CPTR_ASPECT
596 FieldContainer *InsertTestTaskBase::createAspectCopy(
597 const FieldContainer *pRefAspect) const
599 InsertTestTask *returnValue;
601 newAspectCopy(returnValue,
602 dynamic_cast<const InsertTestTask *>(pRefAspect),
603 dynamic_cast<const InsertTestTask *>(this));
605 return returnValue;
607 #endif
609 void InsertTestTaskBase::resolveLinks(void)
611 Inherited::resolveLinks();
613 static_cast<InsertTestTask *>(this)->setWindow(NULL);
619 OSG_END_NAMESPACE