fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComplexSceneManager / Helper / OSGCSMClusterWinOptionsBase.cpp
blobcde181da990c7657c4fb1ddacc54c74309823b43
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 CSMClusterWinOptions!
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"
65 #include "OSGCSMClusterWindow.h" // Parent Class
67 #include "OSGCSMClusterWinOptionsBase.h"
68 #include "OSGCSMClusterWinOptions.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::CSMClusterWinOptions
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var CSMClusterWindow * CSMClusterWinOptionsBase::_sfParent
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits<CSMClusterWinOptions *, nsOSG>::_type(
97 "CSMClusterWinOptionsPtr",
98 "FieldContainerPtr",
99 CSMClusterWinOptions::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(CSMClusterWinOptions *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 CSMClusterWinOptions *,
107 nsOSG)
110 DataType &FieldTraits< CSMClusterWinOptions *, nsOSG + 1 >::getType(void)
112 return FieldTraits<CSMClusterWinOptions *, nsOSG>::getType();
116 OSG_EXPORT_PTR_SFIELD(ChildPointerSField,
117 CSMClusterWinOptions *,
118 UnrecordedRefCountPolicy,
119 nsOSG + 1)
122 /***************************************************************************\
123 * Field Description *
124 \***************************************************************************/
126 void CSMClusterWinOptionsBase::classDescInserter(TypeObject &oType)
128 FieldDescriptionBase *pDesc = NULL;
131 pDesc = new SFParentCSMClusterWindowPtr::Description(
132 SFParentCSMClusterWindowPtr::getClassType(),
133 "parent",
135 ParentFieldId, ParentFieldMask,
136 true,
137 (Field::SFDefaultFlags | Field::FStdAccess),
138 static_cast <FieldEditMethodSig>(&CSMClusterWinOptions::invalidEditField),
139 static_cast <FieldGetMethodSig >(&CSMClusterWinOptions::invalidGetField));
141 oType.addInitialDesc(pDesc);
145 CSMClusterWinOptionsBase::TypeObject CSMClusterWinOptionsBase::_type(
146 CSMClusterWinOptionsBase::getClassname(),
147 Inherited::getClassname(),
148 "NULL",
149 nsOSG, //Namespace
150 reinterpret_cast<PrototypeCreateF>(&CSMClusterWinOptionsBase::createEmptyLocal),
151 reinterpret_cast<InitContainerF>(&CSMClusterWinOptions::initMethod),
152 reinterpret_cast<ExitContainerF>(&CSMClusterWinOptions::exitMethod),
153 reinterpret_cast<InitalInsertDescFunc>(
154 reinterpret_cast<void *>(&CSMClusterWinOptions::classDescInserter)),
155 false,
157 "<?xml version=\"1.0\"?>\n"
158 "\n"
159 "<FieldContainer\n"
160 " name=\"CSMClusterWinOptions\"\n"
161 " parent=\"FieldContainer\"\n"
162 " library=\"ContribCSM\"\n"
163 " pointerfieldtypes=\"single\"\n"
164 " structure=\"concrete\"\n"
165 " systemcomponent=\"true\"\n"
166 " parentsystemcomponent=\"true\"\n"
167 " decoratable=\"false\"\n"
168 " useLocalIncludes=\"false\"\n"
169 " isNodeCore=\"false\"\n"
170 " isBundle=\"true\"\n"
171 " parentFields=\"none\"\n"
172 " childFields=\"single\"\n"
173 ">\n"
174 "\t<Field\n"
175 "\t\tname=\"parent\"\n"
176 "\t\ttype=\"CSMClusterWindow\"\n"
177 "\t\tcardinality=\"single\"\n"
178 "\t\tvisibility=\"internal\"\n"
179 "\t\taccess=\"none\"\n"
180 " category=\"parentpointer\"\n"
181 "\t>\n"
182 "\t</Field>\n"
183 "</FieldContainer>\n",
187 /*------------------------------ get -----------------------------------*/
189 FieldContainerType &CSMClusterWinOptionsBase::getType(void)
191 return _type;
194 const FieldContainerType &CSMClusterWinOptionsBase::getType(void) const
196 return _type;
199 UInt32 CSMClusterWinOptionsBase::getContainerSize(void) const
201 return sizeof(CSMClusterWinOptions);
204 /*------------------------- decorator get ------------------------------*/
212 /*------------------------------ access -----------------------------------*/
214 SizeT CSMClusterWinOptionsBase::getBinSize(ConstFieldMaskArg whichField)
216 SizeT returnValue = Inherited::getBinSize(whichField);
218 if(FieldBits::NoField != (ParentFieldMask & whichField))
220 returnValue += _sfParent.getBinSize();
223 return returnValue;
226 void CSMClusterWinOptionsBase::copyToBin(BinaryDataHandler &pMem,
227 ConstFieldMaskArg whichField)
229 Inherited::copyToBin(pMem, whichField);
231 if(FieldBits::NoField != (ParentFieldMask & whichField))
233 _sfParent.copyToBin(pMem);
237 void CSMClusterWinOptionsBase::copyFromBin(BinaryDataHandler &pMem,
238 ConstFieldMaskArg whichField)
240 Inherited::copyFromBin(pMem, whichField);
242 if(FieldBits::NoField != (ParentFieldMask & whichField))
244 editSField(ParentFieldMask);
245 _sfParent.copyFromBin(pMem);
249 //! create a new instance of the class
250 CSMClusterWinOptionsTransitPtr CSMClusterWinOptionsBase::createLocal(BitVector bFlags)
252 CSMClusterWinOptionsTransitPtr fc;
254 if(getClassType().getPrototype() != NULL)
256 FieldContainerTransitPtr tmpPtr =
257 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
259 fc = dynamic_pointer_cast<CSMClusterWinOptions>(tmpPtr);
262 return fc;
265 //! create a new instance of the class, copy the container flags
266 CSMClusterWinOptionsTransitPtr CSMClusterWinOptionsBase::createDependent(BitVector bFlags)
268 CSMClusterWinOptionsTransitPtr fc;
270 if(getClassType().getPrototype() != NULL)
272 FieldContainerTransitPtr tmpPtr =
273 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
275 fc = dynamic_pointer_cast<CSMClusterWinOptions>(tmpPtr);
278 return fc;
281 //! create a new instance of the class
282 CSMClusterWinOptionsTransitPtr CSMClusterWinOptionsBase::create(void)
284 return createLocal();
287 CSMClusterWinOptions *CSMClusterWinOptionsBase::createEmptyLocal(BitVector bFlags)
289 CSMClusterWinOptions *returnValue;
291 newPtr<CSMClusterWinOptions>(returnValue, bFlags);
293 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
295 return returnValue;
298 //! create an empty new instance of the class, do not copy the prototype
299 CSMClusterWinOptions *CSMClusterWinOptionsBase::createEmpty(void)
301 return createEmptyLocal();
305 FieldContainerTransitPtr CSMClusterWinOptionsBase::shallowCopyLocal(
306 BitVector bFlags) const
308 CSMClusterWinOptions *tmpPtr;
310 newPtr(tmpPtr, dynamic_cast<const CSMClusterWinOptions *>(this), bFlags);
312 FieldContainerTransitPtr returnValue(tmpPtr);
314 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
316 return returnValue;
319 FieldContainerTransitPtr CSMClusterWinOptionsBase::shallowCopyDependent(
320 BitVector bFlags) const
322 CSMClusterWinOptions *tmpPtr;
324 newPtr(tmpPtr, dynamic_cast<const CSMClusterWinOptions *>(this), ~bFlags);
326 FieldContainerTransitPtr returnValue(tmpPtr);
328 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
330 return returnValue;
333 FieldContainerTransitPtr CSMClusterWinOptionsBase::shallowCopy(void) const
335 return shallowCopyLocal();
341 /*------------------------- constructors ----------------------------------*/
343 CSMClusterWinOptionsBase::CSMClusterWinOptionsBase(void) :
344 Inherited(),
345 _sfParent (NULL)
349 CSMClusterWinOptionsBase::CSMClusterWinOptionsBase(const CSMClusterWinOptionsBase &source) :
350 Inherited(source),
351 _sfParent (NULL)
356 /*-------------------------- destructors ----------------------------------*/
358 CSMClusterWinOptionsBase::~CSMClusterWinOptionsBase(void)
361 /*-------------------------------------------------------------------------*/
362 /* Parent linking */
364 bool CSMClusterWinOptionsBase::linkParent(
365 FieldContainer * const pParent,
366 UInt16 const childFieldId,
367 UInt16 const parentFieldId )
369 if(parentFieldId == ParentFieldId)
371 CSMClusterWindow * pTypedParent =
372 dynamic_cast< CSMClusterWindow * >(pParent);
374 if(pTypedParent != NULL)
376 FieldContainer *pOldParent =
377 _sfParent.getValue ();
379 UInt16 oldChildFieldId =
380 _sfParent.getParentFieldPos();
382 if(pOldParent != NULL)
384 pOldParent->unlinkChild(this, oldChildFieldId);
387 editSField(ParentFieldMask);
389 _sfParent.setValue(static_cast<CSMClusterWindow *>(pParent), childFieldId);
391 return true;
394 return false;
397 return Inherited::linkParent(pParent, childFieldId, parentFieldId);
400 bool CSMClusterWinOptionsBase::unlinkParent(
401 FieldContainer * const pParent,
402 UInt16 const parentFieldId)
404 if(parentFieldId == ParentFieldId)
406 CSMClusterWindow * pTypedParent =
407 dynamic_cast< CSMClusterWindow * >(pParent);
409 if(pTypedParent != NULL)
411 if(_sfParent.getValue() == pTypedParent)
413 editSField(ParentFieldMask);
415 _sfParent.setValue(NULL, 0xFFFF);
417 return true;
420 SWARNING << "Child ([" << this
421 << "] id [" << this->getId()
422 << "] type [" << this->getType().getCName()
423 << "] parentFieldId [" << parentFieldId
424 << "]) - Parent ([" << pParent
425 << "] id [" << pParent->getId()
426 << "] type [" << pParent->getType().getCName()
427 << "]): link inconsistent!"
428 << std::endl;
430 return false;
433 return false;
436 return Inherited::unlinkParent(pParent, parentFieldId);
441 GetFieldHandlePtr CSMClusterWinOptionsBase::getHandleParent (void) const
443 SFParentCSMClusterWindowPtr::GetHandlePtr returnValue;
445 return returnValue;
448 EditFieldHandlePtr CSMClusterWinOptionsBase::editHandleParent (void)
450 EditFieldHandlePtr returnValue;
452 return returnValue;
456 #ifdef OSG_MT_CPTR_ASPECT
457 void CSMClusterWinOptionsBase::execSyncV( FieldContainer &oFrom,
458 ConstFieldMaskArg whichField,
459 AspectOffsetStore &oOffsets,
460 ConstFieldMaskArg syncMode,
461 const UInt32 uiSyncInfo)
463 CSMClusterWinOptions *pThis = static_cast<CSMClusterWinOptions *>(this);
465 pThis->execSync(static_cast<CSMClusterWinOptions *>(&oFrom),
466 whichField,
467 oOffsets,
468 syncMode,
469 uiSyncInfo);
471 #endif
474 #ifdef OSG_MT_CPTR_ASPECT
475 FieldContainer *CSMClusterWinOptionsBase::createAspectCopy(
476 const FieldContainer *pRefAspect) const
478 CSMClusterWinOptions *returnValue;
480 newAspectCopy(returnValue,
481 dynamic_cast<const CSMClusterWinOptions *>(pRefAspect),
482 dynamic_cast<const CSMClusterWinOptions *>(this));
484 return returnValue;
486 #endif
488 void CSMClusterWinOptionsBase::resolveLinks(void)
490 Inherited::resolveLinks();
496 OSG_END_NAMESPACE