BALL 1.5.0
parameterSection.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: parameterSection.h,v 1.25 2005/12/23 17:01:46 amoll Exp $
5//
6
7// Format: general parameter section class
8
9#ifndef BALL_FORMAT_PARAMETERSECTION_H
10#define BALL_FORMAT_PARAMETERSECTION_H
11
12#ifndef BALL_DATATYPE_OPTIONS_H
14#endif
15
16namespace BALL
17{
18 class Parameters;
19
40 {
41 public:
42
44
45
46
48 static const String UNDEFINED;
49
50
54
56 enum
57 {
58 MAX_FIELDS = 20
59 };
60
62
66
70
73 ParameterSection(const ParameterSection& parameter_section) ;
74
78
80
83
92 bool extractSection(Parameters& parameters, const String& section_name)
93 ;
94
99 const String& getSectionName() const
100 ;
101
106 const String& getValue(const String& key, const String& variable) const
107 ;
108
117 bool has(const String& key, const String& variable) const ;
118
123 bool has(const String& key) const ;
124
127 bool hasVariable(const String& variable) const ;
128
133 Position getColumnIndex(const String& variable) const ;
134
138
142
146 const String& getValue(Position key_index, Position variable_index)
147 const ;
148
153 const String& getKey(Position key_index) const ;
154
156
159
162 virtual void clear()
163 ;
164
167 const ParameterSection& operator = (const ParameterSection& section)
168 ;
169
171
174
177 virtual bool isValid() const ;
178
181 bool operator == (const ParameterSection& parameter_section) const
182 ;
183
185
188
194
196
197 protected:
198
199 /*_ The name of the section.
200 */
202
203 /*_ The format line.
204 */
206
207 /*_ String hash map containing an index for each key.
208 This index is the index for the entries_ array.
209 */
211
212 /*_ String has map relating a variable name to the index in entries_.
213 */
215
216 /*_ One-dimensional array of the values read from the section.
217 The index of a specific value is calculated as
218 section_entries_[key] * number_of_variables_ * variable_names_[name]
219 */
220 std::vector<String> entries_;
221
222 /*_ One-dimensional array of the keys read from the section.
223 */
224 std::vector<String> keys_;
225
226 /*_ The number of variables specified in the format line.
227 Variables also include "ver:" entries.
228 */
230
231 /*_ The version numbers of each key.
232 */
233 std::vector<float> version_;
234
235 /*_ The valid flag.
236 */
237 bool valid_;
238
239 };
240} // namespace BALL
241
242#endif // BALL_FORMAT_PARAMETERSECTION_H
#define BALL_CREATE(name)
Definition: create.h:62
Definition: constants.h:13
BALL_EXPORT bool operator==(const String &s1, const String &s2)
bool extractSection(Parameters &parameters, const String &section_name)
Size getNumberOfVariables() const
Position getColumnIndex(const String &variable) const
std::vector< float > version_
StringHashMap< Index > section_entries_
bool hasVariable(const String &variable) const
ParameterSection(const ParameterSection &parameter_section)
const String & getValue(const String &key, const String &variable) const
Size getNumberOfKeys() const
virtual void clear()
const String & getSectionName() const
std::vector< String > keys_
virtual bool isValid() const
StringHashMap< Index > variable_names_
bool has(const String &key, const String &variable) const
const String & getKey(Position key_index) const
bool has(const String &key) const
const String & getValue(Position key_index, Position variable_index) const
std::vector< String > entries_
#define BALL_EXPORT
Definition: COMMON/global.h:50