osg::VRMLSwitchDesc Class Reference
[VRML-specific File Input/Output]

VRML Switch Desc. More...

#include <OSGVRMLNodeDescs.h>

Inheritance diagram for osg::VRMLSwitchDesc:

osg::VRMLNodeDesc

List of all members.

Member



static UInt32 _uiIndent = 0
FieldNameTypeHash _mFieldTypes
GenericAttPtr _pGenAtt
FieldContainerPtr _pNodeProto
FieldContainerPtr _pNodeCoreProto
Field_pCurrField
std::string _szCurrentName
bool _bSaveOnEnd
FieldgetField (FieldContainerPtr pFC1, FieldContainerPtr pFC2, GenericAttPtr pGenAtt, const Char8 *szFieldname)

Public Member Functions

Constructors


 VRMLSwitchDesc (void)
Destructor


virtual ~VRMLSwitchDesc (void)
Helper


virtual void init (const Char8 *szName)
Field


virtual bool prototypeAddField (const Char8 *szFieldType, const UInt32 uiFieldTypeId, const Char8 *szFieldName)
virtual void endProtoInterface (void)
virtual void getFieldAndDesc (FieldContainerPtr pFC, const Char8 *szFieldname, Field *&pField, const FieldDescription *&pDesc)
Node


virtual FieldContainerPtr beginNode (const Char8 *szTypename, const Char8 *szName, FieldContainerPtr pCurrentFC)
virtual void endNode (FieldContainerPtr)
Dump


virtual void dump (const Char8 *szNodeName)
Helper


virtual void reset (void)
virtual void setOnEndSave (const Char8 *szName)
virtual void clearOnEndSave (void)
virtual bool getOnEndSave (void)
virtual const Char8getSavename (void)
virtual FieldContainerPtr getSaveFieldContainer (void)
Field


virtual FieldgetField (const Char8 *szFieldname)
Prototypes


virtual void prototypeAddFieldValue (const Char8 *szFieldVal)
FieldValue


virtual void addFieldValue (Field *pField, const Char8 *szFieldVal)
virtual bool use (FieldContainerPtr)

Static Public Member Functions

Class Get


static UInt32 getIndent (void)
static void incIndent (void)
static void decIndent (void)
static void resetIndent (void)

Protected Types

typedef std::map< const Char8
*, UInt32, LTString
FieldNameTypeHash

Private Types

typedef VRMLNodeDesc Inherited

Private Member Functions

 VRMLSwitchDesc (const VRMLSwitchDesc &source)
 prohibit default function (move to 'public' if needed)
void operator= (const VRMLSwitchDesc &source)
 prohibit default function (move to 'public' if needed)


Detailed Description

VRML Switch description

Definition at line 1397 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

Definition at line 1463 of file OSGVRMLNodeDescs.h.

typedef std::map< const Char8 *, UInt32, LTString> osg::VRMLNodeDesc::FieldNameTypeHash [protected, inherited]

Definition at line 298 of file OSGVRMLNodeDescs.h.


Constructor & Destructor Documentation

VRMLSwitchDesc::VRMLSwitchDesc ( void   ) 

Definition at line 4095 of file OSGVRMLNodeDescs.cpp.

04095                                    :
04096     Inherited()
04097 {
04098 }

VRMLSwitchDesc::~VRMLSwitchDesc ( void   )  [virtual]

Definition at line 4103 of file OSGVRMLNodeDescs.cpp.

04104 {
04105 }

osg::VRMLSwitchDesc::VRMLSwitchDesc ( const VRMLSwitchDesc source  )  [private]


Member Function Documentation

void VRMLSwitchDesc::init ( const Char8 szName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4110 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::DynFieldAttachment< AttachmentDescT >::create(), osg::SwitchBase::create(), osg::Node::create(), osg::VRMLNodeDesc::getIndent(), osg::indentLog(), and PINFO.

04111 {
04112 #ifdef OSG_DEBUG_VRML
04113     indentLog(getIndent(), PINFO);
04114     PINFO << "SwitchDesc::init : " << szName << std::endl;
04115 #endif
04116 
04117     _pNodeProto     = Node::create();
04118     _pNodeCoreProto = Switch::create();
04119 
04120     _pGenAtt        = GenericAtt::create();
04121     _pGenAtt->setInternal(true);
04122 }

bool VRMLSwitchDesc::prototypeAddField ( const Char8 szFieldType,
const UInt32  uiFieldTypeId,
const Char8 szFieldName 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4127 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pCurrField, osg::VRMLNodeDesc::prototypeAddField(), and osg::stringcasecmp().

04130 {
04131     bool bFound = false;
04132 
04133     _pCurrField = NULL;
04134 
04135     if(stringcasecmp("choice", szFieldname) == 0)
04136     {
04137         bFound = true;
04138     }
04139     else if(stringcasecmp("whichChoice", szFieldname) == 0)
04140     {
04141         bFound = true;
04142     }
04143 
04144     if(bFound == true)
04145     {
04146         return true;
04147     }
04148     else
04149     {
04150         return Inherited::prototypeAddField(szFieldType,
04151                                             uiFieldTypeId,
04152                                             szFieldname);
04153     }
04154 }

void VRMLSwitchDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4156 of file OSGVRMLNodeDescs.cpp.

04157 {
04158 }

void VRMLSwitchDesc::getFieldAndDesc ( FieldContainerPtr  pFC,
const Char8 szFieldname,
Field *&  pField,
const FieldDescription *&  pDesc 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4160 of file OSGVRMLNodeDescs.cpp.

References osg::AttachmentContainerPtr::dcast(), osg::NodePtr::dcast(), osg::VRMLNodeDesc::decIndent(), osg::NodePtr::getCore(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, PINFO, PWARNING, and osg::stringcasecmp().

04165 {
04166     if(szFieldname == NULL)
04167         return;
04168 
04169     if(pFC == NullFC)
04170         return;
04171 
04172     NodePtr pNode = NodePtr::dcast(pFC);
04173 
04174 #ifdef OSG_DEBUG_VRML
04175     indentLog(getIndent(), PINFO);
04176     PINFO << "VRMLSwitchDesc::getFieldAndDesc : looking for "
04177           << szFieldname
04178           << std::endl;
04179 #endif
04180 
04181     if(pNode == NullFC)
04182     {
04183         PWARNING << "VRMLSwitchDesc::getFieldAndDesc : No Node" << std::endl;
04184         return;
04185     }
04186 
04187     NodeCorePtr pNodeCore = pNode->getCore();
04188 
04189     SwitchPtr pSwitch      = SwitchPtr::dcast(pNodeCore);
04190 
04191     if(pSwitch == NullFC)
04192     {
04193         PWARNING << "VRMLSwitchDesc::getFieldAndDesc : No Switch" << std::endl;
04194         return;
04195     }
04196 
04197     incIndent();
04198 
04199     if(stringcasecmp("choice", szFieldname) == 0)
04200     {
04201 #ifdef OSG_DEBUG_VRML
04202         indentLog(getIndent(), PINFO);
04203         PINFO << "VRMLSwitchDesc::getFieldAndDesc :  : request internal "
04204               << szFieldname
04205               << std::endl;
04206 #endif
04207 
04208         pField = pNode->getField("children");
04209 
04210         if(pField != NULL)
04211             pDesc = pNode->getType().findFieldDescription("children");
04212     }
04213     else if(stringcasecmp("whichChoice", szFieldname) == 0)
04214     {
04215 #ifdef OSG_DEBUG_VRML
04216         indentLog(getIndent(), PINFO);
04217         PINFO << "VRMLSwitchDesc::getFieldAndDesc :  : request internal "
04218               << szFieldname
04219               << std::endl;
04220 #endif
04221 
04222         pField = pSwitch->getField("choice");
04223 
04224         if(pField != NULL)
04225             pDesc = pSwitch->getType().findFieldDescription("whichChoice");
04226     }
04227     else
04228     {
04229         VRMLNodeDesc::getFieldAndDesc(pSwitch,
04230                                       szFieldname,
04231                                       pField,
04232                                       pDesc);
04233     }
04234 
04235 #ifdef OSG_DEBUG_VRML
04236     decIndent();
04237 #endif
04238 }

FieldContainerPtr VRMLSwitchDesc::beginNode ( const Char8 szTypename,
const Char8 szName,
FieldContainerPtr  pCurrentFC 
) [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4243 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pGenAtt, osg::VRMLNodeDesc::_pNodeCoreProto, osg::VRMLNodeDesc::_pNodeProto, osg::beginEditCP(), osg::AttachmentContainerPtr::dcast(), osg::NodePtr::dcast(), osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::endEditCP(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, and PINFO.

04247 {
04248     FieldContainerPtr pFC         = NullFC;
04249     NodePtr           pNode       = NullFC;
04250     NodeCorePtr       pNodeCore   = NullFC;
04251     GenericAttPtr     pAtt        = NullFC;
04252 
04253     if(_pNodeProto != NullFC)
04254     {
04255         FieldContainerPtr pAttClone = _pGenAtt->emptyCopy();
04256 
04257         pAtt = GenericAttPtr::dcast(pAttClone);
04258 
04259         if(pAtt != NullFC)
04260         {
04261             pAtt->setInternal(true);
04262         }
04263 
04264         pFC = _pNodeProto->shallowCopy();
04265 
04266         pNode = NodePtr::dcast(pFC);
04267 
04268         pFC = _pNodeCoreProto->shallowCopy();
04269 
04270         pNodeCore = NodeCorePtr::dcast(pFC);
04271 
04272         beginEditCP(pNode);
04273         {
04274             pNode    ->setCore      (pNodeCore);
04275             pNodeCore->addAttachment(pAtt);
04276         }
04277         endEditCP  (pNode);
04278     }
04279 
04280 #ifdef OSG_DEBUG_VRML
04281     indentLog(getIndent(), PINFO);
04282     PINFO << "Begin Switch " << &(*pNode) << std::endl;
04283 
04284     incIndent();
04285 #endif
04286 
04287     return pNode;
04288 }

void VRMLSwitchDesc::endNode ( FieldContainerPtr  pFC  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4290 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::decIndent(), osg::VRMLNodeDesc::getIndent(), osg::indentLog(), and PINFO.

04291 {
04292 #ifdef OSG_DEBUG_VRML
04293     decIndent();
04294 
04295     indentLog(getIndent(), PINFO);
04296     PINFO << "End Switch "
04297           << &(*pFC) << std::endl;
04298 #endif
04299 }

void VRMLSwitchDesc::dump ( const Char8 szNodeName  )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4304 of file OSGVRMLNodeDescs.cpp.

04305 {
04306 }

void osg::VRMLSwitchDesc::operator= ( const VRMLSwitchDesc source  )  [private]

UInt32 VRMLNodeDesc::getIndent ( void   )  [static, inherited]

Definition at line 128 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_uiIndent.

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue(), osg::VRMLNodeFactory< BaseT >::beginEventInDecl(), osg::VRMLNodeFactory< BaseT >::beginEventOutDecl(), osg::VRMLViewpointDesc::beginNode(), osg::VRMLInlineDesc::beginNode(), osg::VRMLGroupDesc::beginNode(), beginNode(), osg::VRMLLODDesc::beginNode(), osg::VRMLPixelTextureDesc::beginNode(), osg::VRMLImageTextureDesc::beginNode(), osg::VRMLTextureTransformDesc::beginNode(), osg::VRMLAppearanceDesc::beginNode(), osg::VRMLGeometryPointSetDesc::beginNode(), osg::VRMLGeometryDesc::beginNode(), osg::VRMLShapeDesc::beginNode(), osg::VRMLFile::beginNode(), osg::VRMLNodeFactory< BaseT >::beginProto(), osg::VRMLFile::endField(), osg::VRMLViewpointDesc::endNode(), osg::VRMLInlineDesc::endNode(), osg::VRMLExtrusionDesc::endNode(), osg::VRMLGroupDesc::endNode(), endNode(), osg::VRMLLODDesc::endNode(), osg::VRMLPixelTextureDesc::endNode(), osg::VRMLImageTextureDesc::endNode(), osg::VRMLTextureTransformDesc::endNode(), osg::VRMLAppearanceDesc::endNode(), osg::VRMLGeometryObjectDesc::endNode(), osg::VRMLGeometryPointSetDesc::endNode(), osg::VRMLGeometryDesc::endNode(), osg::VRMLShapeDesc::endNode(), osg::VRMLFile::endNode(), osg::VRMLNodeFactory< BaseT >::findNodeDesc(), osg::VRMLNodeDesc::getField(), osg::VRMLViewpointDesc::getFieldAndDesc(), osg::VRMLInlineDesc::getFieldAndDesc(), osg::VRMLExtrusionDesc::getFieldAndDesc(), osg::VRMLGroupDesc::getFieldAndDesc(), getFieldAndDesc(), osg::VRMLLODDesc::getFieldAndDesc(), osg::VRMLAppearanceDesc::getFieldAndDesc(), osg::VRMLGeometryObjectDesc::getFieldAndDesc(), osg::VRMLGeometryPartDesc::getFieldAndDesc(), osg::VRMLGeometryPointSetDesc::getFieldAndDesc(), osg::VRMLGeometryDesc::getFieldAndDesc(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::VRMLFile::getFieldType(), osg::VRMLInlineDesc::init(), osg::VRMLExtrusionDesc::init(), osg::VRMLGroupDesc::init(), init(), osg::VRMLLODDesc::init(), osg::VRMLPixelTextureDesc::init(), osg::VRMLImageTextureDesc::init(), osg::VRMLTextureTransformDesc::init(), osg::VRMLMaterialDesc::init(), osg::VRMLAppearanceDesc::init(), osg::VRMLGeometryObjectDesc::init(), osg::VRMLGeometryPartDesc::init(), osg::VRMLGeometryPointSetDesc::init(), osg::VRMLGeometryDesc::init(), osg::VRMLShapeDesc::init(), osg::VRMLPixelTextureDesc::prototypeAddField(), osg::VRMLImageTextureDesc::prototypeAddField(), osg::VRMLTextureTransformDesc::prototypeAddField(), osg::VRMLMaterialDesc::prototypeAddField(), osg::VRMLGeometryPartDesc::prototypeAddField(), osg::VRMLGeometryPointSetDesc::prototypeAddField(), osg::VRMLGeometryDesc::prototypeAddField(), osg::VRMLShapeDesc::prototypeAddField(), osg::VRMLNodeDesc::prototypeAddField(), osg::VRMLFile::setContainerFieldValue(), and osg::VRMLFile::use().

00129 {
00130     return _uiIndent;
00131 }

void VRMLNodeDesc::incIndent ( void   )  [static, inherited]

void VRMLNodeDesc::decIndent ( void   )  [static, inherited]

void VRMLNodeDesc::resetIndent ( void   )  [static, inherited]

void VRMLNodeDesc::reset ( void   )  [virtual, inherited]

void VRMLNodeDesc::setOnEndSave ( const Char8 szName  )  [virtual, inherited]

Definition at line 209 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd, and osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::beginNode().

00210 {
00211     _szCurrentName = szName; // does that make a copy? I expect it to...
00212     _bSaveOnEnd = true;
00213 }

void VRMLNodeDesc::clearOnEndSave ( void   )  [virtual, inherited]

Definition at line 215 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00216 {
00217     _bSaveOnEnd = false;
00218 }

bool VRMLNodeDesc::getOnEndSave ( void   )  [virtual, inherited]

Definition at line 220 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

Referenced by osg::VRMLFile::endNode().

00221 {
00222     return _bSaveOnEnd;
00223 }

const Char8 * VRMLNodeDesc::getSavename ( void   )  [virtual, inherited]

Definition at line 225 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_szCurrentName.

Referenced by osg::VRMLFile::endNode().

00226 {
00227     return _szCurrentName.c_str();
00228 }

FieldContainerPtr VRMLNodeDesc::getSaveFieldContainer ( void   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 230 of file OSGVRMLNodeDescs.cpp.

References osg::NullFC.

Referenced by osg::VRMLFile::endNode().

00231 {
00232     return NullFC;
00233 }

Field * VRMLNodeDesc::getField ( const Char8 szFieldname  )  [virtual, inherited]

Field * VRMLNodeDesc::getField ( FieldContainerPtr  pFC1,
FieldContainerPtr  pFC2,
GenericAttPtr  pGenAtt,
const Char8 szFieldname 
) [protected, inherited]

Definition at line 607 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::decIndent(), osg::VRMLNodeDesc::getIndent(), osg::VRMLNodeDesc::incIndent(), osg::indentLog(), osg::NullFC, and PINFO.

00611 {
00612     Field *returnValue = NULL;
00613 
00614     if(szFieldname == NULL)
00615     {
00616         return returnValue;
00617     }
00618 
00619 #ifdef OSG_DEBUG_VRML
00620     indentLog(getIndent(), PINFO);
00621     PINFO << "VRMLNodeDesc::getField " << std::endl;
00622 
00623     incIndent();
00624 
00625     indentLog(getIndent(), PINFO);
00626     PINFO << "Trying to find field : " << szFieldname << std::endl;
00627 #endif
00628 
00629     if(pFC1 != NullFC)
00630     {
00631         returnValue = pFC1->getField(szFieldname);
00632     }
00633 
00634 #ifdef OSG_DEBUG_VRML
00635     incIndent();
00636 
00637     indentLog(getIndent(), PINFO);
00638     PINFO << "Got this from node : " << returnValue << std::endl;
00639 #endif
00640 
00641     if(returnValue != NULL)
00642         return returnValue;
00643 
00644     if(pFC2 != NullFC)
00645     {
00646         returnValue = pFC2->getField(szFieldname);
00647 
00648 #ifdef OSG_DEBUG_VRML
00649         indentLog(getIndent(), PINFO);
00650         PINFO << "Got this from nodecore : " << returnValue << std::endl;
00651 #endif
00652     }
00653     else
00654     {
00655 #ifdef OSG_DEBUG_VRML
00656         indentLog(getIndent(), PINFO);
00657         PINFO << "No core to check" << std::endl;
00658 #endif
00659     }
00660 
00661 
00662     if(returnValue != NULL)
00663         return returnValue;
00664 
00665     if(pGenAtt != NullFC)
00666     {
00667         returnValue = pGenAtt->getField(szFieldname);
00668     }
00669 
00670 #ifdef OSG_DEBUG_VRML
00671     indentLog(getIndent(), PINFO);
00672     PINFO << "Got this from attachment : " << returnValue << std::endl;
00673 
00674     decIndent();
00675     decIndent();
00676 #endif
00677 
00678     return returnValue;
00679 }

void VRMLNodeDesc::prototypeAddFieldValue ( const Char8 szFieldVal  )  [virtual, inherited]

Definition at line 477 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_pCurrField, and osg::Field::pushValueByStr().

Referenced by osg::VRMLNodeFactory< BaseT >::addFieldValue().

00478 {
00479     if(_pCurrField       != NULL)
00480     {
00481         _pCurrField->pushValueByStr(szFieldVal);
00482     }
00483 }

void VRMLNodeDesc::addFieldValue ( Field pField,
const Char8 szFieldVal 
) [virtual, inherited]

Reimplemented in osg::VRMLGeometryDesc, osg::VRMLGeometryPointSetDesc, and osg::VRMLPixelTextureDesc.

Definition at line 551 of file OSGVRMLNodeDescs.cpp.

References osg::Field::pushValueByStr().

Referenced by osg::VRMLFile::addFieldValue().

00553 {
00554     if(pField != NULL)
00555     {
00556         pField->pushValueByStr(szFieldVal);
00557     }
00558 }

bool VRMLNodeDesc::use ( FieldContainerPtr   )  [virtual, inherited]

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 560 of file OSGVRMLNodeDescs.cpp.

Referenced by osg::VRMLFile::use().

00561 {
00562     return false;
00563 }


Member Data Documentation

UInt32 VRMLNodeDesc::_uiIndent = 0 [static, protected, inherited]

Definition at line 307 of file OSGVRMLNodeDescs.h.

Field* osg::VRMLNodeDesc::_pCurrField [protected, inherited]

std::string osg::VRMLNodeDesc::_szCurrentName [protected, inherited]

bool osg::VRMLNodeDesc::_bSaveOnEnd [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:05:22 2008 for OpenSG by  doxygen 1.5.5