<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>The Described Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Mon Oct 14 14:18:08 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><a name="class"><h2>The Described Class Library</h2></a> 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. <p> 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. <p> The ClassDesc constructor takes the following arguments: <p> <dl compact> <dt><b>const std::type_info& typeinfo</b> <dd>The type_info for this class, as returned by the C++ typeid operator. <dt><b>const char *name</b> <dd>The name of this class. <dt><b>int version</b> <dd>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. <dt><b>const char *parents</b> <dd>The parents of this class. This must be given exactly as it is given in the class declaration, including all qualifiers. <dt><b>DescribedClass* (*ctor)()</b> <dd>A function that creates an object of this type using the default constructor. The default is 0 (meaning that no constructor is available. <dt><b>DescribedClass* (*keyval_ctor)(const Ref<KeyVal>&)</b> <dd>A function that creates an object of this type using the KeyVal constructor. The default is 0. <dt><b>DescribedClass* (*statein_ctor)(StateIn&)</b> <dd>A function that creates an object of this type using the StateIn constructor. The default is 0. </dl> <p> For example, consider the class, D: <p> <pre> class D: public B, public C { public: D(); }; </pre> <p> The file implementing D would contain the following line: <p> <pre> static ClassDesc D_cd(typeid(D),"D",1,"public B, public C",create<D>); </pre> <p> <hr> <address> <small> Generated at Mon Oct 14 14:18:08 2002 for <a href="http://aros.ca.sandia.gov/~cljanss/mpqc">MPQC</a> 2.1.2 using the documentation package <a href="http://www.stack.nl/~dimitri/doxygen/index.html">Doxygen</a> 1.2.5. </small> </address> </body> </html>