Overview

To generate a new class library from an EXPRESS schema, you must use the EXPRESS compiler. This will create C++ source code in the classes subdirectory. Next, either generate a Makefile with the mkmakefile tool, or create a Visual Studio project and add the source files to it.

There are a few flags that you may want to use when you call the EXPRESS compiler. The pre-installed class libraries give all of the classes the "stp_" prefix. You can do this using the -prefix flag.

Specifying a workingset file with the -ws flag will let you generate the C++ classes for complex instances. You can find sample workingset files provided for each of the AP schemas.

# generate the c++ classes
% expfront -classes -writenone -prefix stp_ \
	-ws myschema.ws myschema.exp

# create unix and windows makefiles
% mkmakefile -unix  -d classes -lib myschema
% mkmakefile -win32 -d classes -lib myschema

The workingset file can also be used to change the names of classes and files, select subsets of definitions, generate extra aggregate classes, and other things. Refer to the EXPRESS Compiler documentation for more information.

Common Header File

To simplify sharing of code between the class libraries, we add a stp_schema.h and stp_schema.cxx file to each class library. These wrap the header file and force load function named after the schema. The stp_schema.h file contains:

  #include "[schema-name].h
  extern void stp_schema_force_load();
And the stp_schema.cxx file contains:
  #include "[schema-name].h
  #include "[schema-name]_ROSE_LOAD.h

  void stp_schema_force_load() {
     [schema-name]_force_load();
  }

We have also added a number of #define aliases to the header file to support alternate names for the AND/OR complex classes. These are documented in the class lists for each AP. If you regenerate one of the class libraries, consider copying over these aliases as well.