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

Change language: German

The Object Model

Objects

As the name of the exom framework intends, the Object Model is the fundament of this framework.

The main class of the Object Model is exom::XmObject. This class and the optional container property (described later) are used to structure data models. XmObject enables you to create an arbitrary complex class hierarchy. To support a maximum of fexibility the main design goals of this framwork were:

  • simplicity of usage
  • minimal wastage of system resources
  • easy integration in different environments

To support this flexibility and the decribed features the exom::XmObject have the following characteristics:

  • small interface
  • contains no member data
  • empty constructor/destructor

If a class should be managed by the exom framework it have to be derived from this class and implement the two functions:

class MyClass : public XmObject
{
    // --- XmObject ---
    XMOBJ     ObjectID () const         { return myns.OBJ_MY_OBJECT; }
    void      manage (XmMan& m);
};

The method exom::XmObject::ObjectID() set an unique ID for an object. The method exom::XmObject::manage() connect subobjects and atomic data to an object. The connection to subobjects is done by using the context class exom::XmMan in the manage() method:

class MyClass : public XmObject
{
    MySubClass  subObject
    ...
    // --- XmObject ---
    void      manage (XmMan& m)
    {
        m.manObj (subObject);
    }
};

So the only way to connect objects to each other have to be done by the manage() method. There is always a mother-child relationship. The framework itself provide no reference from the child to its mother object, so it is possible to connect the same object to multiple mother objects, if it is needed. To retrieve information about the mother in a special context exom::XmPathInfo shall be used (e.g. when handling user actions).

Container

A Container is an exom::XmObject providing an exom::XmArray interface. It gives the possibility to contain an unlimited number of object items derived from exom::XmObject too. So the overhead for each item is the virtual function table pointer, because derving from the virtual class XmObject.

To support containers, your class have to return the interface to an implementaion of exom::XmArray.

class MyClass : public XmObject, public TXmObjectVector <MyItem>
{
    ...
    // --- XmObject ---
    XmArray*  GetArray()                { return this; }
};

The framework ships three generic implementations of the exom::XmArray interface:

Atomic data

Atomic data are the leaves in the object model. They are used to store elementar data like, integers, strings, ... (see section Simple data types). They are called atomic data, because it is not possible to subdivde them. There is excactly no memory overhead when using atomic data. The connection to their superior object is done in the following way:

// --- XmObject ---
void      MyClass::manage (XmMan& m)
{
    m.manInt32 (myInt, myns.ATM_MY_INT);
}

As you see in the example the exom::XmObject::manage() interface method and the context class exom::XmMan is used to establish a connection.


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