# The Described Class Library

The class library provides the DescribedClass base class which provides mechanisms that allows programmers to retrieve information about a DescribedClass descendant's name; parents; and default, StateIn, and KeyVal constructors.

The special nature of described classes requires that the base class, DescribedClass, cannot provide everything needed. To assist the user in setting up described classes a helper class, ClassDesc, is provided. Foreach descendent of DescribedClass an object of type ClassDesc must be created. These objects should be static so they are initialized before main is entered.

The ClassDesc constructor takes the following arguments:

const std::type_info& typeinfo
  The type_info for this class, as returned by the C++ typeid operator.
const char *name
  The name of this class.
int version
  The version of this class. This is used to enable restoration of objects that were saved with older versions of a class. Version numbers must be 1 or greater.
const char *parents
  The parents of this class. This must be given exactly as it is given in the class declaration, including all qualifiers.
DescribedClass* (*ctor)()
  A function that creates an object of this type using the default constructor. The default is 0 (meaning that no constructor is available.
DescribedClass* (*keyval_ctor)(const Ref<KeyVal>&)
  A function that creates an object of this type using the KeyVal constructor. The default is 0.
DescribedClass* (*statein_ctor)(StateIn&)
  A function that creates an object of this type using the StateIn constructor. The default is 0.

For example, consider the class, D:

    class D: public B, public C {
      public:
        D();
    };

The file implementing D would contain the following line:

    static ClassDesc D_cd(typeid(D),"D",1,"public B, public C",create<D>);