company logo

Steps to convert from OSI to typed access

The steps described here are typical steps, which have to performed in order to change an OSI implementation into a C++ implementation. Most of the steps are supported by ClassEditor .

When not using ClassEditor , one may also call several OSI functions implemented in ode.dev , which requires a data source definition including the ode.dev as resource database (see example below). After providing the ini-file as described below, one may call OShell and run the OSI calls mentioned in the subsequent topics.

The methods called in the subsequent topics may be also called from within ClassEditor by selecting the menu item ... more/Run Action from the class tree context menu and entering the corresponding OSI function name.

// OShell.ini for method conversion

// ODABA_ROOT has to be set to the installation folder befor calling

[SYSTEM]

DICTIONARY=%ODABA_ROOT%/ode.sys

[OShell]

DSC_Language=English

PLATFORM_INDEPENDENT=YES

[ResDB]

DICTIONARY=%ODABA_ROOT%/ode.sys

RESOURCES=%ODABA_ROOT%/ode.dev

DATABASE=project.dev

NET=YES

ACCESS_MODE=Write

// run OShell

... OShell OShell.ini

ODABA>cd ResDB

ResDB>

Upgrade classes

It is not only rather boring writing the header files for the complex data types defined in the application manually, but the risk to fail is high. Hence, data type definitions should be generated from class definitions in the resource database. Usually, complex data types are not yet upgraded to classes, except, OSI functions had been implemented. In order to compile C++ classes, one usually needs C++ header files for all data types.

Moreover, setting for OSI classes and OSI functions have to be changed, which might be done manually, but could also be done by running the following actions:

  • ODC_Project ::CreateClasses - Creates classes for all complex data type defined in the project, which are not yet defined as classes
  • ODC_Project ::ConvertToCPP - Changes the settings for classes and functions to CPP


ResDB>cc ODC_Project

ResDB/ODC_Project>osi "CreateClasses('PL_CPP')"

ResDB/ODC_Project>cc .

ResDB/ODC_Project>osi ConvertToCPP

ResDB/ODC_Project>cc .

Notes:

After running an OSI function the shell locates the result location. In order to return to the project, one has to change the collection (cc .) going one level up in the hierarchy.

Prepare external resources

In order to create external resources (source and header files as well as project definitions), necessary folders have to be provided (when not yet existing). Moreover, several project resources have to be generated for compiling classes later on. In the first step, folders according to definitions in the project are created. In the second step, project definitions for compiling the project area created.

Preparing resources includes two steps:

  • Initialize external resources - creates sub folders for the project and initializes compiler resources
  • Generate project definitions - creates compile procedures for compiling the project

The actions may be called via OShell or directly from the ClassEditor 's main menu ( Project/Initialize Externeal Resources and Generate/Generate Project Definitions ).

ResDB>cc ODC_Project

ResDB/ODC_Project>osi InitializeExternalResources

ResDB/ODC_Project>cc .

ResDB/ODC_Project>osi "GPD_Generate('',false)"

ResDB/ODC_Project>cc .

Generate source and header files

In order to compile external resources, source code and header files have to be generated from the resource database. Dependencies between classes have already detected and after executing source and header files one may try to compile.

In order to generate classes properly, two steps are required:

  • Generate all header files
  • Generate all source files

The actions may be called via OShell or directly from the ClassEditor 's main menu ( Generate/Generate Header Files and Generate/Generate Source Files ).

ResDB>cc ODC_Project

ResDB/ODC_Project>osi 'CL_Includes(true)'

ResDB/ODC_Project>cc .

ResDB/ODC_Project>osi 'CL_Sources(true)'

ResDB/ODC_Project>cc .

Compile classes

In order to compile the classes, one may call the compile procedures stored in the cmd sub folder. Unfortunately, OSI is not 100% compatible and, probably,some changes in the source code become necessary. .