library/param/param.hh

namespace scarab

The standard scarab namespace.

Functions

template <>
template<>
std::string get<std::string>() const
template <>
template<>
scarab::path get<scarab::path>() const
class param
#include <param.hh>

Subclassed by param_array, param_node, param_value

Public Functions

param()
param(const param &orig)
~param()
param *clone() const
bool is_null() const
bool is_value() const
bool is_array() const
bool is_node() const
bool has_subset(const param &a_subset) const
param_value &as_value()
param_array &as_array()
param_node &as_node()
const param_value &as_value() const
const param_array &as_array() const
const param_node &as_node() const
const param_value &operator()() const

Assumes that the parameter is a value, and returns a reference to itself.

param_value &operator()()

Assumes that the parameter is a value, and returns a reference to itself.

const param &operator[](unsigned a_index) const

Assumes that the parameter is an array, and returns a reference to the KTParam at aIndex. Behavior is undefined if aIndex is out-of-range.

param &operator[](unsigned a_index)

Assumes that the parameter is an array, and returns a reference to the KTParam at aIndex. Behavior is undefined if aIndex is out-of-range.

const param &operator[](const std::string &a_name) const

Assumes that the parameter is a node, and returns a reference to the KTParam corresponding to aName. Throws an KTException if aName is not present.

param &operator[](const std::string &a_name)

Assumes that the parameter is a node, and returns a reference to the KTParam corresponding to aName. Adds a new Value if aName is not present.

std::string to_string() const

Public Static Attributes

SCARAB_API unsigned s_indent_level = 0
class param_array
#include <param.hh>

Inherits from param

Public Types

typedef std::deque<param *> contents
typedef contents::iterator iterator
typedef contents::const_iterator const_iterator
typedef contents::reverse_iterator reverse_iterator
typedef contents::const_reverse_iterator const_reverse_iterator
typedef contents::value_type contents_type

Public Functions

param_array()
param_array(const param_array &orig)
~param_array()
param_array &operator=(const param_array &rhs)
param *clone() const
bool is_null() const
bool is_array() const
bool has_subset(const param &a_subset) const
unsigned size() const
bool empty() const
void resize(unsigned a_size)

sets the size of the array if smaller than the current size, extra elements are deleted

std::string get_value(unsigned a_index) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue

template <typename XValType>
XValType get_value(unsigned a_index) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue

std::string get_value(unsigned a_index, const std::string &a_default) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue

std::string get_value(unsigned a_index, const char *a_default) const
template <typename XValType>
XValType get_value(unsigned a_index, XValType a_default) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue

const param *at(unsigned a_index) const

Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.

param *at(unsigned a_index)

Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.

const param_value *value_at(unsigned a_index) const

Returns a pointer to the param_value (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

param_value *value_at(unsigned a_index)

Returns a pointer to the param_value (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

const param_array *array_at(unsigned a_index) const

Returns a pointer to the param_array (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

param_array *array_at(unsigned a_index)

Returns a pointer to the param_array (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

const param_node *node_at(unsigned a_index) const

Returns a pointer to the param_node (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

param_node *node_at(unsigned a_index)

Returns a pointer to the param_node (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.

const param &operator[](unsigned a_index) const

Returns a reference to the param at a_index. Behavior is undefined if a_index is out-of-range.

param &operator[](unsigned a_index)

Returns a reference to the param at a_index. Behavior is undefined if a_index is out-of-range.

const param *front() const
param *front()
const param *back() const
param *back()
void assign(unsigned a_index, const param &a_value)
void assign(unsigned a_index, param *a_value_ptr)
void push_back(const param &a_value)
void push_back(param *a_value_ptr)
void push_front(const param &a_value)
void push_front(param *a_value_ptr)
void append(const param_array &an_array)
void erase(unsigned a_index)
param *remove(unsigned a_index)
void clear()
param_array::iterator begin()
param_array::const_iterator begin() const
param_array::iterator end()
param_array::const_iterator end() const
param_array::reverse_iterator rbegin()
param_array::const_reverse_iterator rbegin() const
param_array::reverse_iterator rend()
param_array::const_reverse_iterator rend() const
std::string to_string() const

Protected Attributes

contents f_contents
class param_node
#include <param.hh>

Inherits from param

Subclassed by authentication, parsable, parser

Public Types

typedef std::map<std::string, param *> contents
typedef contents::iterator iterator
typedef contents::const_iterator const_iterator
typedef contents::value_type contents_type

Public Functions

param_node()
param_node(const param_node &orig)
~param_node()
param_node &operator=(const param_node &rhs)
param *clone() const
bool is_null() const
bool is_node() const
bool has_subset(const param &a_subset) const
unsigned size() const
bool empty() const
bool has(const std::string &a_name) const
unsigned count(const std::string &a_name) const
std::string get_value(const std::string &a_name) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue

template <typename XValType>
XValType get_value(const std::string &a_name) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue

std::string get_value(const std::string &a_name, const std::string &a_default) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue

std::string get_value(const std::string &a_name, const char *a_default) const
template <typename XValType>
XValType get_value(const std::string &a_name, XValType a_default) const

Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue

const param *at(const std::string &a_name) const

Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.

param *at(const std::string &a_name)

Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.

const param_value *value_at(const std::string &a_name) const
param_value *value_at(const std::string &a_name)
const param_array *array_at(const std::string &a_name) const
param_array *array_at(const std::string &a_name)
const param_node *node_at(const std::string &a_name) const
param_node *node_at(const std::string &a_name)
const param &operator[](const std::string &a_name) const

Returns a reference to the param corresponding to a_name. Throws an error if a_name is not present.

param &operator[](const std::string &a_name)

Returns a reference to the param corresponding to a_name. Adds a new value if a_name is not present.

bool add(const std::string &a_name, const param &a_value)

creates a copy of a_value

bool add(const std::string &a_name, param *a_value_ptr)

directly adds (without copying) a_value_ptr

void replace(const std::string &a_name, const param &a_value)

creates a copy of a_value

void replace(const std::string &a_name, param *a_value_ptr)

directly adds (without copying) a_value_ptr

void merge(const param_node &a_object)

Merges the contents of a_object into this object. If names in the contents of a_object exist in this object, the values in this object corresponding to the matching names will be replaced.

void erase(const std::string &a_name)
param *remove(const std::string &a_name)
void clear()
param_node::iterator begin()
param_node::const_iterator begin() const
param_node::iterator end()
param_node::const_iterator end() const
std::string to_string() const

Protected Attributes

contents f_contents
class param_value
#include <param.hh>

Inherits from param

Public Functions

param_value()
param_value(bool a_value)
param_value(uint8_t a_value)
param_value(uint16_t a_value)
param_value(uint32_t a_value)
param_value(uint64_t a_value)
param_value(int8_t a_value)
param_value(int16_t a_value)
param_value(int32_t a_value)
param_value(int64_t a_value)
param_value(float a_value)
param_value(double a_value)
param_value(const std::string &a_value)
param_value(const char *a_value)
param_value(const param_value &orig)
~param_value()
param_value &operator=(const param_value &rhs)
param *clone() const
bool empty() const
bool is_null() const
bool is_value() const
bool has_subset(const param &a_subset) const
std::string type() const
bool is_bool() const
bool is_uint() const
bool is_int() const
bool is_double() const
bool is_string() const
bool as_bool() const
uint64_t as_uint() const
int64_t as_int() const
double as_double() const
const string &as_string() const
path as_path() const
template <typename XValType>
XValType get() const
void set(bool a_value)
void set(uint8_t a_value)
void set(uint16_t a_value)
void set(uint32_t a_value)
void set(uint64_t a_value)
void set(int8_t a_value)
void set(int16_t a_value)
void set(int32_t a_value)
void set(int64_t a_value)
void set(float a_value)
void set(double a_value)
void set(const std::string &a_value)
void set(const char *a_value)
std::string to_string() const
void clear()
template <>
bool get() const
template <>
uint64_t get() const
template <>
int64_t get() const
template <>
double get() const

Private Types

enum ValueTypes

Values:

k_bool
k_uint
k_int
k_double
k_string
k_invalid

Private Members

union scarab::param_value::Values f_value
scarab::param_value::ValueTypes f_value_type
std::string f_buffer
union Values

Public Members

bool f_bool
uint64_t f_uint
int64_t f_int
double f_double
std::string *f_string