The Source File Structure

For each SOS schema module a separate C++ interface and implementation file is generated from the internal representation of the schema in the object base. The interface consists of type and class definitions that may be used by other C++ implementation modules. All user defined methods and operations must be implemented separately. If the schema defines external types, the generated interface includes a file with the definition of these types. This implementation as well as the generated implementation can then be compiled and linked to all applications that make use of the given schema module. The embedding of schemas into C++ is sketched in Figure [*].

Figure: Embedding of SOS into C++
\begin{figure}\begin{center}
\
\vspace*{2mm}
\psfig{figure=figures/cplusplus.epsi,height=11.6cm,width=14.3cm}
\vspace*{2mm}
\end{center}
\end{figure}

The generated interface files for a schema with name <s> are <s>_sos.h and <s>_use.h. The file <s>_sos.h is only needed by the implementor of the methods defined in the schema, whereas <s>_use.h makes up the interface to other C++ programs. As a further result of the compilation process an implementation file <s>_sos.c is generated, that contains the implementation of the predefined function methods, e.g. methods to access the object base. This file, as well as the files containing the implementation of the remaining methods provided by the schema implementor, must be compiled. The resulting object files can then be statically linked to an executable. Programs that are not linked with these object files but access instances of classes defined in schema <s> will have to load these files dynamically at the time the first instance of a type declared in schema <s> is accessed.

The definition of the external types, if any, is expected in a file named <s>_ext.h. This file must also be provided, if the schema <s> contains a with extern declaration.