Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

ParameterSection Class Reference
[General Purpose File Formats]

General Parameter Section Class. More...

#include <parameterSection.h>

Inheritance diagram for ParameterSection:

AtomTypes CharmmEEF1 ClaverieParameter CosineTorsion LennardJones Potential1210 QuadraticAngleBend QuadraticBondStretch QuadraticImproperTorsion RDFParameter RDFSection ResidueTorsions SolventParameter Templates List of all members.

Public Types

Enums
enum  { MAX_FIELDS = 20 }

Public Member Functions

Constructors and Destructors
 ParameterSection () throw ()
 Default constructor.
 ParameterSection (const ParameterSection &parameter_section) throw ()
 Copy constructor.
virtual ~ParameterSection () throw ()
 Destructor.
Extracting Data from the Section
bool extractSection (Parameters &parameters, const String &section_name) throw ()
 Reads a parameter section from an INI file.
const StringgetSectionName () const throw ()
 Return the name of the section read.
const StringgetValue (const String &key, const String &variable) const throw ()
 Returns the value associated with the key and returns the value of the given variable.
bool has (const String &key, const String &variable) const throw ()
 Query for a pair of key and variable.
bool has (const String &key) const throw ()
 Query for a key.
bool hasVariable (const String &variable) const throw ()
 Query whether a specified variable was defined in the format line.
Position getColumnIndex (const String &variable) const throw ()
 Return the column index of a variable.
Size getNumberOfVariables () const throw ()
 Returns the number of defined variables.
Size getNumberOfKeys () const throw ()
 Returns the number of different keys defined.
const StringgetValue (Position key_index, Position variable_index) const throw ()
 Fast access to the value array.
const StringgetKey (Position key_index) const throw ()
 Fast access to the key array.
Assignment
virtual void clear () throw ()
 Clear method.
const ParameterSectionoperator= (const ParameterSection &section) throw ()
 Assignment operator.
Predicates
virtual bool isValid () const throw ()
 Validity predicate.
bool operator== (const ParameterSection &parameter_section) const throw ()
 Equality operator.

Public Attributes

Public Members
Options options
 The options read in from options lines contained in this section.

Static Public Attributes

const String UNDEFINED
 Result Type for unknown items.

Protected Attributes

String section_name_
String format_line_
StringHashMap< Indexsection_entries_
StringHashMap< Indexvariable_names_
std::vector< Stringentries_
std::vector< Stringkeys_
Size number_of_variables_
std::vector< float > version_
bool valid_

Detailed Description

General Parameter Section Class.

It is similar to INIFile , but a little bit more sophisticated. Just as in a INIFile there can be comment lines starting with either "<b>;</b>", "<b>!</b>" or "<b>\#</b>" and it is divided in sections. A section-line looks like "<b>[ElectricFieldEffect]</b>". The first non-comment line in a section is the format-line. It defines the sort of values stored in the section and their order:

"<b>key:residue key:atom value:charge </b>"
Option lines start with a "<b>@ </b>":
"<b>@exclude_residue_field=true </b>"
The values are stored in fields seperated by whitespaces in the order given by their format-line:
"<b> Ca Ca 9.6 </b>"
Each value line may contain version information, indicated by a variable definition named "ver"; thus only the latest version will be version will be accessed.


Constructor & Destructor Documentation

ParameterSection::ParameterSection  )  throw ()
 

Default constructor.

virtual ParameterSection::~ParameterSection  )  throw () [virtual]
 

Destructor.


Member Function Documentation

virtual void ParameterSection::clear  )  throw () [virtual]
 

Clear method.

Reimplemented in AtomTypes, CharmmEEF1, CosineTorsion, LennardJones, Potential1210, QuadraticAngleBend, QuadraticBondStretch, QuadraticImproperTorsion, ResidueTorsions, Templates, ClaverieParameter, SolventParameter, RDFParameter, and RDFSection.

bool ParameterSection::extractSection Parameters parameters,
const String section_name
throw ()
 

Reads a parameter section from an INI file.

This method reads the section given in section_name from ini_file, interprets (if given) a format line, reads the data from this section according to the format, and builds some datastructures for fast and easy acces to the data.

Parameters:
parameters the parameters defining the inifile to be read from
section_name the name of the section to be read (without the squared brackets)
Returns:
bool - true if the section could be read, false otherwise

Reimplemented in AtomTypes, CharmmEEF1, CosineTorsion, LennardJones, Potential1210, QuadraticAngleBend, QuadraticBondStretch, QuadraticImproperTorsion, ResidueTorsions, Templates, SolventParameter, and RDFSection.

Position ParameterSection::getColumnIndex const String variable  )  const throw ()
 

Return the column index of a variable.

If section doesn't have the variable, INVALID_POSITION is returned.

const String& ParameterSection::getKey Position  key_index  )  const throw ()
 

Fast access to the key array.

The first key has the index 0. If the key is undefined, UNDEFINED is returned.

Size ParameterSection::getNumberOfKeys  )  const throw ()
 

Returns the number of different keys defined.

Size ParameterSection::getNumberOfVariables  )  const throw ()
 

Returns the number of defined variables.

const String& ParameterSection::getSectionName  )  const throw ()
 

Return the name of the section read.

The section name is empty before extractSection was called.

Returns:
the name of the section extracted

const String& ParameterSection::getValue Position  key_index,
Position  variable_index
const throw ()
 

Fast access to the value array.

If the value is undefined, UNDEFINED is returned.

const String& ParameterSection::getValue const String key,
const String variable
const throw ()
 

Returns the value associated with the key and returns the value of the given variable.

If the requested variable is not defined in the format line, an empty string is returned.

bool ParameterSection::has const String key  )  const throw ()
 

Query for a key.

False is returned if the key could not be found.

Parameters:
key the key to serch in the hash table

Reimplemented in Templates.

bool ParameterSection::has const String key,
const String variable
const throw ()
 

Query for a pair of key and variable.

False is returned if

  • the key could not be found
  • the the key was found but the variable name was not specified in the format line

bool ParameterSection::hasVariable const String variable  )  const throw ()
 

Query whether a specified variable was defined in the format line.


Member Data Documentation

Options ParameterSection::options
 

The options read in from options lines contained in this section.

Remember: options lines start with "@" as the first character and must be of the form "@name=value".

const String ParameterSection::UNDEFINED [static]
 

Result Type for unknown items.