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.

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)

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)

Detailed Description

VRML Switch description

Definition at line 1414 of file OSGVRMLNodeDescs.h.


Member Typedef Documentation

Definition at line 1480 of file OSGVRMLNodeDescs.h.

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

Definition at line 300 of file OSGVRMLNodeDescs.h.


Constructor & Destructor Documentation

VRMLSwitchDesc::VRMLSwitchDesc ( void   ) 

Definition at line 4202 of file OSGVRMLNodeDescs.cpp.

04202                                    :
04203     Inherited()
04204 {
04205 }

VRMLSwitchDesc::~VRMLSwitchDesc ( void   )  [virtual]

Definition at line 4210 of file OSGVRMLNodeDescs.cpp.

04211 {
04212 }

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

Member Function Documentation

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

Reimplemented from osg::VRMLNodeDesc.

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4234 of file OSGVRMLNodeDescs.cpp.

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

04237 {
04238     bool bFound = false;
04239 
04240     _pCurrField = NULL;
04241 
04242     if(stringcasecmp("choice", szFieldname) == 0)
04243     {
04244         bFound = true;
04245     }
04246     else if(stringcasecmp("whichChoice", szFieldname) == 0)
04247     {
04248         bFound = true;
04249     }
04250 
04251     if(bFound == true)
04252     {
04253         return true;
04254     }
04255     else
04256     {
04257         return Inherited::prototypeAddField(szFieldType,
04258                                             uiFieldTypeId,
04259                                             szFieldname);
04260     }
04261 }

void VRMLSwitchDesc::endProtoInterface ( void   )  [virtual]

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4263 of file OSGVRMLNodeDescs.cpp.

04264 {
04265 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4267 of file OSGVRMLNodeDescs.cpp.

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

04272 {
04273     if(szFieldname == NULL)
04274         return;
04275 
04276     if(pFC == NullFC)
04277         return;
04278 
04279     NodePtr pNode = NodePtr::dcast(pFC);
04280 
04281 #ifdef OSG_DEBUG_VRML
04282     indentLog(getIndent(), PINFO);
04283     PINFO << "VRMLSwitchDesc::getFieldAndDesc : looking for "
04284           << szFieldname
04285           << std::endl;
04286 #endif
04287 
04288     if(pNode == NullFC)
04289     {
04290         PWARNING << "VRMLSwitchDesc::getFieldAndDesc : No Node" << std::endl;
04291         return;
04292     }
04293 
04294     NodeCorePtr pNodeCore = pNode->getCore();
04295 
04296     SwitchPtr pSwitch      = SwitchPtr::dcast(pNodeCore);
04297 
04298     if(pSwitch == NullFC)
04299     {
04300         PWARNING << "VRMLSwitchDesc::getFieldAndDesc : No Switch" << std::endl;
04301         return;
04302     }
04303 
04304     incIndent();
04305 
04306     if(stringcasecmp("choice", szFieldname) == 0)
04307     {
04308 #ifdef OSG_DEBUG_VRML
04309         indentLog(getIndent(), PINFO);
04310         PINFO << "VRMLSwitchDesc::getFieldAndDesc :  : request internal "
04311               << szFieldname
04312               << std::endl;
04313 #endif
04314 
04315         pField = pNode->getField("children");
04316 
04317         if(pField != NULL)
04318             pDesc = pNode->getType().findFieldDescription("children");
04319     }
04320     else if(stringcasecmp("whichChoice", szFieldname) == 0)
04321     {
04322 #ifdef OSG_DEBUG_VRML
04323         indentLog(getIndent(), PINFO);
04324         PINFO << "VRMLSwitchDesc::getFieldAndDesc :  : request internal "
04325               << szFieldname
04326               << std::endl;
04327 #endif
04328 
04329         pField = pSwitch->getField("choice");
04330 
04331         if(pField != NULL)
04332             pDesc = pSwitch->getType().findFieldDescription("whichChoice");
04333     }
04334     else
04335     {
04336         VRMLNodeDesc::getFieldAndDesc(pSwitch,
04337                                       szFieldname,
04338                                       pField,
04339                                       pDesc);
04340     }
04341 
04342 #ifdef OSG_DEBUG_VRML
04343     decIndent();
04344 #endif
04345 }

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4350 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.

04354 {
04355     FieldContainerPtr pFC         = NullFC;
04356     NodePtr           pNode       = NullFC;
04357     NodeCorePtr       pNodeCore   = NullFC;
04358     GenericAttPtr     pAtt        = NullFC;
04359 
04360     if(_pNodeProto != NullFC)
04361     {
04362         FieldContainerPtr pAttClone = _pGenAtt->emptyCopy();
04363 
04364         pAtt = GenericAttPtr::dcast(pAttClone);
04365 
04366         if(pAtt != NullFC)
04367         {
04368             pAtt->setInternal(true);
04369         }
04370 
04371         pFC = _pNodeProto->shallowCopy();
04372 
04373         pNode = NodePtr::dcast(pFC);
04374 
04375         pFC = _pNodeCoreProto->shallowCopy();
04376 
04377         pNodeCore = NodeCorePtr::dcast(pFC);
04378 
04379         beginEditCP(pNode);
04380         {
04381             pNode    ->setCore      (pNodeCore);
04382             pNodeCore->addAttachment(pAtt);
04383         }
04384         endEditCP  (pNode);
04385     }
04386 
04387 #ifdef OSG_DEBUG_VRML
04388     indentLog(getIndent(), PINFO);
04389     PINFO << "Begin Switch " << &(*pNode) << std::endl;
04390 
04391     incIndent();
04392 #endif
04393 
04394     return pNode;
04395 }

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

Reimplemented from osg::VRMLNodeDesc.

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

Reimplemented from osg::VRMLNodeDesc.

Definition at line 4411 of file OSGVRMLNodeDescs.cpp.

04412 {
04413 }

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

Reimplemented from osg::VRMLNodeDesc.

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

Definition at line 118 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::VRMLInlineDesc::endNode(), osg::VRMLExtrusionDesc::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::VRMLPixelTextureDesc::prototypeAddField(), osg::VRMLImageTextureDesc::prototypeAddField(), osg::VRMLTextureTransformDesc::prototypeAddField(), osg::VRMLMaterialDesc::prototypeAddField(), osg::VRMLGeometryPartDesc::prototypeAddField(), osg::VRMLGeometryPointSetDesc::prototypeAddField(), osg::VRMLGeometryDesc::prototypeAddField(), osg::VRMLShapeDesc::prototypeAddField(), osg::VRMLFile::setContainerFieldValue(), and osg::VRMLFile::use().

00119 {
00120     return _uiIndent;
00121 }

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 203 of file OSGVRMLNodeDescs.cpp.

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

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

00204 {
00205     _szCurrentName = szName; // does that make a copy? I expect it to...
00206     _bSaveOnEnd = true;
00207 }

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

Definition at line 209 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

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

00210 {
00211     _bSaveOnEnd = false;
00212 }

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

Definition at line 214 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_bSaveOnEnd.

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

00215 {
00216     return _bSaveOnEnd;
00217 }

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

Definition at line 219 of file OSGVRMLNodeDescs.cpp.

References osg::VRMLNodeDesc::_szCurrentName.

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

00220 {
00221     return _szCurrentName.c_str();
00222 }

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

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 224 of file OSGVRMLNodeDescs.cpp.

References osg::NullFC.

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

00225 {
00226     return NullFC;
00227 }

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 604 of file OSGVRMLNodeDescs.cpp.

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

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

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

Definition at line 472 of file OSGVRMLNodeDescs.cpp.

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

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

00473 {
00474     if(_pCurrField       != NULL)
00475     {
00476         _pCurrField->pushValueByStr(szFieldVal);
00477     }
00478 }

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

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

Definition at line 546 of file OSGVRMLNodeDescs.cpp.

References osg::Field::pushValueByStr().

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

00548 {
00549     if(pField != NULL)
00550     {
00551         pField->pushValueByStr(szFieldVal);
00552     }
00553 }

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

Reimplemented in osg::VRMLAppearanceDesc.

Definition at line 555 of file OSGVRMLNodeDescs.cpp.

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

00556 {
00557     return false;
00558 }


Member Data Documentation

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

Definition at line 309 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 8 Feb 2010 for OpenSG by  doxygen 1.6.1