Loading...
Searching...
No Matches
parameterSection.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: parameterSection.h,v 1.25 2005/12/23 17:01:46 amoll Exp $
//
// Format: general parameter section class
#ifndef BALL_FORMAT_PARAMETERSECTION_H
#define BALL_FORMAT_PARAMETERSECTION_H
#ifndef BALL_DATATYPE_OPTIONS_H
# include <BALL/DATATYPE/options.h>
#endif
namespace BALL
{
class Parameters;
class BALL_EXPORT ParameterSection
{
public:
BALL_CREATE(ParameterSection)
static const String UNDEFINED;
enum
{
MAX_FIELDS = 20
};
ParameterSection() ;
ParameterSection(const ParameterSection& parameter_section) ;
virtual ~ParameterSection() ;
bool extractSection(Parameters& parameters, const String& section_name)
;
const String& getSectionName() const
;
const String& getValue(const String& key, const String& variable) const
;
bool has(const String& key, const String& variable) const ;
bool has(const String& key) const ;
bool hasVariable(const String& variable) const ;
Position getColumnIndex(const String& variable) const ;
Size getNumberOfVariables() const ;
Size getNumberOfKeys() const ;
const String& getValue(Position key_index, Position variable_index)
const ;
const String& getKey(Position key_index) const ;
virtual void clear()
;
const ParameterSection& operator = (const ParameterSection& section)
;
virtual bool isValid() const ;
bool operator == (const ParameterSection& parameter_section) const
;
Options options;
protected:
/*_ The name of the section.
*/
String section_name_;
/*_ The format line.
*/
String format_line_;
/*_ String hash map containing an index for each key.
This index is the index for the entries_ array.
*/
StringHashMap<Index> section_entries_;
/*_ String has map relating a variable name to the index in entries_.
*/
StringHashMap<Index> variable_names_;
/*_ One-dimensional array of the values read from the section.
The index of a specific value is calculated as
section_entries_[key] * number_of_variables_ * variable_names_[name]
*/
std::vector<String> entries_;
/*_ One-dimensional array of the keys read from the section.
*/
std::vector<String> keys_;
/*_ The number of variables specified in the format line.
Variables also include "ver:" entries.
*/
Size number_of_variables_;
/*_ The version numbers of each key.
*/
std::vector<float> version_;
/*_ The valid flag.
*/
bool valid_;
};
} // namespace BALL
#endif // BALL_FORMAT_PARAMETERSECTION_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Options
Definition options.h:48
BALL::ParameterSection::extractSection
bool extractSection(Parameters &parameters, const String &section_name)
BALL::ParameterSection::getNumberOfVariables
Size getNumberOfVariables() const
BALL::ParameterSection::getColumnIndex
Position getColumnIndex(const String &variable) const
BALL::ParameterSection::version_
std::vector< float > version_
Definition parameterSection.h:233
BALL::ParameterSection::~ParameterSection
virtual ~ParameterSection()
BALL::ParameterSection::format_line_
String format_line_
Definition parameterSection.h:205
BALL::ParameterSection::ParameterSection
ParameterSection()
BALL::ParameterSection::section_entries_
StringHashMap< Index > section_entries_
Definition parameterSection.h:210
BALL::ParameterSection::hasVariable
bool hasVariable(const String &variable) const
BALL::ParameterSection::number_of_variables_
Size number_of_variables_
Definition parameterSection.h:229
BALL::ParameterSection::section_name_
String section_name_
Definition parameterSection.h:201
BALL::ParameterSection::ParameterSection
ParameterSection(const ParameterSection &parameter_section)
BALL::ParameterSection::valid_
bool valid_
Definition parameterSection.h:237
BALL::ParameterSection::getValue
const String & getValue(const String &key, const String &variable) const
BALL::ParameterSection::getNumberOfKeys
Size getNumberOfKeys() const
BALL::ParameterSection::options
Options options
Definition parameterSection.h:193
BALL::ParameterSection::UNDEFINED
static const String UNDEFINED
Definition parameterSection.h:48
BALL::ParameterSection::clear
virtual void clear()
BALL::ParameterSection::getSectionName
const String & getSectionName() const
BALL::ParameterSection::keys_
std::vector< String > keys_
Definition parameterSection.h:224
BALL::ParameterSection::isValid
virtual bool isValid() const
BALL::ParameterSection::MAX_FIELDS
@ MAX_FIELDS
Definition parameterSection.h:58
BALL::ParameterSection::variable_names_
StringHashMap< Index > variable_names_
Definition parameterSection.h:214
BALL::ParameterSection::has
bool has(const String &key, const String &variable) const
BALL::ParameterSection::getKey
const String & getKey(Position key_index) const
BALL::ParameterSection::has
bool has(const String &key) const
BALL::ParameterSection::getValue
const String & getValue(Position key_index, Position variable_index) const
BALL::ParameterSection::entries_
std::vector< String > entries_
Definition parameterSection.h:220
BALL::Parameters
Definition parameters.h:25
BALL::StringHashMap
Definition stringHashMap.h:42
BALL::String
Definition string.h:57
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
options.h