OSGAlgorithmComputeElementBase.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *               Copyright (C) 2000-2006 by the OpenSG Forum                 *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038
00039 /*****************************************************************************\
00040  *****************************************************************************
00041  **                                                                         **
00042  **                  This file is automatically generated.                  **
00043  **                                                                         **
00044  **          Any changes made to this file WILL be lost when it is          **
00045  **           regenerated, which can become necessary at any time.          **
00046  **                                                                         **
00047  **     Do not change this file, changes should be done in the derived      **
00048  **     class AlgorithmComputeElement!
00049  **                                                                         **
00050  *****************************************************************************
00051 \*****************************************************************************/
00052
00053 #include <cstdlib>
00054 #include <cstdio>
00055 #include <boost/assign/list_of.hpp>
00056
00057 #include "OSGConfig.h"
00058
00059
00060
00061 #include "OSGComputeAlgorithm.h"        // Algorithm Class
00062
00063 #include "OSGAlgorithmComputeElementBase.h"
00064 #include "OSGAlgorithmComputeElement.h"
00065
00066 #include <boost/bind.hpp>
00067
00068 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
00069 #pragma warning(disable:4355)
00070 #endif
00071 
00072 OSG_BEGIN_NAMESPACE
00073
00074 /***************************************************************************\
00075  *                            Description                                  *
00076 \***************************************************************************/
00077
00082 /***************************************************************************\
00083  *                        Field Documentation                              *
00084 \***************************************************************************/
00085
00091 /***************************************************************************\
00092  *                      FieldType/FieldTrait Instantiation                 *
00093 \***************************************************************************/
00094
00095 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00096 DataType FieldTraits<AlgorithmComputeElement *>::_type("AlgorithmComputeElementPtr", "ComputeElementPtr");
00097 #endif
00098 
00099 OSG_FIELDTRAITS_GETTYPE(AlgorithmComputeElement *)
00100
00101 /***************************************************************************\
00102  *                         Field Description                               *
00103 \***************************************************************************/
00104
00105 void AlgorithmComputeElementBase::classDescInserter(TypeObject &oType)
00106 {
00107     FieldDescriptionBase *pDesc = NULL;
00108
00109
00110     pDesc = new SFUnrecComputeAlgorithmPtr::Description(
00111         SFUnrecComputeAlgorithmPtr::getClassType(),
00112         "algorithm",
00113         "",
00114         AlgorithmFieldId, AlgorithmFieldMask,
00115         false,
00116         (Field::SFDefaultFlags | Field::FStdAccess),
00117         static_cast<FieldEditMethodSig>(&AlgorithmComputeElement::editHandleAlgorithm),
00118         static_cast<FieldGetMethodSig >(&AlgorithmComputeElement::getHandleAlgorithm));
00119
00120     oType.addInitialDesc(pDesc);
00121 }
00122
00123
00124 AlgorithmComputeElementBase::TypeObject AlgorithmComputeElementBase::_type(
00125     AlgorithmComputeElementBase::getClassname(),
00126     Inherited::getClassname(),
00127     "NULL",
00128     0,
00129     reinterpret_cast<PrototypeCreateF>(&AlgorithmComputeElementBase::createEmptyLocal),
00130     AlgorithmComputeElement::initMethod,
00131     AlgorithmComputeElement::exitMethod,
00132     reinterpret_cast<InitalInsertDescFunc>(&AlgorithmComputeElement::classDescInserter),
00133     false,
00134     0,
00135     "<?xml version=\"1.0\"?>\n"
00136     "\n"
00137     "<FieldContainer\n"
00138     "   name=\"AlgorithmComputeElement\"\n"
00139     "   parent=\"ComputeElement\"\n"
00140     "   library=\"ContribComputeBase\"\n"
00141     "   pointerfieldtypes=\"none\"\n"
00142     "   structure=\"concrete\"\n"
00143     "   systemcomponent=\"true\"\n"
00144     "   parentsystemcomponent=\"true\"\n"
00145     "   decoratable=\"false\"\n"
00146     "   useLocalIncludes=\"false\"\n"
00147     "   isNodeCore=\"true\"\n"
00148     "   >\n"
00149     "  <Field\n"
00150     "\t name=\"algorithm\"\n"
00151     "\t type=\"ComputeAlgorithmPtr\"\n"
00152     "\t cardinality=\"single\"\n"
00153     "\t visibility=\"external\"\n"
00154     "\t defaultValue=\"NULL\"\n"
00155     "\t access=\"public\"\n"
00156     "\t >\n"
00157     "  </Field>\n"
00158     "</FieldContainer>\n",
00159     ""
00160     );
00161
00162 /*------------------------------ get -----------------------------------*/
00163
00164 FieldContainerType &AlgorithmComputeElementBase::getType(void)
00165 {
00166     return _type;
00167 }
00168
00169 const FieldContainerType &AlgorithmComputeElementBase::getType(void) const
00170 {
00171     return _type;
00172 }
00173
00174 UInt32 AlgorithmComputeElementBase::getContainerSize(void) const
00175 {
00176     return sizeof(AlgorithmComputeElement);
00177 }
00178
00179 /*------------------------- decorator get ------------------------------*/
00180
00181
00183 const SFUnrecComputeAlgorithmPtr *AlgorithmComputeElementBase::getSFAlgorithm(void) const
00184 {
00185     return &_sfAlgorithm;
00186 }
00187
00188 SFUnrecComputeAlgorithmPtr *AlgorithmComputeElementBase::editSFAlgorithm      (void)
00189 {
00190     editSField(AlgorithmFieldMask);
00191
00192     return &_sfAlgorithm;
00193 }
00194
00195
00196
00197
00198
00199 /*------------------------------ access -----------------------------------*/
00200
00201 UInt32 AlgorithmComputeElementBase::getBinSize(ConstFieldMaskArg whichField)
00202 {
00203     UInt32 returnValue = Inherited::getBinSize(whichField);
00204
00205     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00206     {
00207         returnValue += _sfAlgorithm.getBinSize();
00208     }
00209
00210     return returnValue;
00211 }
00212
00213 void AlgorithmComputeElementBase::copyToBin(BinaryDataHandler &pMem,
00214                                   ConstFieldMaskArg  whichField)
00215 {
00216     Inherited::copyToBin(pMem, whichField);
00217
00218     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00219     {
00220         _sfAlgorithm.copyToBin(pMem);
00221     }
00222 }
00223
00224 void AlgorithmComputeElementBase::copyFromBin(BinaryDataHandler &pMem,
00225                                     ConstFieldMaskArg  whichField)
00226 {
00227     Inherited::copyFromBin(pMem, whichField);
00228
00229     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00230     {
00231         _sfAlgorithm.copyFromBin(pMem);
00232     }
00233 }
00234
00236 AlgorithmComputeElementTransitPtr AlgorithmComputeElementBase::createLocal(BitVector bFlags)
00237 {
00238     AlgorithmComputeElementTransitPtr fc;
00239
00240     if(getClassType().getPrototype() != NULL)
00241     {
00242         FieldContainerTransitPtr tmpPtr =
00243             getClassType().getPrototype()-> shallowCopyLocal(bFlags);
00244
00245         fc = dynamic_pointer_cast<AlgorithmComputeElement>(tmpPtr);
00246     }
00247
00248     return fc;
00249 }
00250
00252 AlgorithmComputeElementTransitPtr AlgorithmComputeElementBase::createDependent(BitVector bFlags)
00253 {
00254     AlgorithmComputeElementTransitPtr fc;
00255
00256     if(getClassType().getPrototype() != NULL)
00257     {
00258         FieldContainerTransitPtr tmpPtr =
00259             getClassType().getPrototype()-> shallowCopyDependent(bFlags);
00260
00261         fc = dynamic_pointer_cast<AlgorithmComputeElement>(tmpPtr);
00262     }
00263
00264     return fc;
00265 }
00266
00268 AlgorithmComputeElementTransitPtr AlgorithmComputeElementBase::create(void)
00269 {
00270     AlgorithmComputeElementTransitPtr fc;
00271
00272     if(getClassType().getPrototype() != NULL)
00273     {
00274         FieldContainerTransitPtr tmpPtr =
00275             getClassType().getPrototype()-> shallowCopy();
00276
00277         fc = dynamic_pointer_cast<AlgorithmComputeElement>(tmpPtr);
00278     }
00279
00280     return fc;
00281 }
00282
00283 AlgorithmComputeElement *AlgorithmComputeElementBase::createEmptyLocal(BitVector bFlags)
00284 {
00285     AlgorithmComputeElement *returnValue;
00286
00287     newPtr<AlgorithmComputeElement>(returnValue, bFlags);
00288
00289     returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
00290
00291     return returnValue;
00292 }
00293
00295 AlgorithmComputeElement *AlgorithmComputeElementBase::createEmpty(void)
00296 {
00297     AlgorithmComputeElement *returnValue;
00298
00299     newPtr<AlgorithmComputeElement>(returnValue, Thread::getCurrentLocalFlags());
00300
00301     returnValue->_pFieldFlags->_bNamespaceMask &=
00302         ~Thread::getCurrentLocalFlags();
00303
00304     return returnValue;
00305 }
00306
00307
00308 FieldContainerTransitPtr AlgorithmComputeElementBase::shallowCopyLocal(
00309     BitVector bFlags) const
00310 {
00311     AlgorithmComputeElement *tmpPtr;
00312
00313     newPtr(tmpPtr, dynamic_cast<const AlgorithmComputeElement *>(this), bFlags);
00314
00315     FieldContainerTransitPtr returnValue(tmpPtr);
00316
00317     tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
00318
00319     return returnValue;
00320 }
00321
00322 FieldContainerTransitPtr AlgorithmComputeElementBase::shallowCopyDependent(
00323     BitVector bFlags) const
00324 {
00325     AlgorithmComputeElement *tmpPtr;
00326
00327     newPtr(tmpPtr, dynamic_cast<const AlgorithmComputeElement *>(this), ~bFlags);
00328
00329     FieldContainerTransitPtr returnValue(tmpPtr);
00330
00331     tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
00332
00333     return returnValue;
00334 }
00335
00336 FieldContainerTransitPtr AlgorithmComputeElementBase::shallowCopy(void) const
00337 {
00338     AlgorithmComputeElement *tmpPtr;
00339
00340     newPtr(tmpPtr,
00341            dynamic_cast<const AlgorithmComputeElement *>(this),
00342            Thread::getCurrentLocalFlags());
00343
00344     tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
00345
00346     FieldContainerTransitPtr returnValue(tmpPtr);
00347
00348     return returnValue;
00349 }
00350
00351
00352
00353
00354 /*------------------------- constructors ----------------------------------*/
00355
00356 AlgorithmComputeElementBase::AlgorithmComputeElementBase(void) :
00357     Inherited(),
00358     _sfAlgorithm              (NULL)
00359 {
00360 }
00361
00362 AlgorithmComputeElementBase::AlgorithmComputeElementBase(const AlgorithmComputeElementBase &source) :
00363     Inherited(source),
00364     _sfAlgorithm              (NULL)
00365 {
00366 }
00367
00368
00369 /*-------------------------- destructors ----------------------------------*/
00370
00371 AlgorithmComputeElementBase::~AlgorithmComputeElementBase(void)
00372 {
00373 }
00374
00375 void AlgorithmComputeElementBase::onCreate(const AlgorithmComputeElement *source)
00376 {
00377     Inherited::onCreate(source);
00378
00379     if(source != NULL)
00380     {
00381         AlgorithmComputeElement *pThis = static_cast<AlgorithmComputeElement *>(this);
00382
00383         pThis->setAlgorithm(source->getAlgorithm());
00384     }
00385 }
00386
00387 GetFieldHandlePtr AlgorithmComputeElementBase::getHandleAlgorithm       (void) const
00388 {
00389     SFUnrecComputeAlgorithmPtr::GetHandlePtr returnValue(
00390         new  SFUnrecComputeAlgorithmPtr::GetHandle(
00391              &_sfAlgorithm,
00392              this->getType().getFieldDesc(AlgorithmFieldId),
00393              const_cast<AlgorithmComputeElementBase *>(this)));
00394
00395     return returnValue;
00396 }
00397
00398 EditFieldHandlePtr AlgorithmComputeElementBase::editHandleAlgorithm      (void)
00399 {
00400     SFUnrecComputeAlgorithmPtr::EditHandlePtr returnValue(
00401         new  SFUnrecComputeAlgorithmPtr::EditHandle(
00402              &_sfAlgorithm,
00403              this->getType().getFieldDesc(AlgorithmFieldId),
00404              this));
00405
00406     returnValue->setSetMethod(
00407         boost::bind(&AlgorithmComputeElement::setAlgorithm,
00408                     static_cast<AlgorithmComputeElement *>(this), _1));
00409
00410     editSField(AlgorithmFieldMask);
00411
00412     return returnValue;
00413 }
00414
00415
00416 #ifdef OSG_MT_CPTR_ASPECT
00417 void AlgorithmComputeElementBase::execSyncV(      FieldContainer    &oFrom,
00418                                         ConstFieldMaskArg  whichField,
00419                                         AspectOffsetStore &oOffsets,
00420                                         ConstFieldMaskArg  syncMode,
00421                                   const UInt32             uiSyncInfo)
00422 {
00423     AlgorithmComputeElement *pThis = static_cast<AlgorithmComputeElement *>(this);
00424
00425     pThis->execSync(static_cast<AlgorithmComputeElement *>(&oFrom),
00426                     whichField,
00427                     oOffsets,
00428                     syncMode,
00429                     uiSyncInfo);
00430 }
00431 #endif
00432 
00433
00434 #ifdef OSG_MT_CPTR_ASPECT
00435 FieldContainer *AlgorithmComputeElementBase::createAspectCopy(
00436     const FieldContainer *pRefAspect) const
00437 {
00438     AlgorithmComputeElement *returnValue;
00439
00440     newAspectCopy(returnValue,
00441                   dynamic_cast<const AlgorithmComputeElement *>(pRefAspect),
00442                   dynamic_cast<const AlgorithmComputeElement *>(this));
00443
00444     return returnValue;
00445 }
00446 #endif
00447 
00448 void AlgorithmComputeElementBase::resolveLinks(void)
00449 {
00450     Inherited::resolveLinks();
00451
00452     static_cast<AlgorithmComputeElement *>(this)->setAlgorithm(NULL);
00453
00454
00455 }
00456
00457
00458 OSG_END_NAMESPACE