odmcreate Command

Purpose

Produces the .c (source) and .h (include) files necessary for ODM application development and creates empty object classes.

Syntax

odmcreate-p ] [  -c -h] ClassDescriptionFile

Description

The odmcreate command is the ODM class compiler. The command takes as input an ASCII file that describes the objects a user wishes to use in a specific application. The odmcreate command can create empty object classes as part of its execution.

The output of the odmcreate command is a .h file (an include file) that contains the C language definitions for the object classes defined in the ASCII ClassDescriptionFile file. The resulting include file is used by the application for accessing objects stored in ODM. The odmcreate command also produces a .c file that must be compiled and bound in with the application. The .c file contains structures and definitions that are used internally by ODM at run time.

The ClassDescriptionFile parameter specifies an ASCII file that contains descriptions of one or more object classes. The general syntax for the ClassDescriptionFile parameter is as follows:

Item Description
file : classes
classes : class | classes class
class : head body tail
head : struct ClassName {
tail : }
body : elements
elements : elements | elements element
element :char DescriptorName [ DescriptorSize ];

vchar DescriptorName [ DescriptorSize ];

binary DescriptorName [ DescriptorSize ];

short DescriptorName ;

long DescriptorName ;

long64 or int64 or ODM_LONG_LONG DescriptorName ;

method DescriptorName ;

link StdClassName StdClassName ColName DescriptorName ;

The default suffix for a ClassDescriptionFile file is .cre. If no suffix is specified on the odmcreate command, then a .cre suffix is appended. The file can have C language comments if run with the -p flag, and can include #define and #include lines that can be preprocessed if the -p flag is used to run the C language preprocessor on the file.

Note: ODM databases are 32-bit databases. The long type, when used in the class description file is a 32-bit data item. The long64 or int64 type, when used in the class description file is a 64-bit data item. The generated files will function the same for both 32- and 64-bit applications.

Flags

Item Description
-c Creates empty object classes only; does not generate the C language .h and .c files.
-h Generates the .c and .h files only; does not create empty classes.
-p Runs the C language preprocessor on the ClassDescriptionFile file.

Example

Assuming that a ClassDescriptionFile file named FileName.cre exists, the following command creates object classes:

odmcreate FileName.cre

Below is the FileName.cre source file and the resulting .h file:

/* This is an example odmcreate input file */
/* FileName.cre */
   
       class Class2 {
            char keys[32];
            method card;
            long cash;
            };
      class TstObj {
            long a;
            char b[80];
            link Class2 Class2 card Class2Ln;
            };
   
/* End of FileName.cre */
   
/* This is the generated header file FileName.h */
  
#include <odmi.h>
   
struct Class2 {
     long _id;         /* unique object id within object class */
     long _reserved;   /* reserved field */
     long _scratch;    /* extra field for application use */
     char keys[32];
     char card[256];   /* method */
     long cash;
     };
#define Class2_Descs 3
   
extern struct Class Class2_CLASS[];
#define get_Class2_list (a,b,c,d,e) (struct Class2 * ) odm_get_list (a,b,c,d,e)
   
struct TstObj {
     long _id;         /* unique object id within object class */
     long _reserved;   /* reserved field */
     long _scratch;    /* extra field for application use */
     long a;
     char b[80];
     struct Class2 *Class2Ln;  /* link */
     struct objlistinfo *Class2Ln_info; /* link */
     char Class2Ln_Lvalue[256];        /* link */
     };
#define TstObj_Descs 3
   
extern struct Class TstObj_CLASS[];
#define get_TstObj_list (a,b,c,d,e) (struct TstObj * ) odm_get_list (a,b,c,d,e)
   
/* End of generated header file FileName.h */