source: ThirdParty/mpqc_open/src/lib/util/class/class.dox@ a844d8

Candidate_v1.6.1
Last change on this file since a844d8 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 2.0 KB
Line 
1
2/** \page class The Described Class Library
3
4The class library provides the DescribedClass base class which provides
5mechanisms that allows programmers to retrieve information about a
6DescribedClass descendant's name; parents; and default, StateIn, and KeyVal
7constructors.
8
9The special nature of described classes requires that the base class,
10DescribedClass, cannot provide everything needed. To assist the user in
11setting up described classes a helper class, ClassDesc, is provided.
12Foreach descendent of DescribedClass an object of type ClassDesc must be
13created. These objects should be static so they are initialized before
14main is entered.
15
16The ClassDesc constructor takes the following arguments:
17
18<dl>
19<dt><b>const std::type_info& typeinfo</b>
20 <dd>The type_info for this class, as returned by the C++ typeid operator.
21<dt><b>const char *name</b>
22 <dd>The name of this class.
23<dt><b>int version</b>
24 <dd>The version of this class. This is used to enable restoration
25 of objects that were saved with older versions of a class.
26 Version numbers must be 1 or greater.
27<dt><b>const char *parents</b>
28 <dd>The parents of this class. This must be given exactly
29 as it is given in the class declaration, including all
30 qualifiers.
31<dt><b>DescribedClass* (*ctor)()</b>
32 <dd>A function that creates an object of this type using the
33 default constructor. The default is 0 (meaning that no
34 constructor is available.
35<dt><b>DescribedClass* (*keyval_ctor)(const Ref<KeyVal>&)</b>
36 <dd>A function that creates an object of this type using the
37 KeyVal constructor. The default is 0.
38<dt><b>DescribedClass* (*statein_ctor)(StateIn&)</b>
39 <dd>A function that creates an object of this type using the
40 StateIn constructor. The default is 0.
41</dl>
42
43For example, consider the class, D:
44
45<pre>
46class D: public B, public C {
47 public:
48 D();
49};
50</pre>
51
52The file implementing D would contain the following line:
53
54<pre>
55static ClassDesc D_cd(typeid(D),"D",1,"public B, public C",create\<D\>);
56</pre>
57
58*/
Note: See TracBrowser for help on using the repository browser.