The INamespace graph node interface. More...

#include "murl_graph_i_namespace.h"

Inheritance diagram for Murl::Graph::INamespace:

Public Member Functions

virtual INodeGetNodeInterface ()=0
 Get the mutable Graph::INode interface. More...
 
virtual const INodeGetNodeInterface () const =0
 Get the constant Graph::INode interface. More...
 
virtual Bool RegisterNode (const String &name, INode *node)=0
 Register a given node with this namespace. More...
 
virtual Bool UnregisterNode (const String &name, INode *node)=0
 Unregister a given node from this namespace. More...
 
virtual Bool RegisterSubNamespace (const String &name, INamespace *nameSpace)=0
 Register a given sub-namespace with this namespace. More...
 
virtual Bool UnregisterSubNamespace (const String &name, INamespace *nameSpace)=0
 Unregister a given sub-namespace from this namespace. More...
 
virtual INodeFindNode (const String &nodeIdPath)=0
 Find a mutable node within the namespace's sub-graph. More...
 
virtual const INodeFindNode (const String &nodeIdPath) const =0
 Find a constant node within the namespace's sub-graph. More...
 

Detailed Description

The INamespace graph node interface.

When interacting with a scene graph, it is useful and often necessary to retrieve a reference to a specific node from within a large graph via a given node ID.

Generally, such node IDs must be unique; to facilitate organization of node hierarchies it is possible to restrict this uniqueness to the sub-graph below a given INamespace node. In such a case, a specific node can be found in the graph by prepending the namespace's ID followed by a slash ('/') to the actual node ID. This scheme also works for nested namespaces, by simply concatenating such namespace prefixes.

When referring to a specific node from a given other node, the path to the target node can be expressed very much like the notation commonly used in a UNIX-like file path, with '.' representing the current namespace, '..' the parent, and a leading '/' the root namespace.

Example, assuming the graph is instantiated at root level:

<Graph>
<Namespace id="nmspc1">
<Namespace id="nmspc2">
<!-- The node that gets referenced in this example -->
<Node id="node1"/>
<!-- The following five references target the node from the same namespace -->
<Reference targetId="node1"/>
<Reference targetId="./node1"/>
<Reference targetId="../nmspc2/node1"/>
<Reference targetId="../../nmspc1/nmspc2/node1"/>
<Reference targetId="/nmspc1/nmspc2/node1"/>
<!-- ... several other ways exist -->
</Namespace>
<Namespace id="nmspc3">
<!-- The following two references target the node from a sibling namespace -->
<Reference targetId="../nmspc2/node1"/>
<Reference targetId="/nmspc1/nmspc2/node1"/>
<!-- ... several other ways exist -->
</Namespace>
</Namespace>
</Graph>

Note, when targeting a node from a Logic::IProcessor, it is always assumed to start the search from the root level, i.e. namespaces must always be specified.

A namespace node can also be referenced from another node; the given ID represents both a separator for its children as well as a regular ID.

See Graph::INode::SetId() for a description of valid IDs.

Member Function Documentation

◆ GetNodeInterface() [1/2]

virtual INode* Murl::Graph::INamespace::GetNodeInterface ( )
pure virtual

Get the mutable Graph::INode interface.

This method returns a mutable pointer to the node's Graph::INode interface, to be able to query or modify common node properties such as active state, visibility or ID.

Returns
The mutable Graph::INode interface, or null if not available

Referenced by Murl::Logic::GraphObservableNode< NodeType >::FindNode().

◆ GetNodeInterface() [2/2]

virtual const INode* Murl::Graph::INamespace::GetNodeInterface ( ) const
pure virtual

Get the constant Graph::INode interface.

This method returns a constant pointer to the node's Graph::INode interface, to be able to query common node properties such as active state, visibility or ID.

Returns
The constant Graph::INode interface, or null if not available

◆ RegisterNode()

virtual Bool Murl::Graph::INamespace::RegisterNode ( const String name,
INode node 
)
pure virtual

Register a given node with this namespace.

This method registers a given node with the current namespace, using a given (single) node ID. Registering will only succeed if the given ID is valid and not empty, no other node or namespace is already registered with the same ID, and the ID does not represent a complex path.

Parameters
nameThe ID of the node to register.
nodeThe node to register.
Returns
true if successful.

◆ UnregisterNode()

virtual Bool Murl::Graph::INamespace::UnregisterNode ( const String name,
INode node 
)
pure virtual

Unregister a given node from this namespace.

This method unregisters a previously registered node from the current namespace, using a given (single) node ID. Unregistering will fail if no node is currently registered with the given ID, or the registered node does not match the given input node.

Parameters
nameThe ID of the node to unregister.
nodeThe node to unregister.
Returns
true if successful.

◆ RegisterSubNamespace()

virtual Bool Murl::Graph::INamespace::RegisterSubNamespace ( const String name,
INamespace nameSpace 
)
pure virtual

Register a given sub-namespace with this namespace.

This method registers a given other namespace with the current namespace, using a given (single) node ID. Registering will only succeed if the given ID is valid and not empty, no other node or namespace is already registered with the same ID, and the ID does not represent a complex path.

Parameters
nameThe ID of the sub-namespace to register.
nameSpaceThe sub-namespace to register.
Returns
true if successful.

◆ UnregisterSubNamespace()

virtual Bool Murl::Graph::INamespace::UnregisterSubNamespace ( const String name,
INamespace nameSpace 
)
pure virtual

Unregister a given sub-namespace from this namespace.

This method unregisters a previously registered other namespace from the current namespace, using a given (single) node ID. Unregistering will fail if no namespace is currently registered with the given ID, or the registered sub-namespace does not match the given input namespace.

Parameters
nameThe ID of the sub-namespace to unregister.
nameSpaceThe sub-namespace to unregister.
Returns
true if successful.

◆ FindNode() [1/2]

virtual INode* Murl::Graph::INamespace::FindNode ( const String nodeIdPath)
pure virtual

Find a mutable node within the namespace's sub-graph.

This method tries to find and return the node at the given path within the sub-graph below this namespace.

Parameters
nodeIdPathThe node ID to find, with optional path specification when searching in sub-namespaces.
Returns
A pointer to the requested node, or null if not found.

Referenced by Murl::Logic::GraphObservableNode< NodeType >::FindNode().

◆ FindNode() [2/2]

virtual const INode* Murl::Graph::INamespace::FindNode ( const String nodeIdPath) const
pure virtual

Find a constant node within the namespace's sub-graph.

This method tries to find and return the node at the given path within the sub-graph below this namespace.

Parameters
nodeIdPathThe node ID to find, with optional path specification when searching in sub-namespaces.
Returns
A pointer to the requested node, or null if not found.

The documentation for this interface was generated from the following file:
  • murl_graph_i_namespace.h


Copyright © 2011-2024 Spraylight GmbH.