Keywords: classdesc

Next: Limitations to classdesc Up: Object Reflection Previous: Using Classdesc: Method 2, Contents Index

## Synopsis of classdesc

Syntax:

  > `classdesc [-workdir` directory`] [-include` include-file`] [-I` directory`]` [-nodef] [-respect_private] [-typeName] descriptors...

`classdesc` takes as its input the preprocessed model definition file, that contains all class definitions available to the model. It outputs a functor definition that recursively calls itself for each of the members of that class. If `-workdir` is specified, the functor definitions are written to the specified directory for later compilation into a library. The (pre-expanded) source header file should also be included via the `-include` switch so that all necessary types are defined. If `-workdir` is not specified, the functor definitions are output as inline declarations on standard output.

Normally, classdesc reads its input from standard input, but some operating systems have trouble with this (eg Windows, but not Cygwin). An alternative is to specify the input file using the `-i` flag.

If `-I` switches are specified, the specified directory will be added to the search path for the action base include files.

If a type has been forward declared (eg `class foo;`), but not defined in classdesc's input source, a dummy definition is emitted of the form `class foo {};`. The purpose of this is to ensure that the action routines for types containing pointers to such declared types will compile. This behaviour can be turned off by specifying the `-nodef` option to classdesc.

By default, classdesc will generate descriptors that access private and protected members. If a class has private or protected members, a `CLASSDESC_ACCESS` (see §1.6) declaration needs to be given to allow access to the private members. Alternatively, it may be undesirable to expose the internals of an object, for example if the object is being exposed to a different programming environment. In such a case, the `-respect_private` can be used to suppress the accessing of private or protected members.

By default, enums are treated as integers. Sometimes it is desirable to treat them symbolically (see §5), and this is managed by the `-typeName` option.

Next: Limitations to classdesc Up: Object Reflection Previous: Using Classdesc: Method 2, Contents Index