Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Parameters Class Reference

#include <Parameters.hpp>

List of all members.

Public Methods

 Parameters ()
 Create.

 Parameters (const Parameters &other)
 Parameters (parameter_value *value)
 Parameters (const std::string &path, parameter_value *value)
 ~Parameters ()
 Clean up.

 operator double ()
 
Returns:
the value of the parameter as a double


 operator bool ()
 operator int ()
 operator INT64 ()
 operator std::string ()
 
Returns:
the value of the parameter as a string


const Parameters & operator= (const Parameters &other)
Parameters get (int index)
Parameters get (const std::string &name)
Parameters get (const char *name)
bool get (const std::string &name, bool def)
int get (const std::string &name, int def)
double get (const std::string &name, double def)
INT64 get (const std::string &name, INT64 def)
std::string get (const std::string &name, const char *def)
std::string get (const std::string &name, const std::string &def)
Parameters operator[] (int index)
Parameters operator[] (const std::string &path)
Parameters operator[] (const char *path)
Parameters append (const std::string &path)
void remove (const std::string &path)
void set (const std::string &name, bool value)
void set (const std::string &name, const char *value)
void set (const std::string &name, const std::string &value)
void set (const std::string &name, int value)
void set (const std::string &name, UINT64 value)
void set (const std::string &name, double value)
void set (const std::string &value)
size_t size ()
 
Returns:
the size of the object.


bool exists (int index)
bool exists (const std::string &name)
XMLNodetoXML ()
void load (const std::string &text)
void loadFile (const std::string &filename)
void loadCommandLine (int argc, char **argv)
void write (std::string &text)
void writeFile (const std::string &filename)

Static Public Methods

Parameters & instance ()
 Return the singleton instance of the Parameters class.


Protected Methods

parameter_value_getRoot ()
parameter_value_getPath (const std::string &path, Parameters::parameter_value *last, int offset=0)
parameter_value_createPath (const std::string &path)
void _parseNextSegment (std::string &segment, int &arrayIndex, int &endOffset, const std::string &path, int beginOffset)
parameter_value_getSegment (const std::string &segment, int arrayIndex, Parameters::parameter_value *from)
void _loadXML (class XMLNode *node)
void _fillXML (class XMLNode *node)
INT64 _multiplier (const std::string &value)
bool _isBoolean (const std::string &value)
bool _asBoolean (const std::string &value)

Protected Attributes

parameter_value_collection
bool _owned


Detailed Description

Parameters class for Indri index and retrieval methods. Provides a map of key value pairs, where the key is a string and the values can be one of double, int, INT64, string, or a Parameters object, encapsulated in a parameter_value struct.


Constructor & Destructor Documentation

Parameters::Parameters  
 

Create.

Parameters::Parameters const Parameters &    other
 

Clone

Parameters:
other  the object to copy.

Parameters::Parameters parameter_value   value
 

Initialize with a parameter_value

Parameters:
value  the item to insert.

Parameters::Parameters const std::string &    path,
parameter_value   value
 

Initialize with a key path and parameter_value

Parameters:
path  the key.
value  the item to insert for that key.

Parameters::~Parameters  
 

Clean up.


Member Function Documentation

bool Parameters::_asBoolean const std::string &    value [inline, protected]
 

Parameters::parameter_value * Parameters::_createPath const std::string &    path [protected]
 

void Parameters::_fillXML class XMLNode   node [protected]
 

Parameters::parameter_value * Parameters::_getPath const std::string &    path,
Parameters::parameter_value   last,
int    offset = 0
[protected]
 

Parameters::parameter_value * Parameters::_getRoot   [protected]
 

Parameters::parameter_value * Parameters::_getSegment const std::string &    segment,
int    arrayIndex,
Parameters::parameter_value   from
[protected]
 

bool Parameters::_isBoolean const std::string &    value [inline, protected]
 

void Parameters::_loadXML class XMLNode   node [protected]
 

INT64 Parameters::_multiplier const std::string &    value [inline, protected]
 

void Parameters::_parseNextSegment std::string &    segment,
int &    arrayIndex,
int &    endOffset,
const std::string &    path,
int    beginOffset
[protected]
 

Parameters Parameters::append const std::string &    path
 

Create a new empty parameter_value for the key given in path

Parameters:
path  the key to create the value for
Returns:
the Parameters object initialized with the new value.

bool Parameters::exists const std::string &    name
 

Parameters:
name  the key to probe.
Returns:
true if an entry exists for this key, false otherwise.

bool Parameters::exists int    index
 

Parameters:
index  the index to probe.
Returns:
true if an entry exists for this index, false otherwise.

std::string Parameters::get const std::string &    name,
const std::string &    def
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
def  the default value for the key
Returns:
the value associated with the key or def if no entry exists.

std::string Parameters::get const std::string &    name,
const char *    def
 

INT64 Parameters::get const std::string &    name,
INT64    def
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
def  the default value for the key
Returns:
the value associated with the key or def if no entry exists.

double Parameters::get const std::string &    name,
double    def
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
def  the default value for the key
Returns:
the value associated with the key or def if no entry exists.

int Parameters::get const std::string &    name,
int    def
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
def  the default value for the key
Returns:
the value associated with the key or def if no entry exists.

bool Parameters::get const std::string &    name,
bool    def
 

Parameters Parameters::get const char *    name
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
Returns:
a Parameters object.

Parameters Parameters::get const std::string &    name
 

Retrieve the entry associated with name.

Parameters:
name  the key value.
Returns:
a Parameters object.

Parameters Parameters::get int    index
 

Retrieve the n'th entry.

Parameters:
index, the  index of the entry to retrieve.
Returns:
a Parameters object.

Parameters & Parameters::instance   [static]
 

Return the singleton instance of the Parameters class.

void Parameters::load const std::string &    text
 

Initialize from a string

Parameters:
text  the text to parse

void Parameters::loadCommandLine int    argc,
char **    argv
 

Initialize from the command line

Parameters:
argc  the number of command line arguments
argv  the command line arguments

void Parameters::loadFile const std::string &    filename
 

Initialize from a file

Parameters:
filename  the filename to parse

Parameters::operator bool   [inline]
 

Parameters::operator double   [inline]
 

Returns:
the value of the parameter as a double

Parameters::operator int   [inline]
 

Converts the value to an int, scaling by the multiplier if supplied. Valid values are (case insensitive) K = 1000, M = 1000000, G = 1000000000.

Returns:
the value of the parameter as an int

Parameters::operator INT64   [inline]
 

Converts the value to an INT64, scaling by the multiplier if supplied. Valid values are (case insensitive) K = 1000, M = 1000000, G = 1000000000.

Returns:
the value of the parameter as an INT64

Parameters::operator std::string   [inline]
 

Returns:
the value of the parameter as a string

const Parameters& Parameters::operator= const Parameters &    other [inline]
 

assignment via deep copy.

Parameters:
other  the item to copy.
Returns:
this object

Parameters Parameters::operator[] const char *    path
 

Retrieve the entry indexed by path.

Parameters:
path  the key of the entry to retrieve.
Returns:
a Parameters object.

Parameters Parameters::operator[] const std::string &    path
 

Retrieve the entry indexed by path.

Parameters:
path  the key of the entry to retrieve.
Returns:
a Parameters object.

Parameters Parameters::operator[] int    index
 

Retrieve the n'th entry.

Parameters:
index  the index of the entry to retrieve.
Returns:
a Parameters object.

void Parameters::remove const std::string &    path
 

Remove an entry from the table. Does nothing if the key does not exist.

Parameters:
path  the key to remove.

void Parameters::set const std::string &    value
 

Set the value of the Parameters object

Parameters:
value  the value

void Parameters::set const std::string &    name,
double    value
 

Set the value for the given key.

Parameters:
name  the key
value  the value

void Parameters::set const std::string &    name,
UINT64    value
 

Set the value for the given key.

Parameters:
name  the key
value  the value

void Parameters::set const std::string &    name,
int    value
 

Set the value for the given key.

Parameters:
name  the key
value  the value

void Parameters::set const std::string &    name,
const std::string &    value
 

Set the value for the given key.

Parameters:
name  the key
value  the value

void Parameters::set const std::string &    name,
const char *    value
 

void Parameters::set const std::string &    name,
bool    value
 

size_t Parameters::size  
 

Returns:
the size of the object.

XMLNode * Parameters::toXML  
 

Convert to XML

Returns:
an XMLNode containing the parameters

void Parameters::write std::string &    text
 

Write the Parameters table to the given string

Parameters:
text  the string to write into.

void Parameters::writeFile const std::string &    filename
 

Write the Parameters table to the given filename

Parameters:
filename  the filename to write into.


Member Data Documentation

parameter_value* Parameters::_collection [protected]
 

bool Parameters::_owned [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Nov 3 12:59:50 2004 for Lemur Toolkit by doxygen1.2.18