dynamic_castoperator. Nevertheless the "double dispatching" technique requires that the RTTI is more precise than just a downcast that succeeds or fails.
This tree is dynamic meaning that its shape depends on the execution and contains only the types that are in used.
Inherited type and name can be accessed:
You access to the component and the scene graph of a X3DTK::SFType by:
These informations are not really useful but are necessary to the working of the "double dispatching" technique.
Usually, node creation is not explicit, but is made by an abstract factory X3DTK::X3D::Creator that creates a node from its name, and is called by an X3DTK::X3DLoader, or by a processor that converts a scene graph to another one.
You can delete the node by calling explictly the delete operator, but it suppresses only the node and not its children. For that use the generic processor called X3DTK::MemReleaser that ensures you to delete all the sub-tree, except for shared nodes that are not deleted.
X3DTK::SFNode N = new X3D::Group(); // Gets the name of the type const X3DTK::SFString &name = N->getTypeName(); // Gets the component name of the type const X3DTK::SFString &com = N->getComponentName(); // Gets the scene graph name of the type const X3DTK::SFString &sg = N->getSceneGraphName(); // "X3D::Group" is displayed cout << sg << "::" << name << endl;
When a node is cloned and has children, they are not cloned but shared, nevertheless the clone has no father, otherwise the integrity of the scene graph would be in great danger!
Let's see how to delete a sub-tree where nodes are shared, and let's take the former nodes.