dca::Options Class Reference
[DCA Base Package]

#include <base_options.h>

List of all members.


Detailed Description

Generic option class, used to set up optional options for several classes, modules etc.

Options are treated as key-value pairs. Each key has an associated value. Each value has also a type that can be examined or changed.

Usually classes and functions uses explicit structures and not the Options class. The Options class may be used however to facilitate future enhancements.

Definition at line 79 of file base_options.h.

Public Member Functions

bool find (const std::string &key, OptionValue &value) const
 Perform a lookup for a given key, and return its value and whether or not it was found.
void erase (const std::string &key)
 Erases an option from the current Options instance if present. This function does nothing if the option is not present.
void set (const std::string &key, const OptionValue &value)
 Add or updates an option in the current Options.

Static Public Member Functions

static Options create (const DcaInstance &aDcaInstance)
 Creates an empty option object.

Member Function Documentation

static Options dca::Options::create ( const DcaInstance aDcaInstance  )  [static]

Creates an empty option object.

Parameters:
[in] aDcaInstance A previously initialized DcaInstance object
Returns:
An Options object
Exceptions:
ExDca - One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)

bool dca::Options::find ( const std::string &  key,
OptionValue value 
) const

Perform a lookup for a given key, and return its value and whether or not it was found.

Parameters:
[in] key The key to search for
[out] value If the key was found in the current Options instance this is the associated value
Returns:
true if the key was found in Options, else false.
void dca::Options::erase ( const std::string &  key  ) 

Erases an option from the current Options instance if present. This function does nothing if the option is not present.

Parameters:
[in] key The key to search for
void dca::Options::set ( const std::string &  key,
const OptionValue value 
)

Add or updates an option in the current Options.

If the current Options does not contain the given key it will be inserted. If the key is present the value will simply be updated.

Parameters:
[in] key The key to which the value should be associated
[in] value The value of the key
Note:
It is also possible to change the associated type of the option, for example if a key is associated with an integer and you use the same key with set and a string value, the type is changed to string.

The documentation for this class was generated from the following file:

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1