Home You are here: Home > Support > Reference v1.0

Change language: German

Namespace / IDs

A namespace within the exom framewrok is used to combine a set of IDs. IDs are used to identify the three basic types of the framework, which are objects, atoms and functions.

Every ID is an instance of the related ID class. All three ID classes are derived from exom::XmID. In detail the following ID classes are used:

It is recommended to use one namespace for each module (library). All IDs of a module have to be attached to its namespace. A namespace will be implemented by deriving from exom::XmNamespace and creating a single instance from the derived class. According to this, the exom framework itself provide the namespace exom::xmn.

Here a sample for a small namespace:

class MyNamespaceInst : public XmNamespace
{
  public:
    XmObjID         OBJ_MY_OBJECT;
    XmAtmID         ATM_MY_INT;

    MyNamespaceInst ();
};

extern MyNamespaceInst myns;

The usage of those IDs can be seen at section The Object Model. The implementation of this class connect all IDs to their textual representation:

MyNamespaceInst::MyNamespaceInst()
{
    SetObj (OBJ_MY_OBJECT,  "OBJ_MY_OBJECT",    "myObject");
    SetAtm (ATM_MY_INT,     "ATM_MY_INT",       "myAtom");
}

MyNamespaceInst myns;

Note: The described implementation (using different classes for namespaces and IDs) may be look a little bit sophisticated at the first look, but it ensures a maximum of modularity, type safety and code transparency.


Copyright © 2006 Praetz Software Development - www.exomware.com