The root namespace. More...
#include <InstantIO/Root.h>
Classes | |
class | ReadLock |
Helper class for exception-safe read-locking. More... | |
class | WriteLock |
Helper class for exception-safe write-locking. More... | |
Public Member Functions | |
virtual | ~Root () |
Destroys the Root object. | |
void | readLock () |
Locks the whole InstantIO system for read access. | |
void | writeLock () |
Locks the whole InstantIO system for write access. | |
void | unlock () |
Unlocks the whole InstantIO system. | |
Namespace * | getNamespaceFromPath (const std::string &ns) |
Tries to find a Namespace in a subtree of Namespaces. | |
Static Public Member Functions | |
static Root & | the () |
Returns the single instance of the Root class. | |
Protected Member Functions | |
Root () | |
Creates a new Root object. | |
Friends | |
class | NodeType |
The root namespace.
InSlots and OutSlots have to be added to Namespaces to connect them to each other. But there is one major problem: How do two software components that do not know anything about each other add their InSlots and OutSlots to the same Namespace?
The Root class is the answer to this question. It serves as a root namespace for all namespaces used by the software system. Root is a singleton, i.e. there exists exactly one instance of the root. Therefore, it is not possible to create new instances of the Root class (the constructor is private). Instead, software components that need to access the single instance have to call the static method the, as demonstrated in the following example:
Root &root = Root::the();
InstantIO::Root::Root | ( | ) | [protected] |
Creates a new Root object.
static Root& InstantIO::Root::the | ( | ) | [inline, static] |
Returns the single instance of the Root class.
Namespace* InstantIO::Root::getNamespaceFromPath | ( | const std::string & | ns | ) |
Tries to find a Namespace in a subtree of Namespaces.
ns | The path to the Namespace. The path consists of the names of the Namespaces, starting from the root, down to the searched Namespace, divided by slashes ("/"). |
InvalidNamespaceException | when the method cannot find the Namespace in the subtree. |