OSG::Node Class Reference

#include <OSGNode.h>

Inheritance diagram for OSG::Node:

OSG::AttachmentContainer OSG::FieldContainer OSG::ReflexiveContainer List of all members.

dcast



typedef FieldContainerAttachment AttachmentObj
typedef FieldContainerAttachmentPtr AttachmentObjPtr
typedef SFFieldContainerAttachmentPtrMap SFAttachmentObjPtrMap
typedef SFAttachmentObjPtrMap::StoredType AttachmentObjPtrMap
typedef AttachmentObjPtrMap::iterator AttachmentObjPtrMapIt
 OSG_GEN_INTERNALPTR (AttachmentContainer)

Type definitions



static const bool isNodeCore = false
 OSG_GEN_INTERNALPTR (FieldContainer)
 OSG_RC_FIRST_FIELD_DECL (ChangedCallbacks)
 OSG_RC_LAST_FIELD_DECL (ChangedCallbacks)

Type information



static TypeObject _type
static void classDescInserter (TypeObject &oType)
static Char8 * getClassname (void)

Public Types

typedef AttachmentContainer Inherited
typedef AttachmentContainer ParentContainer
typedef Inherited::TypeObject TypeObject
typedef Node Self
Type definitions


typedef TypeObject::InitPhase InitPhase
typedef Field *(ReflexiveContainer::*) FieldEditMethod (void)
typedef const Field *(ReflexiveContainer::*) FieldGetMethod (void) const

Public Member Functions

 OSG_GEN_INTERNALPTR (Node)
 OSG_RC_FIRST_FIELD_DECL (Volume)
 OSG_RC_FIELD_DECL (TravMask, Volume)
 OSG_RC_FIELD_DECL (Parent, TravMask)
 OSG_RC_FIELD_DECL (Core, Parent)
 OSG_RC_FIELD_DECL (Children, Core)
 OSG_RC_LAST_FIELD_DECL (Children)
Constructors


NodeCorePtr getCore (void)
NodeCorePtr getCore (void) const
void setCore (NodeCorePtrConstArg core)
Destructor


NodePtr getParent (void)
Helper


UInt32 getNChildren (void) const
void addChild (NodePtrConstArg childP)
void insertChild (UInt32 childIndex, NodePtrConstArg childP)
void replaceChild (UInt32 childIndex, NodePtrConstArg childP)
bool replaceChildBy (NodePtrConstArg childP, NodePtrConstArg newChildP)
 return true on success, false on child not found
Int32 findChild (NodePtrConstArg childP) const
void subChild (NodePtrConstArg childP)
void subChild (UInt32 childIndex)
NodePtr getChild (UInt32 childIndex)
void clearChildren (void)
Get


void setTravMask (UInt32 uiMask)
UInt32 getTravMask (void) const
Binary Access


virtual UInt32 getBinSize (ConstFieldMaskArg whichField)
virtual void copyToBin (BinaryDataHandler &pMem, ConstFieldMaskArg whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, ConstFieldMaskArg whichField)
your_operators


Matrixr getToWorld (void)
void getToWorld (Matrixr &result)
Assignment


DynamicVolumeeditVolume (bool update=false)
const DynamicVolumegetVolume (void) const
void getWorldVolume (DynamicVolume &result)
void updateVolume (void)
virtual void invalidateVolume (void)
Comparison


virtual void changed (ConstFieldMaskArg whichField, UInt32 origin, BitVector details)
Dump


virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Dump


SFDynamicVolume * editSFVolume (void)
const SFDynamicVolume * getSFVolume (void) const
SFUInt32 * editSFTravMask (void)
const SFUInt32 * getSFTravMask (void) const
const SFNodePtr * getSFParent (void) const
const SFNodeCorePtr * getSFCore (void) const
const MFNodePtr * getMFChildren (void) const
Constructors


 OSG_RC_FIRST_FIELD_DECL (Attachments)
 OSG_RC_LAST_FIELD_DECL (Attachments)
Set


void addAttachment (const AttachmentObjPtr attachmentP, UInt16 binding=0)
void subAttachment (const AttachmentObjPtr attachmentP, UInt16 binding=0)
AttachmentObjPtr findAttachment (UInt32 groupId, UInt16 binding=0)
AttachmentObjPtr findAttachment (const FieldContainerType &type, UInt16 binding=0)
your_category


const SFAttachmentObjPtrMapgetSFAttachments (void) const
General Fieldcontainer Declaration


virtual OSG_SYSTEM_DLLMAPPING
TypeObject
getType (void)
virtual OSG_SYSTEM_DLLMAPPING
const TypeObject
getType (void) const
Get


virtual ObjPtr shallowCopy (void) const=0
Set


void callChangedFunctors (ConstFieldMaskArg whichField)
Container Access


UInt32 addChangedFunctor (ChangedFunctor func, std::string createSymbol)
template<class FunctorT>
void subChangedFunctor (FunctorT func)
void subChangedFunctor (UInt32 uiId)
void clearChangedFunctors (void)
Field Flags


const FieldFlagsgetFieldFlags (void)
Helper


OSG_SYSTEM_DLLMAPPING void addReference (void)
OSG_SYSTEM_DLLMAPPING void subReference (void)
OSG_SYSTEM_DLLMAPPING void subReferenceLocalVar (void)
OSG_SYSTEM_DLLMAPPING Int32 getRefCount (void) const
dcast


OSG_SYSTEM_DLLMAPPING UInt32 getTypeId (void) const
OSG_SYSTEM_DLLMAPPING UInt16 getGroupId (void) const
OSG_SYSTEM_DLLMAPPING const
Char8 * 
getTypeName (void) const
General Fieldcontainer Declaration


virtual UInt32 getContainerSize (void) const=0
Get Field


OSG_SYSTEM_DLLMAPPING UInt32 getNumFields (void) const
OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr editField (UInt32 fieldId)
OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr editField (const Char8 *fieldName)
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr getField (UInt32 fieldId) const
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr getField (const Char8 *fieldName) const
Get Field Description


OSG_SYSTEM_DLLMAPPING FieldDescriptionBasegetFieldDescription (UInt32 fieldId)
OSG_SYSTEM_DLLMAPPING FieldDescriptionBasegetFieldDescription (const Char8 *fieldName)
Comparison


OSG_SYSTEM_DLLMAPPING EditFieldHandlePtr invalidEditField (void)
OSG_SYSTEM_DLLMAPPING GetFieldHandlePtr invalidGetField (void) const

Static Public Member Functions

Get Class Type Information


static OSG_SYSTEM_DLLMAPPING
TypeObject
getClassType (void)
static OSG_SYSTEM_DLLMAPPING
UInt32 
getClassTypeId (void)
static OSG_SYSTEM_DLLMAPPING
UInt16 
getClassGroupId (void)

Public Attributes

dcast


 OSG_FIELD_CONTAINER_DECL
General Fieldcontainer Declaration


 OSG_ABSTR_FIELD_CONTAINER_DECL

Static Public Attributes

static const BitVector bLocalFieldMask
static const BitVector bInvLocalFieldMask = ~bLocalFieldMask
Constants


static const UInt32 NextFieldId = 1
static const BitVector NextFieldMask = 0x01

Protected Member Functions

Member


 Node (void)
 Node (const Node &source)
virtual ~Node (void)
Changed


void setParent (const NodePtr &parent)
Edit


EditFieldHandlePtr editHandleVolume (void)
GetFieldHandlePtr getHandleVolume (void) const
EditFieldHandlePtr editHandleTravMask (void)
GetFieldHandlePtr getHandleTravMask (void) const
GetFieldHandlePtr getHandleParent (void) const
EditFieldHandlePtr editHandleCore (void)
GetFieldHandlePtr getHandleCore (void) const
EditFieldHandlePtr editHandleChildren (void)
GetFieldHandlePtr getHandleChildren (void) const
Sync


virtual void resolveLinks (void)
Sync


EditFieldHandlePtr editHandleAttachments (void)
GetFieldHandlePtr getHandleAttachments (void) const
Edit


OSG_SYSTEM_DLLMAPPING void subReferenceUnresolved (void)
MT Construction


OSG_SYSTEM_DLLMAPPING void onCreateAspect (const FieldContainer *createAspect, const FieldContainer *source=NULL)
OSG_SYSTEM_DLLMAPPING void onCreate (const FieldContainer *source=NULL)
virtual OSG_SYSTEM_DLLMAPPING
void 
onDestroy (UInt32 uiContainerId)
Changed


OSG_SYSTEM_DLLMAPPING void onCreate (const ReflexiveContainer *source=NULL)
virtual OSG_SYSTEM_DLLMAPPING
void 
onDestroyAspect (UInt32 uiContainerId, UInt32 uiAspect)
MT Construction


virtual OSG_SYSTEM_DLLMAPPING
bool 
deregister (UInt32 uiContainerId)
MT Construction


OSG_SYSTEM_DLLMAPPING void registerChangedContainer (void)
virtual OSG_SYSTEM_DLLMAPPING
void 
registerChangedContainerV (void)
Local Edit


void editSField (ConstFieldMaskArg whichField)
template<class FieldT>
void editMField (ConstFieldMaskArg whichField, FieldT &oField)
MT Destruction


void execEndEdit (ConstFieldMaskArg whichField)
void clearChangeEntry (ContainerChangeEntry *pRef)
Edit


OSG_SYSTEM_DLLMAPPING void setId (UInt32 uiContainerId)
OSG_SYSTEM_DLLMAPPING UInt32 getId (void) const

Static Protected Member Functions

Fields


static void classDescInserter (TypeObject &oType)
MT Construction


template<class ObjectT>
static void newPtr (typename ObjectT::ObjPtr &result, const ObjectT *prototypeP)
template<class ObjectT>
static void newPtr (typename ObjectT::ObjPtr &result)
Init


static void initMethod (InitPhase ePhase)

Protected Attributes

Fields


SFDynamicVolume _sfVolume
SFUInt32 _sfTravMask
SFNodePtr _sfParent
MFNodePtr _mfChildren
SFNodeCorePtr _sfCore
Fields


SFAttachmentObjPtrMap _sfAttachments
Type information


FieldFlags_pFieldFlags
MFChangedFunctorCallback _mfChangedFunctors
Int32 _iRefCount
Member


BitVector _bvChanged
ContainerChangeEntry_pContainerChanges
UInt32 _uiContainerId

Private Member Functions

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

Friends

class FieldContainer
struct PointerFuncs
struct CPointerFuncs

Detailed Description

A Node in OpenSG is a node in the graph.

Nodes are responsible for holding children nodes and a link to their parent node.

Definition at line 70 of file OSGNode.h.


Member Typedef Documentation

Reimplemented from OSG::AttachmentContainer.

Definition at line 76 of file OSGNode.h.

Definition at line 77 of file OSGNode.h.

Reimplemented from OSG::AttachmentContainer.

Definition at line 81 of file OSGNode.h.

Reimplemented from OSG::AttachmentContainer.

Definition at line 83 of file OSGNode.h.

Definition at line 70 of file OSGAttachmentContainer.h.

typedef FieldContainerAttachmentPtr OSG::AttachmentContainer::AttachmentObjPtr [inherited]

Definition at line 71 of file OSGAttachmentContainer.h.

typedef SFFieldContainerAttachmentPtrMap OSG::AttachmentContainer::SFAttachmentObjPtrMap [inherited]

Definition at line 72 of file OSGAttachmentContainer.h.

typedef SFAttachmentObjPtrMap::StoredType OSG::AttachmentContainer::AttachmentObjPtrMap [inherited]

Definition at line 74 of file OSGAttachmentContainer.h.

typedef AttachmentObjPtrMap::iterator OSG::AttachmentContainer::AttachmentObjPtrMapIt [inherited]

Definition at line 75 of file OSGAttachmentContainer.h.

Reimplemented in OSG::ManipulatorBase, OSG::RotateManipulatorBase, OSG::MoveManipulatorBase, OSG::ScaleManipulatorBase, OSG::LineChunkBase, OSG::TwoSidedLightingChunkBase, OSG::PointChunkBase, OSG::PolygonChunkBase, OSG::ColorMaskChunkBase, OSG::CubeTextureObjChunkBase, OSG::TextureTransformChunkBase, OSG::StencilChunkBase, OSG::DepthChunkBase, OSG::ClipPlaneChunkBase, OSG::TransformChunkBase, OSG::ShaderChunkBase, OSG::ShaderParameterChunkBase, OSG::SHLChunkBase, OSG::SHLParameterChunkBase, OSG::ShaderParameterMatrixBase, OSG::ShaderParameterVec2fBase, OSG::ShaderParameterMVec4fBase, OSG::ShaderParameterIntBase, OSG::ShaderParameterMRealBase, OSG::ShaderParameterMIntBase, OSG::ShaderParameterMVec3fBase, OSG::ShaderParameterBoolBase, OSG::ShaderParameterVec4fBase, OSG::ShaderParameterBase, OSG::ShaderParameterMVec2fBase, OSG::ShaderParameterStringBase, OSG::ShaderParameterVec3fBase, OSG::ShaderParameterMMatrixBase, OSG::ShaderParameterRealBase, OSG::TextureSelectChunkBase, OSG::TextureObjRefChunkBase, OSG::RegisterCombinersChunkBase, OSG::VertexProgramChunkBase, OSG::ProgramChunkBase, OSG::FragmentProgramChunkBase, OSG::SimpleShadowMapEngineDataBase, OSG::SimpleShadowMapEngineBase, OSG::ShadowMapEngineBase, OSG::ScreenLODBase, OSG::TextureBackgroundBase, OSG::PassiveBackgroundBase, OSG::DepthClearBackgroundBase, OSG::PolygonBackgroundBase, OSG::TextureGrabBackgroundBase, OSG::SkyBackgroundBase, OSG::GradientBackgroundBase, OSG::SolidBackgroundBase, OSG::StereoBufferViewportBase, OSG::ColorBufferViewportBase, OSG::PassiveViewportBase, OSG::ProjectionCameraDecoratorBase, OSG::PerspectiveCameraBase, OSG::OrthographicCameraBase, OSG::OffCenterPerspectiveCameraBase, OSG::TileCameraDecoratorBase, OSG::MatrixCameraBase, OSG::MatrixCameraDecoratorBase, OSG::ShearedStereoCameraDecoratorBase, OSG::TextureGrabForegroundBase, OSG::FileGrabForegroundBase, OSG::GrabForegroundBase, OSG::ImageForegroundBase, OSG::PolygonForegroundBase, OSG::GLUTWindowBase, OSG::AlgorithmBase, OSG::AlgorithmStageBase, OSG::SimpleStageBase, OSG::StageDataBase, OSG::StageBase, OSG::DirectionalLightBase, OSG::SpotLightBase, OSG::PointLightBase, OSG::DistanceLODBase, OSG::SwitchBase, OSG::InverseTransformBase, OSG::TransformBase, OSG::VisitSubTreeBase, OSG::BillboardBase, OSG::ComponentTransformBase, OSG::InlineBase, OSG::ProxyGroupBase, OSG::MultiCoreBase, OSG::HDRStageDataBase, OSG::HDRStageBase, OSG::XWindowBase, OSG::SimpleStatisticsForegroundBase, OSG::MultiDisplayWindowBase, OSG::ImageComposerBase, OSG::ClusterWindowBase, OSG::SortFirstWindowBase, OSG::BinarySwapComposerBase, OSG::ParallelComposerBase, OSG::SepiaComposerBase, OSG::SortLastWindowBase, OSG::PipelineComposerBase, OSG::BalancedMultiWindowBase, OSG::TexGenChunkBase, OSG::MaterialChunkBase, OSG::TextureEnvChunkBase, OSG::LightChunkBase, OSG::StateChunkBase, OSG::StateBase, OSG::TextureBaseChunkBase, OSG::BlendChunkBase, OSG::TextureObjChunkBase, OSG::LightEngineBase, OSG::GroupBase, OSG::MaterialGroupBase, OSG::LightBase, OSG::LightEnvBase, OSG::ChunkOverrideGroupBase, OSG::MaterialDrawableBase, OSG::DrawableBase, OSG::ImageBase, OSG::SimpleAttachment< AttachmentDescT >, OSG::StringAttributeMapBase, OSG::ContainerPoolBase, OSG::ForegroundBase, OSG::BackgroundBase, OSG::CameraDecoratorBase, OSG::ViewportBase, OSG::CameraBase, OSG::RenderOptionsBase, OSG::PassiveWindowBase, OSG::WindowBase, OSG::StereoCameraDecoratorBase, OSG::FrameBufferAttachmentBase, OSG::TextureBufferBase, OSG::FBOViewportBase, OSG::RenderBufferBase, OSG::FrameBufferObjectBase, OSG::CubeTextureChunkBase, OSG::TextureChunkBase, OSG::StatisticsForegroundBase, OSG::SimpleTexturedMaterialBase, OSG::SimpleMaterialBase, OSG::ChunkMaterialBase, OSG::MaterialBase, OSG::MultiPassMaterialBase, OSG::SwitchMaterialBase, OSG::QuadTreeTerrainBase, OSG::TiledQuadTreeTerrainBase, OSG::ParticlesBase, OSG::GeometryBase, OSG::GeoIntegralPropertyBase, OSG::TypedGeoIntegralProperty< GeoPropertyDesc >, OSG::GeoPropertyBase, OSG::GeoMultiPropertyDataBase, OSG::GeoMultiPropertyBase, OSG::GeoVectorPropertyBase, OSG::TypedGeoVectorProperty< GeoPropertyDesc >, OSG::GeoStatsAttachmentBase, and OSG::StatsAttachmentBase.

Definition at line 77 of file OSGReflexiveContainer.h.

typedef Field*(ReflexiveContainer::*) OSG::ReflexiveContainer::FieldEditMethod(void) [inherited]

Definition at line 79 of file OSGReflexiveContainer.h.

typedef const Field*(ReflexiveContainer::*) OSG::ReflexiveContainer::FieldGetMethod(void) const [inherited]

Definition at line 81 of file OSGReflexiveContainer.h.


Constructor & Destructor Documentation

OSG::Node::Node ( void   )  [protected]

Definition at line 649 of file OSGNode.cpp.

00649                :
00650      Inherited (                            ),
00651     _sfVolume  (                            ),
00652     _sfTravMask(TypeTraits<UInt32>::getMax()),
00653     _sfParent  (NullFC                      ),
00654     _mfChildren(                            ),
00655     _sfCore    (NullFC                      )
00656 #ifdef OSG_1_COMPAT
00657    ,_occlusionMask(0)
00658 #endif
00659 {
00660 }

OSG::Node::Node ( const Node source  )  [protected]

Definition at line 662 of file OSGNode.cpp.

00662                              :
00663      Inherited    (source            ),
00664     _sfVolume     (                  ),
00665 
00666     _sfTravMask   (source._sfTravMask),
00667 
00668     _sfParent     (NullFC            ),
00669     _mfChildren   (                  ),
00670 
00671     _sfCore       (NullFC            )
00672 #ifdef OSG_1_COMPAT
00673    ,_occlusionMask(source._occlusionMask)
00674 #endif
00675 {
00676 }
/*-------------------------------------------------------------------------*/

OSG::Node::~Node ( void   )  [protected, virtual]

Definition at line 680 of file OSGNode.cpp.

00681 {
00682 }


Member Function Documentation

OSG::Node::OSG_GEN_INTERNALPTR ( Node   ) 

OSG::Node::OSG_RC_FIRST_FIELD_DECL ( Volume   ) 

OSG::Node::OSG_RC_FIELD_DECL ( TravMask  ,
Volume   
)

OSG::Node::OSG_RC_FIELD_DECL ( Parent  ,
TravMask   
)

OSG::Node::OSG_RC_FIELD_DECL ( Core  ,
Parent   
)

OSG::Node::OSG_RC_FIELD_DECL ( Children  ,
Core   
)

OSG::Node::OSG_RC_LAST_FIELD_DECL ( Children   ) 

NodeCorePtr OSG::Node::getCore ( void   )  [inline]

Definition at line 44 of file OSGNode.inl.

Referenced by getToWorld(), and updateVolume().

00045 {
00046     return _sfCore.getValue();
00047 }

NodeCorePtr OSG::Node::getCore ( void   )  const [inline]

Definition at line 50 of file OSGNode.inl.

References _sfCore.

00051 {
00052     return _sfCore.getValue();
00053 }

void OSG::Node::setCore ( NodeCorePtrConstArg  core  ) 

Set the core for this node. If core is NullFC, then clears the node core.

Parameters:
core The new node core to use

Definition at line 149 of file OSGNode.cpp.

References _sfCore, OSG::addRef(), OSG::FieldContainer::editSField(), NullFC, and OSG::subRef().

Referenced by editHandleCore().

00150 {
00151     editSField(CoreFieldMask);
00152 
00153     addRef(core);
00154 
00155     if(_sfCore.getValue() != NullFC)
00156     {
00157         _sfCore.getValue()->subParent(this);
00158 
00159         subRef(_sfCore.getValue());
00160     }
00161 
00162     _sfCore.setValue(core);
00163 
00164     if(_sfCore.getValue() != NullFC)
00165     {
00166         _sfCore.getValue()->addParent(this, CoreFieldId);
00167     }
00168 }

NodePtr OSG::Node::getParent ( void   )  [inline]

Definition at line 56 of file OSGNode.inl.

References _sfParent.

Referenced by changed(), getToWorld(), getWorldVolume(), and invalidateVolume().

00057 {
00058     return _sfParent.getValue();
00059 }

UInt32 OSG::Node::getNChildren ( void   )  const [inline]

Definition at line 62 of file OSGNode.inl.

References _mfChildren.

Referenced by clearChildren(), and insertChild().

00063 {
00064     return _mfChildren.size();
00065 }

void OSG::Node::addChild ( NodePtrConstArg  childP  ) 

Definition at line 173 of file OSGNode.cpp.

References _mfChildren, OSG::addRef(), OSG::FieldContainer::editMField(), and NullFC.

Referenced by editHandleChildren().

00174 {
00175     if(childP != NullFC)
00176     {
00177         // do the ref early, to prevent destroys on getParent(a)->addChild(a)
00178         addRef(childP);
00179 
00180         // already somebody else's child?
00181         if(childP->getParent() != NullFC)
00182         {
00183             childP->getParent()->subChild(childP);
00184         }
00185 
00186         editMField(ChildrenFieldMask, _mfChildren);
00187 
00188         _mfChildren.push_back(childP);
00189 
00190         childP->setParent(this);
00191     }
00192 }

void OSG::Node::insertChild ( UInt32  childIndex,
NodePtrConstArg  childP 
)

Insert child node into child list. Upon completion, getChild(childIndex) will return the new child. (ie. child is at childIndex pos in list) All other children after childIndex are moved back in list. If childP is Null, does nothing.

Warning:
childP is not ranged checked. Out of range values will have undefined behavior.
Parameters:
childIndex The location in the list to put the new child.
childP Pointer to the child to insert.

Definition at line 204 of file OSGNode.cpp.

References _mfChildren, OSG::addRef(), OSG::FieldContainer::editMField(), getNChildren(), NullFC, and OSG_ASSERT.

00205 {
00206     OSG_ASSERT((childIndex <= getNChildren()) && "Child index out of range");
00207 
00208     if(childP != NullFC)
00209     {
00210         // do the ref early, to prevent destroys on getParent(a)->addChild(a)
00211         addRef(childP);
00212 
00213         // already somebody else's child?
00214         if(childP->getParent() != NullFC)
00215         {
00216             childP->getParent()->subChild(childP);
00217         }
00218 
00219         editMField(ChildrenFieldMask, _mfChildren);
00220 
00221         MFNodePtr::iterator childIt = _mfChildren.begin();
00222 
00223         childIt += childIndex;
00224 
00225         _mfChildren.insert(childIt, childP);
00226 
00227         childP->setParent(this);
00228     }
00229 }

void OSG::Node::replaceChild ( UInt32  childIndex,
NodePtrConstArg  childP 
)

Definition at line 231 of file OSGNode.cpp.

References _mfChildren, OSG::addRef(), OSG::FieldContainer::editMField(), NullFC, and OSG::subRef().

00232 {
00233     if(childP != NullFC && childIndex < _mfChildren.size())
00234     {
00235         // do the ref early, to prevent destroys on getParent(a)->addChild(a)
00236         addRef(childP);
00237 
00238         // remove the current child
00239         _mfChildren[childIndex]->setParent(NullFC);
00240 
00241         subRef(_mfChildren[childIndex]);
00242 
00243         // already somebody else's child?
00244         if(childP->getParent() != NullFC)
00245         {
00246             childP->getParent()->subChild(childP);
00247         }
00248 
00249         editMField(ChildrenFieldMask, _mfChildren);
00250 
00251         // set the new child
00252         _mfChildren[childIndex] = childP;
00253 
00254         childP->setParent(this);
00255     }
00256 }

bool OSG::Node::replaceChildBy ( NodePtrConstArg  childP,
NodePtrConstArg  newChildP 
)

Definition at line 260 of file OSGNode.cpp.

References _mfChildren, OSG::addRef(), OSG::FieldContainer::editMField(), findChild(), NullFC, and OSG::subRef().

00262 {
00263     if(newChildP != NullFC)
00264     {
00265         Int32 childIdx = findChild(childP);
00266 
00267         if(childIdx != -1)
00268         {
00269             // do the ref early, to prevent destroys on
00270             // getParent(a)->addChild(a)
00271 
00272             addRef(newChildP);
00273 
00274             childP->setParent(NullFC);
00275 
00276             subRef(childP);
00277 
00278             // already somebody else's child?
00279             if(newChildP->getParent() != NullFC)
00280             {
00281                 newChildP->getParent()->subChild(newChildP);
00282             }
00283 
00284             editMField(ChildrenFieldMask, _mfChildren);
00285 
00286             _mfChildren[childIdx] = newChildP;
00287 
00288             newChildP->setParent(this);
00289 
00290             return true;
00291         }
00292     }
00293 
00294     return false;
00295 }

Int32 OSG::Node::findChild ( NodePtrConstArg  childP  )  const

Definition at line 297 of file OSGNode.cpp.

References _mfChildren.

Referenced by replaceChildBy(), and subChild().

00298 {
00299     UInt32 index;
00300 
00301     for(index = 0; index < _mfChildren.size(); index++)
00302     {
00303         if( _mfChildren[index] == childP)
00304             break;
00305     }
00306 
00307     if(index < _mfChildren.size())
00308     {
00309         return index;
00310     }
00311     else
00312     {
00313         return -1;
00314     }
00315 }

void OSG::Node::subChild ( NodePtrConstArg  childP  ) 

Definition at line 317 of file OSGNode.cpp.

References _mfChildren, OSG::FieldContainer::editMField(), findChild(), NullFC, OSG::subRef(), and SWARNING.

Referenced by clearChildren().

00318 {
00319     Int32 childIdx = findChild(childP);
00320 
00321     if(childIdx != -1)
00322     {
00323         editMField(ChildrenFieldMask, _mfChildren);