Loading...
Searching...
No Matches
options.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: options.h,v 1.26.14.1 2007/03/25 21:23:40 oliver Exp $
//
#ifndef BALL_DATATYPE_OPTIONS_H
#define BALL_DATATYPE_OPTIONS_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif
#ifndef BALL_DATATYPE_STRINGHASHMAP_H
# include <BALL/DATATYPE/stringHashMap.h>
#endif
#include <BALL/FORMAT/paramFile.h>
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_CONCEPT_PERSISTENTOBJECT_H
# include <BALL/CONCEPT/persistentObject.h>
#endif
namespace BALL
{
class BALL_EXPORT Options
: public StringHashMap<String>
{
public:
BALL_CREATE(Options)
static const Size MAX_ENTRY_LENGTH;
Options();
Options(const Options& options);
virtual ~Options();
const Options& operator = (const Options& options);
virtual void clear();
bool isInteger(const String& key) const;
bool isBool(const String& key) const;
bool isReal(const String& key) const;
bool isVector(const String& key) const;
bool isSet(const String& key) const;
void addParameterDescription(const String& key, String description, ParamFile::ParameterType type, list<String>* allowed_values = NULL);
/* Return the description that was registered for the parameter identified by the given key */
const ParamFile::ParameterDescription* getParameterDescription(const String& key) const;
Options* createSubcategory(String name);
Options* getSubcategory(String name);
StringHashMap<Options*>::Iterator
beginSubcategories();
StringHashMap<Options*>::Iterator
endSubcategories();
void setName(const String& name);
const String& getName() const;
String get(const String& key) const;
bool getBool(const String& key) const;
double getReal(const String& key) const;
Vector3 getVector(const String& key) const;
long getInteger(const String& key) const;
void set(const String& key, const String& value);
void setReal(const String& key, const double value);
void setVector(const String& key, const Vector3& value);
void setInteger(const String& key, const long value);
void setBool(const String& key, const bool value);
String setDefault(const String& key, const String& value);
long setDefaultInteger(const String& key, const long value);
double setDefaultReal(const String& key, const double value);
bool setDefaultBool(const String& key, const bool value);
bool readOptionFile(const String& filename);
bool writeOptionFile(const String& filename) const;
void write(PersistenceManager& pm) const;
bool read(PersistenceManager& pm);
bool operator == (const Options& option) const;
bool operator != (const Options& option) const;
virtual void dump (std::ostream& s = std::cout, Size depth = 0) const;
protected:
/*_ The option table's name */
String name_;
StringHashMap<ParamFile::ParameterDescription> descriptions_;
StringHashMap<Options*> subcategories_;
};
} // namespace BALL
#endif // BALL_DATATYPE_OPTIONS_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Options::setVector
void setVector(const String &key, const Vector3 &value)
BALL::Options::setBool
void setBool(const String &key, const bool value)
BALL::Options::getVector
Vector3 getVector(const String &key) const
BALL::Options::isReal
bool isReal(const String &key) const
BALL::Options::isSet
bool isSet(const String &key) const
BALL::Options::getBool
bool getBool(const String &key) const
BALL::Options::addParameterDescription
void addParameterDescription(const String &key, String description, ParamFile::ParameterType type, list< String > *allowed_values=NULL)
BALL::Options::getSubcategory
Options * getSubcategory(String name)
BALL::Options::get
String get(const String &key) const
BALL::Options::setDefaultBool
bool setDefaultBool(const String &key, const bool value)
BALL::Options::getReal
double getReal(const String &key) const
BALL::Options::setInteger
void setInteger(const String &key, const long value)
BALL::Options::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::Options::clear
virtual void clear()
BALL::Options::endSubcategories
StringHashMap< Options * >::Iterator endSubcategories()
BALL::Options::MAX_ENTRY_LENGTH
static const Size MAX_ENTRY_LENGTH
Definition options.h:61
BALL::Options::isVector
bool isVector(const String &key) const
BALL::Options::setDefaultInteger
long setDefaultInteger(const String &key, const long value)
BALL::Options::beginSubcategories
StringHashMap< Options * >::Iterator beginSubcategories()
BALL::Options::getInteger
long getInteger(const String &key) const
BALL::Options::Options
Options()
BALL::Options::descriptions_
StringHashMap< ParamFile::ParameterDescription > descriptions_
Definition options.h:385
BALL::Options::readOptionFile
bool readOptionFile(const String &filename)
BALL::Options::getName
const String & getName() const
BALL::Options::set
void set(const String &key, const String &value)
BALL::Options::writeOptionFile
bool writeOptionFile(const String &filename) const
BALL::Options::setName
void setName(const String &name)
BALL::Options::setDefault
String setDefault(const String &key, const String &value)
BALL::Options::setDefaultReal
double setDefaultReal(const String &key, const double value)
BALL::Options::createSubcategory
Options * createSubcategory(String name)
BALL::Options::subcategories_
StringHashMap< Options * > subcategories_
Definition options.h:386
BALL::Options::name_
String name_
Definition options.h:384
BALL::Options::write
void write(PersistenceManager &pm) const
BALL::Options::read
bool read(PersistenceManager &pm)
BALL::Options::isBool
bool isBool(const String &key) const
BALL::Options::isInteger
bool isInteger(const String &key) const
BALL::Options::getParameterDescription
const ParamFile::ParameterDescription * getParameterDescription(const String &key) const
BALL::Options::setReal
void setReal(const String &key, const double value)
BALL::ParamFile
Definition paramFile.h:24
BALL::PersistenceManager
Definition persistenceManager.h:73
BALL::StringHashMap< String >::Iterator
HashMap< String, String >::Iterator Iterator
Definition stringHashMap.h:53
BALL::StringHashMap< String >::StringHashMap
StringHashMap()
Definition stringHashMap.h:70
BALL::String
Definition string.h:57
common.h
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::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
std
STL namespace.
paramFile.h
persistentObject.h
stringHashMap.h
string.h
vector3.h