Home You are here: Home > exom SDK > Object Model


Valid HTML 4.01 Transitional


Change language: German

The Object Model

The Extensible Object Model is the basement of the exom framework. This Model is designed to support the extensions mentioned in the chapter before. Typical for an Object Model is the existence of an object class, which is the base class for other classes, to enable them being part of the Object Model. In the exom framework  this base class is exom::XmObject. To support a maximum of flexibility the main design goals of this framework were:
  • simplicity of usage
  • minimal wastage of system resources
  • easy integration in different environments
To support this flexibility and the described features the base class exom::XmObject have the following characteristics:
  • small interface - 12 virtual methods.
  • contains no member data
  • empty constructor/destructor
  • no usage of macros and templates
To get a short impression about the simplicity of making a class part of the Object Model look at the following example.

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

Now this class is ready to be used in the exom framework. Normally you will add some members like strings, integers, ... or other classes. To enable these members managed by the exom framework, they have to be connected to their superior class as the following example shows.

class MyClass : public XmObject
{
    int         myInt;
    MySubClass  mySubClass
    // --- XmObject ---
    XMOBJ     ObjectID () const         { return myns.OBJ_MY_OBJECT; }
    void      manage   (XmMan& m)
    {
        m.manInt32 (myInt, myns.OBJ_MY_OBJECT);
        m.manObj   (mySubClass);
    }
};

One line of code for each member. Nothing else. More infos about this in section Object Model in the Reference Documentation.


Advantages to other Object Models

There exist other well known Object Models out there used in  object oriented programming. So why using the Object Model of the exom framework. The main difference to many other Object Models is that the storage of data can be implemented in native C++ data hierarchy via classes and members, instead of using a complex  DOM tree. Benefits:
  • Simple data handling by using type safe data access, instead of using unsafe typecasting.
  • Low usage of memory (native data)
  • No data conversions when processing data.
  • Simple data types like int, char, bool,... are stored without any administration data (like IntNode, CharNode,...)
  • Support std::string as atomic member
  • The object (array) base class XmObject (XmArray) use no additional member attributes, which enable the reduction of memory and time (and problems) for copying them.
Copyright © 2006 Praetz Software Development - www.exomware.com