Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
datatools::properties::data Class Reference

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
 

Detailed Description

Internal data stored within the dictionary of the properties class.

Member Typedef Documentation

◆ vbool

typedef std::vector<bool> datatools::properties::data::vbool

Container for boolean data.

◆ vdouble

typedef std::vector<double> datatools::properties::data::vdouble

Container for real data.

◆ vint

typedef std::vector<int32_t> datatools::properties::data::vint

Container for integer data.

◆ vstring

typedef std::vector<std::string> datatools::properties::data::vstring

Container for character string data.

Constructor & Destructor Documentation

◆ data() [1/6]

datatools::properties::data::data ( char  type_ = TYPE_INTEGER_SYMBOL,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ data() [2/6]

datatools::properties::data::data ( bool  value_,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ data() [3/6]

datatools::properties::data::data ( int  value_,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ data() [4/6]

datatools::properties::data::data ( double  value_,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ data() [5/6]

datatools::properties::data::data ( const std::string &  value_,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ data() [6/6]

datatools::properties::data::data ( const char *  value_,
int  size_ = SCALAR_DEF 
)

Constructor.

◆ ~data()

virtual datatools::properties::data::~data ( )
virtual

Destructor.

Member Function Documentation

◆ boolean()

int datatools::properties::data::boolean ( int  size_ = SCALAR_DEF)

Assign N boolean values.

◆ dump()

void datatools::properties::data::dump ( std::ostream &  out_) const

Basic print.

◆ empty()

bool datatools::properties::data::empty ( ) const

Check if the value array is empty.

◆ get_boolean_value()

bool datatools::properties::data::get_boolean_value ( int  index_ = 0) const

Get the boolean value stored at a given rank.

◆ get_description()

const std::string& datatools::properties::data::get_description ( ) const

Get the description string associated to the stored data.

◆ get_error_message()

static std::string datatools::properties::data::get_error_message ( int  error_code_)
static

Returns an error message from an integer error code.

◆ get_integer_value()

int datatools::properties::data::get_integer_value ( int  index_ = 0) const

Get the integer value stored at a given rank.

◆ get_real_value()

double datatools::properties::data::get_real_value ( int  index_ = 0) const

Get the real value stored at a given rank.

◆ get_size()

int32_t datatools::properties::data::get_size ( ) const

Returns the size of the array of stored values (1 if scalar, >=0 if vector)

◆ get_string_value()

std::string datatools::properties::data::get_string_value ( int  index_ = 0) const

Get the string value stored at a given rank.

◆ get_type()

int datatools::properties::data::get_type ( ) const

Return type.

◆ get_type_label()

std::string datatools::properties::data::get_type_label ( ) const

Get a string label associated to the type of the stored data.

◆ get_unit_symbol()

const std::string& datatools::properties::data::get_unit_symbol ( ) const

Get the unit symbol associated to the stored real data.

◆ get_value() [1/4]

int datatools::properties::data::get_value ( bool &  value_,
int  index_ = 0 
) const

Get the boolean value by reference stored at a given rank.

◆ get_value() [2/4]

int datatools::properties::data::get_value ( int &  value_,
int  index_ = 0 
) const

Get the integer value by reference stored at a given rank.

◆ get_value() [3/4]

int datatools::properties::data::get_value ( double &  value_,
int  index_ = 0 
) const

Get the real value by reference stored at a given rank.

◆ get_value() [4/4]

int datatools::properties::data::get_value ( std::string &  value_,
int  index_ = 0 
) const

Get the string value by reference stored at a given rank.

◆ get_vector_label()

std::string datatools::properties::data::get_vector_label ( ) const

Get a string label associated to the scalar/vector trait of the stored data.

◆ has_description()

bool datatools::properties::data::has_description ( ) const

Check is description is set.

◆ has_explicit_unit()

bool datatools::properties::data::has_explicit_unit ( ) const

Check if the (real only) data has been initialized with explicit unit.

◆ has_forbidden_char()

static bool datatools::properties::data::has_forbidden_char ( const std::string &  checked_)
static

Check if a string contains a forbidden character.

◆ has_type()

bool datatools::properties::data::has_type ( ) const

Check if the data type is valid.

◆ has_unit_symbol()

bool datatools::properties::data::has_unit_symbol ( ) const

Check if the data has an unit symbol.

◆ index_is_valid()

bool datatools::properties::data::index_is_valid ( int  index_) const

Check if array index is valid.

◆ integer()

int datatools::properties::data::integer ( int  size_ = SCALAR_DEF)

Assign N integer values.

◆ is_boolean()

bool datatools::properties::data::is_boolean ( ) const

Check if the data is a boolean value.

◆ is_explicit_path()

bool datatools::properties::data::is_explicit_path ( ) const

Check if the (string only) data has been initialized with explicit path.

◆ is_integer()

bool datatools::properties::data::is_integer ( ) const

Check if the data is a integer value.

◆ is_locked()

bool datatools::properties::data::is_locked ( ) const

Check if the data is locked (cannot be modified)

◆ is_path()

bool datatools::properties::data::is_path ( ) const

Check if the data is a path string value.

◆ is_real()

bool datatools::properties::data::is_real ( ) const

Check if the data is a real value.

◆ is_scalar()

bool datatools::properties::data::is_scalar ( ) const

Check if the data is scalar (exactly one value)

◆ is_string()

bool datatools::properties::data::is_string ( ) const

Check if the data is a string value.

◆ is_unlocked()

bool datatools::properties::data::is_unlocked ( ) const

Check if the data is not locked (can be modified)

◆ is_vector()

bool datatools::properties::data::is_vector ( ) const

Check if the data is vector (>=0 stored values in an array)

◆ lock()

int datatools::properties::data::lock ( )

Lock the value (make it unmutable)

◆ real()

int datatools::properties::data::real ( int  size_ = SCALAR_DEF)

Assign N real values.

◆ set_description()

void datatools::properties::data::set_description ( const std::string &  description_)

Set the description string associated to the stored data.

◆ set_explicit_path()

int datatools::properties::data::set_explicit_path ( bool  explicit_path_flag_)

Set the explicit path flag.

◆ set_explicit_unit()

int datatools::properties::data::set_explicit_unit ( bool  explicit_unit_flag_)

Set the explicit unit flag.

◆ set_unit_symbol()

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.

◆ set_value() [1/5]

int datatools::properties::data::set_value ( bool  value_,
int  index_ = 0 
)

Set the boolean value at a given rank.

◆ set_value() [2/5]

int datatools::properties::data::set_value ( int  value_,
int  index_ = 0 
)

Set the integer value at a given rank.

◆ set_value() [3/5]

int datatools::properties::data::set_value ( double  value_,
int  index_ = 0,
bool  explicit_unit_ = false 
)

Set the real value at a given rank.

◆ set_value() [4/5]

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.

◆ set_value() [5/5]

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.

◆ set_value_with_unit()

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.

◆ size()

int32_t datatools::properties::data::size ( ) const

Returns the size of the array of stored values (1 if scalar, >=0 if vector)

◆ string()

int datatools::properties::data::string ( int  size_ = SCALAR_DEF)

Assign N string values.

◆ to_string()

void datatools::properties::data::to_string ( std::ostream &  out_) const

Convert to string and print in an output stream.

◆ tree_dump()

virtual void datatools::properties::data::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Method for smart printing (from the datatools::i_tree_dump interface).

◆ unlock()

int datatools::properties::data::unlock ( )

Unlock the value (make it mutable)

Member Data Documentation

◆ ERROR_BADTYPE

const int datatools::properties::data::ERROR_BADTYPE = 2
static

◆ ERROR_FAILURE

const int datatools::properties::data::ERROR_FAILURE = 1
static

◆ ERROR_LOCK

const int datatools::properties::data::ERROR_LOCK = 4
static

◆ ERROR_RANGE

const int datatools::properties::data::ERROR_RANGE = 3
static

◆ ERROR_SUCCESS

const int datatools::properties::data::ERROR_SUCCESS = 0
static

◆ MASK_EXPLICIT_PATH

const uint8_t datatools::properties::data::MASK_EXPLICIT_PATH = 0x10
static

◆ MASK_EXPLICIT_UNIT

const uint8_t datatools::properties::data::MASK_EXPLICIT_UNIT = 0x20
static

◆ MASK_LOCK

const uint8_t datatools::properties::data::MASK_LOCK = 0x40
static

◆ MASK_TYPE

const uint8_t datatools::properties::data::MASK_TYPE = 0x7
static

◆ MASK_UNIT_SYMBOL

const uint8_t datatools::properties::data::MASK_UNIT_SYMBOL = 0x8
static

◆ MASK_VECTOR

const uint8_t datatools::properties::data::MASK_VECTOR = 0x80
static

◆ SCALAR_DEF

const int datatools::properties::data::SCALAR_DEF = -1
static

◆ SCALAR_SIZE

const int datatools::properties::data::SCALAR_SIZE = 1
static

◆ STRING_FORBIDDEN_CHAR

const char datatools::properties::data::STRING_FORBIDDEN_CHAR = '"'
static

◆ TYPE_BOOLEAN

const uint8_t datatools::properties::data::TYPE_BOOLEAN = 0x1
static

◆ TYPE_BOOLEAN_SYMBOL

const char datatools::properties::data::TYPE_BOOLEAN_SYMBOL = 'B'
static

◆ TYPE_INTEGER

const uint8_t datatools::properties::data::TYPE_INTEGER = 0x2
static

◆ TYPE_INTEGER_SYMBOL

const char datatools::properties::data::TYPE_INTEGER_SYMBOL = 'I'
static

◆ TYPE_NONE

const uint8_t datatools::properties::data::TYPE_NONE = 0x0
static

◆ TYPE_REAL

const uint8_t datatools::properties::data::TYPE_REAL = 0x3
static

◆ TYPE_REAL_SYMBOL

const char datatools::properties::data::TYPE_REAL_SYMBOL = 'R'
static

◆ TYPE_STRING

const uint8_t datatools::properties::data::TYPE_STRING = 0x4
static

◆ TYPE_STRING_SYMBOL

const char datatools::properties::data::TYPE_STRING_SYMBOL = 'S'
static

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