company logo

Createing context classes manually

In order to link a development resource (database model or GUI resource) to a context class, a resource reference has to be created for the resource (SDB_Resource::resource_ref). Most development resources inherit from SDB_Resource and, thus, support resource references. This is the minimum required for creating proper context class instances later on.

C## and OSI require the context class name defined in the resource reference, only. When implementing context function in C++, however, one has to provide a context interface implemented in a C-function CreateContext().

When a development resource is opened, it passes the resource reference number (SDB_ResourceRef::__AUTOIDENT) to the CreateContext() function, which has to be provided by the library containing the context class implementations (C++, only). Any number of resources can be associated with one context class.

Context classes can be assigned in the ClassEditor or Designer, which also generate link tables between context class name and resource identifier. Those are compiled in a C function (CreateContext()), which creates context class instances for complex and property instances, which are linked to a context class.

When not using Designer or ClassEditor, the CreateContext() function has to be defined manually in the application.