OSGAlgorithmStageBase.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 AlgorithmStage!
00049  **                                                                         **
00050  *****************************************************************************
00051 \*****************************************************************************/
00052 
00053 
00054 #define OSG_COMPILEALGORITHMSTAGEINST
00055 
00056 #include <cstdlib>
00057 #include <cstdio>
00058 #include <boost/assign/list_of.hpp>
00059 
00060 #include <OSGConfig.h>
00061 
00062 
00063 
00064 #include <OSGAlgorithm.h> // Algorithm Class
00065 
00066 #include "OSGAlgorithmStageBase.h"
00067 #include "OSGAlgorithmStage.h"
00068 
00069 #include "boost/bind.hpp"
00070 
00071 OSG_BEGIN_NAMESPACE
00072 
00073 /***************************************************************************\
00074  *                            Description                                  *
00075 \***************************************************************************/
00076 
00081 /***************************************************************************\
00082  *                         Field Description                               *
00083 \***************************************************************************/
00084 
00098 void AlgorithmStageBase::classDescInserter(TypeObject &oType)
00099 {
00100     FieldDescriptionBase *pDesc = NULL;
00101 
00102 
00103     pDesc = new SFAlgorithmPtr::Description(
00104         SFAlgorithmPtr::getClassType(),
00105         "algorithm",
00106         "",
00107         AlgorithmFieldId, AlgorithmFieldMask,
00108         false,
00109         Field::SFDefaultFlags,
00110         static_cast<FieldEditMethodSig>(&AlgorithmStageBase::editHandleAlgorithm),
00111         static_cast<FieldGetMethodSig >(&AlgorithmStageBase::getHandleAlgorithm));
00112 
00113     oType.addInitialDesc(pDesc);
00114 
00115     pDesc = new SFUInt32::Description(
00116         SFUInt32::getClassType(),
00117         "projectionMode",
00118         "",
00119         ProjectionModeFieldId, ProjectionModeFieldMask,
00120         false,
00121         Field::SFDefaultFlags,
00122         static_cast<FieldEditMethodSig>(&AlgorithmStageBase::editHandleProjectionMode),
00123         static_cast<FieldGetMethodSig >(&AlgorithmStageBase::getHandleProjectionMode));
00124 
00125     oType.addInitialDesc(pDesc);
00126 
00127     pDesc = new SFMatrix::Description(
00128         SFMatrix::getClassType(),
00129         "projectionMatrix",
00130         "",
00131         ProjectionMatrixFieldId, ProjectionMatrixFieldMask,
00132         false,
00133         Field::SFDefaultFlags,
00134         static_cast<FieldEditMethodSig>(&AlgorithmStageBase::editHandleProjectionMatrix),
00135         static_cast<FieldGetMethodSig >(&AlgorithmStageBase::getHandleProjectionMatrix));
00136 
00137     oType.addInitialDesc(pDesc);
00138 }
00139 
00140 
00141 AlgorithmStageBase::TypeObject AlgorithmStageBase::_type(
00142     AlgorithmStageBase::getClassname(),
00143     Inherited::getClassname(),
00144     "NULL",
00145     0,
00146     (PrototypeCreateF) &AlgorithmStageBase::createEmpty,
00147     AlgorithmStage::initMethod,
00148     (InitalInsertDescFunc) &AlgorithmStageBase::classDescInserter,
00149     false,
00150     0,
00151     "<?xml version=\"1.0\"?>\n"
00152     "\n"
00153     "<FieldContainer\n"
00154     "\tname=\"AlgorithmStage\"\n"
00155     "\tparent=\"Stage\"\n"
00156     "\tlibrary=\"Group\"\n"
00157     "\tpointerfieldtypes=\"none\"\n"
00158     "\tstructure=\"concrete\"\n"
00159     "\tsystemcomponent=\"true\"\n"
00160     "\tparentsystemcomponent=\"true\"\n"
00161     "\tdecoratable=\"false\"\n"
00162     "\tuseLocalIncludes=\"false\"\n"
00163     "    isNodeCore=\"true\"\n"
00164     ">\n"
00165     "\t<Field\n"
00166     "\t\tname=\"algorithm\"\n"
00167     "\t\ttype=\"AlgorithmPtr\"\n"
00168     "\t\tcardinality=\"single\"\n"
00169     "\t\tvisibility=\"external\"\n"
00170     "\t\tdefaultValue=\"NullFC\"\n"
00171     "\t\taccess=\"public\"\n"
00172     "\t>\n"
00173     "\t</Field>\n"
00174     "\t<Field\n"
00175     "\t\tname=\"projectionMode\"\n"
00176     "\t\ttype=\"UInt32\"\n"
00177     "\t\tcardinality=\"single\"\n"
00178     "\t\tvisibility=\"external\"\n"
00179     "\t\tdefaultValue=\"0x0001\"\n"
00180     "\t\taccess=\"public\"\n"
00181     "\t>\n"
00182     "\t</Field>\n"
00183     "\t<Field\n"
00184     "\t\tname=\"projectionMatrix\"\n"
00185     "\t\ttype=\"Matrix\"\n"
00186     "\t\tcardinality=\"single\"\n"
00187     "\t\tvisibility=\"external\"\n"
00188     "\t\tdefaultValue=\"\"\n"
00189     "\t\taccess=\"public\"\n"
00190     "\t>\n"
00191     "\t</Field>\n"
00192     "</FieldContainer>\n",
00193     ""
00194     );
00195 
00196 /*------------------------------ get -----------------------------------*/
00197 
00198 FieldContainerType &AlgorithmStageBase::getType(void)
00199 {
00200     return _type;
00201 }
00202 
00203 const FieldContainerType &AlgorithmStageBase::getType(void) const
00204 {
00205     return _type;
00206 }
00207 
00208 UInt32 AlgorithmStageBase::getContainerSize(void) const
00209 {
00210     return sizeof(AlgorithmStage);
00211 }
00212 
00213 /*------------------------- decorator get ------------------------------*/
00214 
00215 
00217 const SFAlgorithmPtr *AlgorithmStageBase::getSFAlgorithm(void) const
00218 {
00219     return &_sfAlgorithm;
00220 }
00221 
00222 SFUInt32 *AlgorithmStageBase::editSFProjectionMode(void)
00223 {
00224     editSField(ProjectionModeFieldMask);
00225 
00226     return &_sfProjectionMode;
00227 }
00228 
00229 const SFUInt32 *AlgorithmStageBase::getSFProjectionMode(void) const
00230 {
00231     return &_sfProjectionMode;
00232 }
00233 
00234 #ifdef OSG_1_GET_COMPAT
00235 SFUInt32            *AlgorithmStageBase::getSFProjectionMode (void)
00236 {
00237     return this->editSFProjectionMode ();
00238 }
00239 #endif
00240 
00241 SFMatrix *AlgorithmStageBase::editSFProjectionMatrix(void)
00242 {
00243     editSField(ProjectionMatrixFieldMask);
00244 
00245     return &_sfProjectionMatrix;
00246 }
00247 
00248 const SFMatrix *AlgorithmStageBase::getSFProjectionMatrix(void) const
00249 {
00250     return &_sfProjectionMatrix;
00251 }
00252 
00253 #ifdef OSG_1_GET_COMPAT
00254 SFMatrix            *AlgorithmStageBase::getSFProjectionMatrix(void)
00255 {
00256     return this->editSFProjectionMatrix();
00257 }
00258 #endif
00259 
00260 
00261 
00262 
00263 
00264 /*------------------------------ access -----------------------------------*/
00265 
00266 UInt32 AlgorithmStageBase::getBinSize(ConstFieldMaskArg whichField)
00267 {
00268     UInt32 returnValue = Inherited::getBinSize(whichField);
00269 
00270     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00271     {
00272         returnValue += _sfAlgorithm.getBinSize();
00273     }
00274     if(FieldBits::NoField != (ProjectionModeFieldMask & whichField))
00275     {
00276         returnValue += _sfProjectionMode.getBinSize();
00277     }
00278     if(FieldBits::NoField != (ProjectionMatrixFieldMask & whichField))
00279     {
00280         returnValue += _sfProjectionMatrix.getBinSize();
00281     }
00282 
00283     return returnValue;
00284 }
00285 
00286 void AlgorithmStageBase::copyToBin(BinaryDataHandler &pMem,
00287                                   ConstFieldMaskArg  whichField)
00288 {
00289     Inherited::copyToBin(pMem, whichField);
00290 
00291     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00292     {
00293         _sfAlgorithm.copyToBin(pMem);
00294     }
00295     if(FieldBits::NoField != (ProjectionModeFieldMask & whichField))
00296     {
00297         _sfProjectionMode.copyToBin(pMem);
00298     }
00299     if(FieldBits::NoField != (ProjectionMatrixFieldMask & whichField))
00300     {
00301         _sfProjectionMatrix.copyToBin(pMem);
00302     }
00303 }
00304 
00305 void AlgorithmStageBase::copyFromBin(BinaryDataHandler &pMem,
00306                                     ConstFieldMaskArg  whichField)
00307 {
00308     Inherited::copyFromBin(pMem, whichField);
00309 
00310     if(FieldBits::NoField != (AlgorithmFieldMask & whichField))
00311     {
00312         _sfAlgorithm.copyFromBin(pMem);
00313     }
00314     if(FieldBits::NoField != (ProjectionModeFieldMask & whichField))
00315     {
00316         _sfProjectionMode.copyFromBin(pMem);
00317     }
00318     if(FieldBits::NoField != (ProjectionMatrixFieldMask & whichField))
00319     {
00320         _sfProjectionMatrix.copyFromBin(pMem);
00321     }
00322 }
00323 
00325 AlgorithmStagePtr AlgorithmStageBase::create(void)
00326 {
00327     AlgorithmStagePtr fc;
00328 
00329     if(getClassType().getPrototype() != NullFC)
00330     {
00331         fc = dynamic_cast<AlgorithmStage::ObjPtr>(
00332             getClassType().getPrototype()-> shallowCopy());
00333     }
00334 
00335     return fc;
00336 }
00337 
00339 AlgorithmStagePtr AlgorithmStageBase::createEmpty(void)
00340 {
00341     AlgorithmStagePtr returnValue;
00342 
00343     newPtr<AlgorithmStage>(returnValue);
00344 
00345     return returnValue;
00346 }
00347 
00348 FieldContainerPtr AlgorithmStageBase::shallowCopy(void) const
00349 {
00350     AlgorithmStagePtr returnValue;
00351 
00352     newPtr(returnValue, dynamic_cast<const AlgorithmStage *>(this));
00353 
00354     return returnValue;
00355 }
00356 
00357 
00358 
00359 /*------------------------- constructors ----------------------------------*/
00360 
00361 AlgorithmStageBase::AlgorithmStageBase(void) :
00362     Inherited(),
00363     _sfAlgorithm              (AlgorithmPtr(NullFC)),
00364     _sfProjectionMode         (UInt32(0x0001)),
00365     _sfProjectionMatrix       ()
00366 {
00367 }
00368 
00369 AlgorithmStageBase::AlgorithmStageBase(const AlgorithmStageBase &source) :
00370     Inherited(source),
00371     _sfAlgorithm              (NullFC),
00372     _sfProjectionMode         (source._sfProjectionMode         ),
00373     _sfProjectionMatrix       (source._sfProjectionMatrix       )
00374 {
00375 }
00376 
00377 
00378 /*-------------------------- destructors ----------------------------------*/
00379 
00380 AlgorithmStageBase::~AlgorithmStageBase(void)
00381 {
00382 }
00383 
00384 void AlgorithmStageBase::onCreate(const AlgorithmStage *source)
00385 {
00386     Inherited::onCreate(source);
00387 
00388     if(source != NULL)
00389     {
00390 
00391         this->setAlgorithm(source->getAlgorithm());
00392     }
00393 }
00394 
00395 GetFieldHandlePtr AlgorithmStageBase::getHandleAlgorithm       (void) const
00396 {
00397     SFAlgorithmPtr::GetHandlePtr returnValue(
00398         new  SFAlgorithmPtr::GetHandle(
00399              &_sfAlgorithm, 
00400              this->getType().getFieldDesc(AlgorithmFieldId)));
00401 
00402     return returnValue;
00403 }
00404 
00405 EditFieldHandlePtr AlgorithmStageBase::editHandleAlgorithm      (void)
00406 {
00407     SFAlgorithmPtr::EditHandlePtr returnValue(
00408         new  SFAlgorithmPtr::EditHandle(
00409              &_sfAlgorithm, 
00410              this->getType().getFieldDesc(AlgorithmFieldId)));
00411 
00412     returnValue->setSetMethod(boost::bind(&AlgorithmStage::setAlgorithm, 
00413                                           static_cast<AlgorithmStage *>(this), _1));
00414 
00415     editSField(AlgorithmFieldMask);
00416 
00417     return returnValue;
00418 }
00419 
00420 GetFieldHandlePtr AlgorithmStageBase::getHandleProjectionMode  (void) const
00421 {
00422     SFUInt32::GetHandlePtr returnValue(
00423         new  SFUInt32::GetHandle(
00424              &_sfProjectionMode, 
00425              this->getType().getFieldDesc(ProjectionModeFieldId)));
00426 
00427     return returnValue;
00428 }
00429 
00430 EditFieldHandlePtr AlgorithmStageBase::editHandleProjectionMode (void)
00431 {
00432     SFUInt32::EditHandlePtr returnValue(
00433         new  SFUInt32::EditHandle(
00434              &_sfProjectionMode, 
00435              this->getType().getFieldDesc(ProjectionModeFieldId)));
00436 
00437     editSField(ProjectionModeFieldMask);
00438 
00439     return returnValue;
00440 }
00441 
00442 GetFieldHandlePtr AlgorithmStageBase::getHandleProjectionMatrix (void) const
00443 {
00444     SFMatrix::GetHandlePtr returnValue(
00445         new  SFMatrix::GetHandle(
00446              &_sfProjectionMatrix, 
00447              this->getType().getFieldDesc(ProjectionMatrixFieldId)));
00448 
00449     return returnValue;
00450 }
00451 
00452 EditFieldHandlePtr AlgorithmStageBase::editHandleProjectionMatrix(void)
00453 {
00454     SFMatrix::EditHandlePtr returnValue(
00455         new  SFMatrix::EditHandle(
00456              &_sfProjectionMatrix, 
00457              this->getType().getFieldDesc(ProjectionMatrixFieldId)));
00458 
00459     editSField(ProjectionMatrixFieldMask);
00460 
00461     return returnValue;
00462 }
00463 
00464 
00465 #ifdef OSG_MT_CPTR_ASPECT
00466 void AlgorithmStageBase::execSyncV(      FieldContainer    &oFrom,
00467                                         ConstFieldMaskArg  whichField,
00468                                         AspectOffsetStore &oOffsets,
00469                                         ConstFieldMaskArg  syncMode,
00470                                   const UInt32             uiSyncInfo)
00471 {
00472     this->execSync(static_cast<AlgorithmStageBase *>(&oFrom),
00473                    whichField,
00474                    oOffsets,
00475                    syncMode,
00476                    uiSyncInfo);
00477 }
00478 #endif
00479 
00480 
00481 #ifdef OSG_MT_CPTR_ASPECT
00482 FieldContainerPtr AlgorithmStageBase::createAspectCopy(void) const
00483 {
00484     AlgorithmStagePtr returnValue;
00485 
00486     newAspectCopy(returnValue,
00487                   dynamic_cast<const AlgorithmStage *>(this));
00488 
00489     return returnValue;
00490 }
00491 #endif
00492 
00493 void AlgorithmStageBase::resolveLinks(void)
00494 {
00495     Inherited::resolveLinks();
00496 
00497     static_cast<AlgorithmStage *>(this)->setAlgorithm(NullFC);
00498 
00499 
00500 }
00501 
00502 
00503 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00504 DataType FieldTraits<AlgorithmStagePtr>::_type("AlgorithmStagePtr", "StagePtr");
00505 #endif
00506 
00507 
00508 OSG_END_NAMESPACE