Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

indri::api::Parameters Class Reference

#include <Parameters.hpp>

List of all members.

Public Member Functions

 Parameters ()
 Create.

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

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

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

const Parametersoperator= (const Parameters &other)
Parameters get (size_t 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[] (size_t 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, INT64 value)
void set (const std::string &name, double value)
void set (const std::string &value)
void clear ()
 Clear the parameter tree.

size_t size ()
 the size of the object.

bool exists (size_t index)
bool exists (const std::string &name)
indri::xml::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 Member Functions

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


Protected Member Functions

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 indri::xml::XMLNode *node)
void _fillXML (class indri::xml::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

indri::api::Parameters::Parameters  ) 
 

Create.

indri::api::Parameters::Parameters const Parameters other  ) 
 

Clone

Parameters:
other the object to copy.

indri::api::Parameters::Parameters parameter_value value  ) 
 

Initialize with a parameter_value

Parameters:
value the item to insert.

indri::api::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.

indri::api::Parameters::~Parameters  ) 
 

Clean up.


Member Function Documentation

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

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

void indri::api::Parameters::_fillXML class indri::xml::XMLNode node  )  [protected]
 

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

indri::api::Parameters::parameter_value * indri::api::Parameters::_getRoot  )  [protected]
 

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

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

void indri::api::Parameters::_loadXML class indri::xml::XMLNode node  )  [protected]
 

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

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

indri::api::Parameters indri::api::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.

void indri::api::Parameters::clear  ) 
 

Clear the parameter tree.

bool indri::api::Parameters::exists const std::string &  name  ) 
 

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

bool indri::api::Parameters::exists size_t  index  ) 
 

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

std::string indri::api::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 indri::api::Parameters::get const std::string &  name,
const char *  def
 

INT64 indri::api::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 indri::api::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 indri::api::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 indri::api::Parameters::get const std::string &  name,
bool  def
 

indri::api::Parameters indri::api::Parameters::get const char *  name  ) 
 

Retrieve the entry associated with name.

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

indri::api::Parameters indri::api::Parameters::get const std::string &  name  ) 
 

Retrieve the entry associated with name.

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

indri::api::Parameters indri::api::Parameters::get size_t  index  ) 
 

Retrieve the n'th entry.

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

indri::api::Parameters & indri::api::Parameters::instance  )  [static]
 

Return the singleton instance of the Parameters class.

void indri::api::Parameters::load const std::string &  text  ) 
 

Initialize from a string

Parameters:
text the text to parse

void indri::api::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 indri::api::Parameters::loadFile const std::string &  filename  ) 
 

Initialize from a file

Parameters:
filename the filename to parse

indri::api::Parameters::operator bool  )  [inline]
 

indri::api::Parameters::operator double  )  [inline]
 

the value of the parameter as a double

indri::api::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

indri::api::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

indri::api::Parameters::operator std::string  )  [inline]
 

the value of the parameter as a string

const Parameters& indri::api::Parameters::operator= const Parameters other  )  [inline]
 

assignment via deep copy.

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

indri::api::Parameters indri::api::Parameters::operator[] const char *  path  ) 
 

Retrieve the entry indexed by path.

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

indri::api::Parameters indri::api::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.

indri::api::Parameters indri::api::Parameters::operator[] size_t  index  ) 
 

Retrieve the n'th entry.

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

void indri::api::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 indri::api::Parameters::set const std::string &  value  ) 
 

Set the value of the Parameters object

Parameters:
value the value

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

Set the value for the given key.

Parameters:
name the key
value the value

void indri::api::Parameters::set const std::string &  name,
INT64  value
 

Set the value for the given key.

Parameters:
name the key
value the value

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

Set the value for the given key.

Parameters:
name the key
value the value

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

Set the value for the given key.

Parameters:
name the key
value the value

void indri::api::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 indri::api::Parameters::set const std::string &  name,
const char *  value
 

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

size_t indri::api::Parameters::size  ) 
 

the size of the object.

indri::xml::XMLNode * indri::api::Parameters::toXML  ) 
 

Convert to XML

Returns:
an indri::xml::XMLNode containing the parameters

void indri::api::Parameters::write std::string &  text  ) 
 

Write the Parameters table to the given string

Parameters:
text the string to write into.

void indri::api::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* indri::api::Parameters::_collection [protected]
 

bool indri::api::Parameters::_owned [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Jun 15 11:02:59 2010 for Lemur by doxygen 1.3.4