Loading...
 

Introduction

Introduction

Own C++ classes can be integrated into ClassiX®. However, only the Professional Edition contains the necessary tools. This concerns ClassiX® itself as well as the database. When a new model class is introduced, the following goals shall be achieved:

  1. InstantView® gets access to class data and methods.
  2. InstantView® instructions can be used to create instances of the newly introduced class.
  3. Instances of the new class can be saved in the database.

A new class to be introduced must be derived from CX_CLASS and some declarations must be added:

        class A : public CX_CLASS 
        {
            // eigene Deklarationen
            . . .
            // InstantView® Interface
            GENERIC  DDI(A)   MDI(A)   // durch Makros generiert
        };

If you absolutely want a strict separation of your class from the interface to InstantView®, you can introduce wrapper classes:

        class A  // eigene Klasse 
        {   // eigene Deklarationen
            . . .
        };
        class WrapperA : public CX_CLASS, public A
        {
           GENERIC  DDI(WrapperA)   MDI(WrapperA)
        };

In this way, you can also include classes that you do not have source code of. Among the declarations generated with the above-mentioned macros are definitions (functions and tables) in a .CPP file, which are generated with the utility CXGEND. In detail these are

  • a Data Dictionary (DDI), which allows InstantView® to access the class data
  • a Method Dictionary (MDI), which makes class functions accessible
  • virtual functions GetDDI / GetMDI, which connect an instance with the DDI / MDI of its class
  • static function New, which is called if a transient or persistent object is to be created with InstantView® instructions

CXGEND and the macros mentioned above do not only exist for the sake of more convenient writing. They should keep the possibility open to extend underlying layers - e.g. to support further (object-oriented) databases and other forms of storage. It is not recommended to write the corresponding C++ code manually!

An object can only be saved persistently in the database if the database knows the layout of its class. Therefore the Professional Edition contains the tools to generate a new database schema. The object manager controls where the instances of a class are stored within the database. This information is contained in the initialisation file CLASSIX.INI. New classes must be entered there and the DLL containing the new classes to be inserted is also made known to the object manager via CLASSIX.INI.