Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Internal data stored within the dictionary of the properties class. More...
#include <bayeux/datatools/properties.h>
Classes | |
struct | defaults |
Provides static method for default values for each supported type. More... | |
Public Types | |
typedef std::vector< bool > | vbool |
Container for boolean data. More... | |
typedef std::vector< int32_t > | vint |
Container for integer data. More... | |
typedef std::vector< double > | vdouble |
Container for real data. More... | |
typedef std::vector< std::string > | vstring |
Container for character string data. More... | |
Public Member Functions | |
data (char type_=TYPE_INTEGER_SYMBOL, int size_=SCALAR_DEF) | |
Constructor. More... | |
data (bool value_, int size_=SCALAR_DEF) | |
Constructor. More... | |
data (int value_, int size_=SCALAR_DEF) | |
Constructor. More... | |
data (double value_, int size_=SCALAR_DEF) | |
Constructor. More... | |
data (const std::string &value_, int size_=SCALAR_DEF) | |
Constructor. More... | |
data (const char *value_, int size_=SCALAR_DEF) | |
Constructor. More... | |
virtual | ~data () |
Destructor. More... | |
bool | has_description () const |
Check is description is set. More... | |
void | set_description (const std::string &description_) |
Set the description string associated to the stored data. More... | |
const std::string & | get_description () const |
Get the description string associated to the stored data. More... | |
int | set_unit_symbol (const std::string &symbol_) |
const std::string & | get_unit_symbol () const |
Get the unit symbol associated to the stored real data. More... | |
bool | has_type () const |
Check if the data type is valid. More... | |
int | get_type () const |
Return type. More... | |
bool | is_boolean () const |
Check if the data is a boolean value. More... | |
bool | is_integer () const |
Check if the data is a integer value. More... | |
bool | is_real () const |
Check if the data is a real value. More... | |
bool | is_string () const |
Check if the data is a string value. More... | |
bool | is_path () const |
Check if the data is a path string value. More... | |
bool | is_scalar () const |
Check if the data is scalar (exactly one value) More... | |
bool | is_vector () const |
Check if the data is vector (>=0 stored values in an array) More... | |
bool | is_locked () const |
Check if the data is locked (cannot be modified) More... | |
bool | has_unit_symbol () const |
Check if the data has an unit symbol. More... | |
bool | has_explicit_unit () const |
Check if the (real only) data has been initialized with explicit unit. More... | |
bool | is_explicit_path () const |
Check if the (string only) data has been initialized with explicit path. More... | |
bool | is_unlocked () const |
Check if the data is not locked (can be modified) More... | |
int | boolean (int size_=SCALAR_DEF) |
Assign N boolean values. More... | |
int | integer (int size_=SCALAR_DEF) |
Assign N integer values. More... | |
int | real (int size_=SCALAR_DEF) |
Assign N real values. More... | |
int | string (int size_=SCALAR_DEF) |
Assign N string values. More... | |
int | lock () |
Lock the value (make it unmutable) More... | |
int | unlock () |
Unlock the value (make it mutable) More... | |
int32_t | get_size () const |
Returns the size of the array of stored values (1 if scalar, >=0 if vector) More... | |
int32_t | size () const |
Returns the size of the array of stored values (1 if scalar, >=0 if vector) More... | |
bool | empty () const |
Check if the value array is empty. More... | |
bool | index_is_valid (int index_) const |
Check if array index is valid. More... | |
bool | get_boolean_value (int index_=0) const |
Get the boolean value stored at a given rank. More... | |
int | get_integer_value (int index_=0) const |
Get the integer value stored at a given rank. More... | |
double | get_real_value (int index_=0) const |
Get the real value stored at a given rank. More... | |
std::string | get_string_value (int index_=0) const |
Get the string value stored at a given rank. More... | |
int | set_value (bool value_, int index_=0) |
Set the boolean value at a given rank. More... | |
int | set_value (int value_, int index_=0) |
Set the integer value at a given rank. More... | |
int | set_value (double value_, int index_=0, bool explicit_unit_=false) |
Set the real value at a given rank. More... | |
int | set_value_with_unit (double value_, int index_=0, const std::string &unit_symbol_="") |
Set the real value at a given rank. More... | |
int | set_explicit_unit (bool explicit_unit_flag_) |
Set the explicit unit flag. More... | |
int | set_explicit_path (bool explicit_path_flag_) |
Set the explicit path flag. More... | |
int | set_value (const std::string &value_, int index_=0, bool explicit_path_flag_=false) |
Set the string value at a given rank. More... | |
int | set_value (const char *value_, int index_=0, bool explicit_path_flag_=false) |
Set the string value at a given rank. More... | |
int | get_value (bool &value_, int index_=0) const |
Get the boolean value by reference stored at a given rank. More... | |
int | get_value (int &value_, int index_=0) const |
Get the integer value by reference stored at a given rank. More... | |
int | get_value (double &value_, int index_=0) const |
Get the real value by reference stored at a given rank. More... | |
int | get_value (std::string &value_, int index_=0) const |
Get the string value by reference stored at a given rank. More... | |
std::string | get_type_label () const |
Get a string label associated to the type of the stored data. More... | |
std::string | get_vector_label () const |
Get a string label associated to the scalar/vector trait of the stored data. More... | |
void | dump (std::ostream &out_) const |
Basic print. More... | |
void | to_string (std::ostream &out_) const |
Convert to string and print in an output stream. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Method for smart printing (from the datatools::i_tree_dump interface). More... | |
Static Public Member Functions | |
static bool | has_forbidden_char (const std::string &checked_) |
Check if a string contains a forbidden character. More... | |
static std::string | get_error_message (int error_code_) |
Returns an error message from an integer error code. More... | |
Static Public Attributes | |
static const int | ERROR_SUCCESS = 0 |
static const int | ERROR_FAILURE = 1 |
static const int | ERROR_BADTYPE = 2 |
static const int | ERROR_RANGE = 3 |
static const int | ERROR_LOCK = 4 |
static const uint8_t | MASK_TYPE = 0x7 |
static const uint8_t | MASK_UNIT_SYMBOL = 0x8 |
static const uint8_t | MASK_EXPLICIT_PATH = 0x10 |
static const uint8_t | MASK_EXPLICIT_UNIT = 0x20 |
static const uint8_t | MASK_LOCK = 0x40 |
static const uint8_t | MASK_VECTOR = 0x80 |
static const uint8_t | TYPE_NONE = 0x0 |
static const uint8_t | TYPE_BOOLEAN = 0x1 |
static const uint8_t | TYPE_INTEGER = 0x2 |
static const uint8_t | TYPE_REAL = 0x3 |
static const uint8_t | TYPE_STRING = 0x4 |
static const char | TYPE_BOOLEAN_SYMBOL = 'B' |
static const char | TYPE_INTEGER_SYMBOL = 'I' |
static const char | TYPE_REAL_SYMBOL = 'R' |
static const char | TYPE_STRING_SYMBOL = 'S' |
static const char | STRING_FORBIDDEN_CHAR = '"' |
static const int | SCALAR_DEF = -1 |
static const int | SCALAR_SIZE = 1 |
Internal data stored within the dictionary of the properties class.
typedef std::vector<bool> datatools::properties::data::vbool |
Container for boolean data.
typedef std::vector<double> datatools::properties::data::vdouble |
Container for real data.
typedef std::vector<int32_t> datatools::properties::data::vint |
Container for integer data.
typedef std::vector<std::string> datatools::properties::data::vstring |
Container for character string data.
datatools::properties::data::data | ( | char | type_ = TYPE_INTEGER_SYMBOL , |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
datatools::properties::data::data | ( | bool | value_, |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
datatools::properties::data::data | ( | int | value_, |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
datatools::properties::data::data | ( | double | value_, |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
datatools::properties::data::data | ( | const std::string & | value_, |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
datatools::properties::data::data | ( | const char * | value_, |
int | size_ = SCALAR_DEF |
||
) |
Constructor.
|
virtual |
Destructor.
int datatools::properties::data::boolean | ( | int | size_ = SCALAR_DEF | ) |
Assign N boolean values.
void datatools::properties::data::dump | ( | std::ostream & | out_ | ) | const |
Basic print.
bool datatools::properties::data::empty | ( | ) | const |
Check if the value array is empty.
bool datatools::properties::data::get_boolean_value | ( | int | index_ = 0 | ) | const |
Get the boolean value stored at a given rank.
const std::string& datatools::properties::data::get_description | ( | ) | const |
Get the description string associated to the stored data.
|
static |
Returns an error message from an integer error code.
int datatools::properties::data::get_integer_value | ( | int | index_ = 0 | ) | const |
Get the integer value stored at a given rank.
double datatools::properties::data::get_real_value | ( | int | index_ = 0 | ) | const |
Get the real value stored at a given rank.
int32_t datatools::properties::data::get_size | ( | ) | const |
Returns the size of the array of stored values (1 if scalar, >=0 if vector)
std::string datatools::properties::data::get_string_value | ( | int | index_ = 0 | ) | const |
Get the string value stored at a given rank.
int datatools::properties::data::get_type | ( | ) | const |
Return type.
std::string datatools::properties::data::get_type_label | ( | ) | const |
Get a string label associated to the type of the stored data.
const std::string& datatools::properties::data::get_unit_symbol | ( | ) | const |
Get the unit symbol associated to the stored real data.
int datatools::properties::data::get_value | ( | bool & | value_, |
int | index_ = 0 |
||
) | const |
Get the boolean value by reference stored at a given rank.
int datatools::properties::data::get_value | ( | int & | value_, |
int | index_ = 0 |
||
) | const |
Get the integer value by reference stored at a given rank.
int datatools::properties::data::get_value | ( | double & | value_, |
int | index_ = 0 |
||
) | const |
Get the real value by reference stored at a given rank.
int datatools::properties::data::get_value | ( | std::string & | value_, |
int | index_ = 0 |
||
) | const |
Get the string value by reference stored at a given rank.
std::string datatools::properties::data::get_vector_label | ( | ) | const |
Get a string label associated to the scalar/vector trait of the stored data.
bool datatools::properties::data::has_description | ( | ) | const |
Check is description is set.
bool datatools::properties::data::has_explicit_unit | ( | ) | const |
Check if the (real only) data has been initialized with explicit unit.
|
static |
Check if a string contains a forbidden character.
bool datatools::properties::data::has_type | ( | ) | const |
Check if the data type is valid.
bool datatools::properties::data::has_unit_symbol | ( | ) | const |
Check if the data has an unit symbol.
bool datatools::properties::data::index_is_valid | ( | int | index_ | ) | const |
Check if array index is valid.
int datatools::properties::data::integer | ( | int | size_ = SCALAR_DEF | ) |
Assign N integer values.
bool datatools::properties::data::is_boolean | ( | ) | const |
Check if the data is a boolean value.
bool datatools::properties::data::is_explicit_path | ( | ) | const |
Check if the (string only) data has been initialized with explicit path.
bool datatools::properties::data::is_integer | ( | ) | const |
Check if the data is a integer value.
bool datatools::properties::data::is_locked | ( | ) | const |
Check if the data is locked (cannot be modified)
bool datatools::properties::data::is_path | ( | ) | const |
Check if the data is a path string value.
bool datatools::properties::data::is_real | ( | ) | const |
Check if the data is a real value.
bool datatools::properties::data::is_scalar | ( | ) | const |
Check if the data is scalar (exactly one value)
bool datatools::properties::data::is_string | ( | ) | const |
Check if the data is a string value.
bool datatools::properties::data::is_unlocked | ( | ) | const |
Check if the data is not locked (can be modified)
bool datatools::properties::data::is_vector | ( | ) | const |
Check if the data is vector (>=0 stored values in an array)
int datatools::properties::data::lock | ( | ) |
Lock the value (make it unmutable)
int datatools::properties::data::real | ( | int | size_ = SCALAR_DEF | ) |
Assign N real values.
void datatools::properties::data::set_description | ( | const std::string & | description_ | ) |
Set the description string associated to the stored data.
int datatools::properties::data::set_explicit_path | ( | bool | explicit_path_flag_ | ) |
Set the explicit path flag.
int datatools::properties::data::set_explicit_unit | ( | bool | explicit_unit_flag_ | ) |
Set the explicit unit flag.
int datatools::properties::data::set_unit_symbol | ( | const std::string & | symbol_ | ) |
Set the preferred unit symbol associated to the stored real data
This method implies to set the explicit unit flag.
int datatools::properties::data::set_value | ( | bool | value_, |
int | index_ = 0 |
||
) |
Set the boolean value at a given rank.
int datatools::properties::data::set_value | ( | int | value_, |
int | index_ = 0 |
||
) |
Set the integer value at a given rank.
int datatools::properties::data::set_value | ( | double | value_, |
int | index_ = 0 , |
||
bool | explicit_unit_ = false |
||
) |
Set the real value at a given rank.
int datatools::properties::data::set_value | ( | const std::string & | value_, |
int | index_ = 0 , |
||
bool | explicit_path_flag_ = false |
||
) |
Set the string value at a given rank.
int datatools::properties::data::set_value | ( | const char * | value_, |
int | index_ = 0 , |
||
bool | explicit_path_flag_ = false |
||
) |
Set the string value at a given rank.
int datatools::properties::data::set_value_with_unit | ( | double | value_, |
int | index_ = 0 , |
||
const std::string & | unit_symbol_ = "" |
||
) |
Set the real value at a given rank.
int32_t datatools::properties::data::size | ( | ) | const |
Returns the size of the array of stored values (1 if scalar, >=0 if vector)
int datatools::properties::data::string | ( | int | size_ = SCALAR_DEF | ) |
Assign N string values.
void datatools::properties::data::to_string | ( | std::ostream & | out_ | ) | const |
Convert to string and print in an output stream.
|
virtual |
Method for smart printing (from the datatools::i_tree_dump interface).
int datatools::properties::data::unlock | ( | ) |
Unlock the value (make it mutable)
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |