12 #define TYPEDSWITCH_ADDCHILD_MACRO( OSGADDFUNC ) \
13 T* node = dynamic_cast<T*>( child ); \
14 if( node && !childrenAllowed() \
15 && !(node->getClassName().compare(getClassName())==0) )\
17 if( !OSGADDFUNC ) return false; \
18 if( node ) updateType( node->getType() ); \
48 virtual bool replaceChild( osg::Node *origChild, osg::Node *child )
50 if( !Switch::replaceChild( origChild, child ) )
57 virtual bool removeChildren(
unsigned int pos,
unsigned int numChildrenToRemove )
59 if( !( (pos+numChildrenToRemove-1) < _children.size() && numChildrenToRemove > 0 ) )
62 bool atLeastOneTNodeRemoved =
false;
63 for(
unsigned int i=pos; i < pos+numChildrenToRemove; ++i )
65 T* child =
dynamic_cast<T*
>( getChild( i ) );
68 atLeastOneTNodeRemoved =
true;
73 if( !Switch::removeChildren( pos, numChildrenToRemove ) )
87 for(
unsigned int i=0; i < getNumChildren(); ++i )
89 T* child =
dynamic_cast<T*
>( getChild(i) );
91 acquired_type |= child->
getType();
100 for(
unsigned int i=0; i < getNumParents(); ++i )
102 T* parent =
dynamic_cast<T*
>( getParent(i) );
int m_type
Definition: TypedSwitch.h:108
virtual bool insertChild(unsigned int index, osg::Node *child, bool value)
Definition: TypedSwitch.h:46
TypedSwitch(std::string className)
Definition: TypedSwitch.h:33
virtual bool childrenAllowed()
Definition: TypedSwitch.h:35
Definition: TypedSwitch.h:31
#define TYPEDSWITCH_ADDCHILD_MACRO(OSGADDFUNC)
Definition: TypedSwitch.h:12
ReservedTypes
Definition: TypedSwitch.h:31
const std::string & getClassName() const
Definition: TypedSwitch.h:37
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove)
Definition: TypedSwitch.h:57
virtual bool setChild(unsigned int index, osg::Node *child)
Definition: TypedSwitch.h:43
int getType() const
Definition: TypedSwitch.h:38
Definition: TypedSwitch.h:31
Definition: TypedSwitch.h:26
virtual bool addChild(osg::Node *child)
Definition: TypedSwitch.h:41
std::string m_className
Definition: TypedSwitch.h:109
virtual bool insertChild(unsigned int index, osg::Node *child)
Definition: TypedSwitch.h:42
virtual bool addChild(osg::Node *child, bool value)
Definition: TypedSwitch.h:45
void updateType(int type=UNSPECIFIED)
Definition: TypedSwitch.h:81
virtual bool replaceChild(osg::Node *origChild, osg::Node *child)
Definition: TypedSwitch.h:48
TypedSwitch T
Definition: TypedSwitch.h:29