Flow123d  DF_patch_fe_data_tables-b828b90
input_types.h
Go to the documentation of this file.
1 /**
2  * @defgroup input_types Input Types
3  *
4  * The purpose of the classes in the \p Input::Type namespace is to declare structure of the
5  * input data. There are few basic data types (scalar types), further there is Array type
6  * to declare sequences of data of common type. Similarly to C++ struct type, we provide
7  * type Record which is set of data of possibly different types indexed by string keys.
8  * Finally, we introduce kind of polymorphism through \p AbstractRecord type that mimics
9  * abstract classes.
10  *
11  * Types that are simple to construct (\p Array and scalar types) are
12  * cloned when the copy constructor is called (e.g. in Record::declare_key) On the other hand,
13  * some other types have nontrivial initialization (Record, AbstractRecord, Selection).
14  * The latter group is not cloned on copy operations, since these are mere
15  * \p boost::shared_ptr to structure with actual type. The copy constructor makes only copy of the
16  * shared pointer. These types are also named and their description can be provided.
17  *
18  * \section scalar_types Basic scalar types
19  *
20  * The basic scalar types are \p String, \p Bool, \p Integer, \p Double, and \p FileName. First four
21  * types directly corresponds to C++ types. Individual instances of \p String and \p Bool
22  * classes are identical.
23  * On the other hand, instances of Integer and Double classes
24  * can differ since you can specify the interval of the valid values.
25  * Finally, the type \p FileName is used for initialization of \p FilePath objects and
26  * thus can be either for input or for output file.
27  *
28  * Nontrivial scalar type is \p Selection which mimics and should be used to initialize
29  * C++ enum variables. The Selection object identifies possible integer values (that should
30  * corrspond to enum values) strings that should correspond to
31  * names of the values (should be same as names in enum).
32  *
33  * Unfortunately there is no way to get names of an enum type as strings so this information
34  * has to be provided through method @p add_value.
35  * Every @p Selection object has particular name and description.
36  * Description of individual values is optional.
37  *
38  * \section array_type Input::Type::Array
39  * The particular \p Array type is given by the type of its elementsand possibly
40  * by the limits for the array size. All the elements of the array must have same type, but
41  * you can use polymorphism provided by AbstractRecord.
42  *
43  *
44  * \section record_type Input::Type::Record
45  *
46  * One instance of @p Record is like one class definition in C++.
47  * You specify its members calling the method @p declare_key.
48  * Key names should be valid C++ keywords. Every key represents a value of arbitrary
49  * but given type. For every key, you can provide a default value and key description.
50  *
51  *
52  * \section abstract_record \ref Input::Type::AbstractRecord
53  *
54  * Mimics polymorphism of C++ classes. Any Record can be derived (using \p Recrod::derive method)
55  * from an AbstractRecord. This has two effects. First, all keys of the AbstractRecord
56  * are also members of the inheriting Record. Second, the actual input data for an AbstractRecord
57  * has to specify value of the special key 'TYPE' that provides name of one of descendants of
58  * the AbstractRecord. This mechanism allows to influence type of the input data by the input itself,
59  * but only from the declared set of descendants of the AbstractRecord.
60  *
61  *
62  *
63  * @ingroup input
64  *
65  */