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

A dictionary of arbitrary properties. More...

#include <bayeux/datatools/properties.h>

Inheritance diagram for datatools::properties:
datatools::i_serializable datatools::i_tree_dumpable datatools::i_clear datatools::i_cloneable

Classes

struct  basic_key_validator
 Pure abstract class for key validator. More...
 
class  config
 Class for ASCII file I/O operations with properties objects. More...
 
class  data
 Internal data stored within the dictionary of the properties class. More...
 
class  default_key_validator
 Default abstract class for key validator. More...
 

Public Types

typedef std::vector< std::string > keys_col_type
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 

Public Member Functions

 properties ()
 Default constructor with embedded default key validator. More...
 
 properties (const std::string &desc_)
 Constructor with explicit description and embedded default key validator. More...
 
 properties (const std::string &desc_, const basic_key_validator &)
 Constructor with explicit description and explicit key validator. More...
 
 properties (const basic_key_validator &)
 Constructor with explicit key validator. More...
 
 properties (const std::string &desc_, const basic_key_validator *, bool deletion_on_destroy_=true)
 Constructor with explicit description and explicit external key validator. More...
 
 properties (const basic_key_validator *, bool deletion_on_destroy_=true)
 Constructor with explicit external key validator. More...
 
virtual ~properties ()
 Destructor. More...
 
int32_t size () const
 Returns the number of stored properties. More...
 
bool empty () const
 Check if the properties container is empty. More...
 
void set_description (const std::string &)
 
const std::string & get_description () const
 Returns the description string of the properties container. More...
 
bool fetch_short_description (std::string &) const
 Fetch the short description string associated to the container. More...
 
bool has_short_description () const
 Check if a short description string is associated to the container. More...
 
std::string get_short_description () const
 Get the short description string associated to the container. More...
 
bool has_auxiliary_descriptions () const
 Check if some auxiliary descriptions are set. More...
 
bool fetch_auxiliary_descriptions (std::vector< std::string > &) const
 Fetch the auxiliary description strings associated to the container. More...
 
void unset_key_validator ()
 Unset the current key validator. More...
 
void set_default_key_validator ()
 Use the default key validator. More...
 
void set_key_validator (const basic_key_validator &)
 Set the current key validator. More...
 
void set_key_validator (const basic_key_validator *, bool deletion_on_destroy_=true)
 Set the current key validator with ownership. More...
 
std::vector< std::string > keys () const
 Returns the list of keys stored in the map (read-only). More...
 
const std::string & key (int) const
 Returns the ith key. More...
 
void keys (std::vector< std::string > &) const
 Set the list of keys. More...
 
const dataget (const std::string &prop_key_) const
 Access to a non-mutable reference to a property data object. More...
 
void store (const std::string &key_, const data &value_)
 Store data item with supplied key. More...
 
void keys_not_starting_with (std::vector< std::string > &, const std::string &prefix_) const
 builds the list of keys (by reference) stored in the map that start with prefix. More...
 
std::vector< std::string > keys_not_starting_with (const std::string &prefix_) const
 returns the list of keys stored in the map that start with prefix. More...
 
void keys_starting_with (std::vector< std::string > &, const std::string &prefix_) const
 builds the list of keys (by reference) stored in the map that start with prefix. More...
 
std::vector< std::string > keys_starting_with (const std::string &prefix_) const
 returns the list of keys stored in the map that start with prefix. More...
 
void keys_not_ending_with (std::vector< std::string > &, const std::string &suffix_) const
 builds the list of keys (by reference) stored in the map that end with suffix. More...
 
std::vector< std::string > keys_not_ending_with (const std::string &suffix_) const
 returns the list of keys stored in the map that end with suffix. More...
 
void keys_ending_with (std::vector< std::string > &, const std::string &suffix_) const
 builds the list of keys (by reference) stored in the map that end with suffix. More...
 
std::vector< std::string > keys_ending_with (const std::string &suffix_) const
 returns the list of keys stored in the map that end with suffix. More...
 
void lock (const std::string &prop_key_)
 Lock the properties dictionary. More...
 
void unlock (const std::string &prop_key_)
 Unlock the properties dictionary. More...
 
bool is_locked (const std::string &prop_key_) const
 Check if the instance is locked. More...
 
bool is_private (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is private. More...
 
bool is_public (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is public. More...
 
bool is_boolean (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is boolean. More...
 
bool is_integer (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is integer. More...
 
bool is_real (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is real. More...
 
bool is_string (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is string. More...
 
bool is_scalar (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is scalar. More...
 
bool is_vector (const std::string &prop_key_) const
 Check if data with name 'prop_key_' is vector. More...
 
int32_t size (const std::string &prop_key_) const
 
int32_t key_size (const std::string &prop_key_) const
 Returns the size of the data stored with a given key/name. More...
 
bool has_key (const std::string &prop_key_) const
 Check if a property with given key/name exists. More...
 
void key_lock (const std::string &prop_key_)
 Lock a property with given key/name. More...
 
void key_unlock (const std::string &prop_key_)
 Unlock a property with given key/name. More...
 
const std::string & get_key_description (const std::string &prop_key_) const
 Get the description string associated to a property with given key/name. More...
 
void set_key_description (const std::string &prop_key_, const std::string &desc_)
 Set the description string associated to a property with given key/name. More...
 
void erase (const std::string &key_)
 Rename a property with a new name. More...
 
void erase_all ()
 Erase all properties. More...
 
void erase_all_starting_with (const std::string &prefix_)
 Erase all properties with key/name starting with prefix. More...
 
void erase_all_not_starting_with (const std::string &prefix_)
 Erase all properties with key/name not starting with prefix. More...
 
void export_all (properties &props_) const
 Export all properties into another properties container. More...
 
void export_all_adding_prefix (properties &props_, const std::string &prefix_) const
 Export all properties into another properties container adding a prefix. More...
 
void export_starting_with (properties &props_, const std::string &prop_key_prefix_) const
 Export all properties with key/name starting with a given prefix to another properties container. More...
 
void export_and_rename_starting_with (properties &props_, const std::string &prop_key_prefix_, const std::string &new_prefix_) const
 Export all properties with key/name starting with a given prefix to another properties container but renaming the prefix on the fly. More...
 
void export_not_starting_with (properties &props_, const std::string &prop_key_prefix_) const
 Export all properties with key/name not starting with a given suffix to another properties container. More...
 
template<class key_predicate >
void export_if (properties &props_, const key_predicate &predicate_) const
 Export all properties with key/name fulfilling a given predicate. More...
 
template<class key_predicate >
void export_not_if (properties &props_, const key_predicate &predicate_) const
 Export all properties with key/name not fulfilling a given predicate. More...
 
void erase_all_ending_with (const std::string &suffix_)
 Erase all properties with key/name ending with a given suffix. More...
 
void erase_all_not_ending_with (const std::string &suffix_)
 Erase all properties with key/name not ending with a given suffix. More...
 
void export_ending_with (properties &props_, const std::string &suffix_) const
 Export all properties with key/name ending with a given suffix to another properties container. More...
 
void export_not_ending_with (properties &props, const std::string &suffix_) const
 Export all properties with key/name not ending with a given suffix to another properties container. More...
 
void clean (const std::string &prop_key_)
 Remove a property with a given key/name. More...
 
virtual void clear ()
 Reset method (from the datatools::i_clear interface). More...
 
void reset ()
 Reset method. More...
 
void store_flag (const std::string &prop_key_, const std::string &desc_="", bool lock_=false)
 Set a boolean 'true' flag with a given key/name, a description string and a lock request. More...
 
void set_flag (const std::string &prop_key_)
 Set a boolean 'true' flag with a given key/name. More...
 
void unset_flag (const std::string &prop_key_)
 Remove a boolean flag with a given key/name. More...
 
void store (const std::string &prop_key_, bool value_, const std::string &desc_="", bool lock_=false)
 Store a boolean property with a given key/name and value. More...
 
void store_boolean (const std::string &prop_key_, bool value_, const std::string &desc_="", bool lock_=false)
 Store a boolean property with a given key/name and value. More...
 
void store (const std::string &prop_key_, int value_, const std::string &desc_="", bool lock_=false)
 Store an integer property with a given key/name and value. More...
 
void store_integer (const std::string &prop_key_, int value_, const std::string &desc_="", bool lock_=false)
 Store an integer property with a given key/name and value. More...
 
void store (const std::string &prop_key_, double value_, const std::string &desc_="", bool lock_=false)
 Store a real property with a given key/name and value. More...
 
void store_real (const std::string &prop_key_, double value_, const std::string &desc_="", bool lock_=false)
 Store a real property with a given key/name and value. More...
 
void store_real_with_explicit_unit (const std::string &prop_key_, double value_, const std::string &desc="", bool lock_=false)
 Store a real property with a given key/name and value with the explicit unit flag. More...
 
void store_with_explicit_unit (const std::string &prop_key_, double value_, const std::string &desc="", bool lock_=false)
 
void set_explicit_unit (const std::string &prop_key_, bool a_explicit_unit=true)
 Set flag for explicit unit for a real property with a given key/name. More...
 
bool has_explicit_unit (const std::string &prop_key_) const
 Check flag for explicit unit for a real property with a given key/name. More...
 
void set_unit_symbol (const std::string &prop_key_, const std::string &unit_symbol="")
 Set the unit symbol for a real property with a given key/name. More...
 
bool has_unit_symbol (const std::string &prop_key_) const
 Check flag for unit symbol for a real property with a given key/name. More...
 
const std::string & get_unit_symbol (const std::string &prop_key_) const
 Return the unit symbol for a real property with a given key/name. More...
 
void set_explicit_path (const std::string &prop_key_, bool a_explicit_path=true)
 Set flag for explicit path for a string property with a given key/name. More...
 
bool is_explicit_path (const std::string &prop_key_) const
 Check flag for explicit path for a string property with a given key/name. More...
 
void store (const std::string &prop_key_, const std::string &value_, const std::string &desc_="", bool lock_=false)
 Store a string property with a given key/name and value. More...
 
void store_string (const std::string &prop_key_, const std::string &value_, const std::string &desc_="", bool lock_=false)
 Store a string property with a given key/name and value. More...
 
void store_path (const std::string &prop_key_, const std::string &path_value_, const std::string &desc_="", bool lock_=false)
 Store a path property with a given key/name and value. More...
 
void store (const std::string &prop_key_, const char *value_, const std::string &desc_="", bool lock_=false)
 Store a string property with a given key/name and value (C style) More...
 
void store (const std::string &prop_key_, const data::vbool &value_, const std::string &desc_="", bool lock_=false)
 Store a boolean vector property with a given key/name and value. More...
 
void store (const std::string &prop_key_, const data::vint &value_, const std::string &desc_="", bool lock_=false)
 Store a integer vector property with a given key/name and value. More...
 
void store (const std::string &prop_key_, const data::vdouble &value_, const std::string &desc_="", bool lock_=false)
 Store a real vector property with a given key/name and value. More...
 
void store (const std::string &prop_key_, const data::vstring &value_, const std::string &desc_="", bool lock_=false)
 Store a string vector property with a given key/name and value. More...
 
void store_paths (const std::string &prop_key_, const data::vstring &path_value_, const std::string &desc_="", bool lock_=false)
 Store a path string vector property with a given key/name and value. More...
 
void change (const std::string &key_, bool value_, int index_=0)
 Change the value of an existing boolean property with a given key/name and index. More...
 
void change_boolean (const std::string &key_, bool value_, int index_=0)
 Change the value of an existing boolean property with a given key/name and index. More...
 
void change_boolean_scalar (const std::string &key_, bool value_)
 Change the value of an existing scalar boolean property with a given key/name. More...
 
void change_boolean_vector (const std::string &key_, bool value_, int index_)
 Change the value of an existing vector boolean property with a given key/name and index. More...
 
void change (const std::string &key_, int value_, int index_=0)
 Change the value of an existing integer property with a given key/name and index. More...
 
void change_integer (const std::string &key_, int value_, int index_=0)
 Change the value of an existing integer property with a given key/name and index. More...
 
void change_integer_scalar (const std::string &key_, int value_)
 Change the value of an existing integer scalar property with a given key/name. More...
 
void change_integer_vector (const std::string &key_, int value_, int index_)
 Change the value of an existing integer vector property with a given key/name and index. More...
 
void change (const std::string &key_, double value_, int index_=0)
 Change the value of an existing real property with a given key/name and index. More...
 
void change_real (const std::string &key_, double value_, int index_=0)
 Change the value of an existing real property with a given key/name and index. More...
 
void change_real_scalar (const std::string &key_, double value_)
 Change the value of an existing real scalar property with a given key/name. More...
 
void change_real_vector (const std::string &key_, double value_, int index_)
 Change the value of an existing real vector property with a given key/name and index. More...
 
void change (const std::string &key_, const std::string &value_, int index_=0)
 Change the value of an existing string property with a given key/name and index. More...
 
void change_string (const std::string &key_, const std::string &value_, int index_=0)
 Change the value of an existing string property with a given key/name and index. More...
 
void change_string_scalar (const std::string &key_, const std::string &value_)
 Change the value of an existing string scalar property with a given key/name. More...
 
void change_string_vector (const std::string &key_, const std::string &value_, int index_)
 Change the value of an existing string vector property with a given key/name and index. More...
 
void change (const std::string &key_, const char *value_, int index_=0)
 Change the value of an existing string property (C style) with a given key/name and index. More...
 
void change (const std::string &key_, const data::vbool &values_)
 Change the full contents of an existing boolean vector property with a given key/name. More...
 
void change (const std::string &key_, const data::vint &values_)
 Change the full contents of an existing integer vector property with a given key/name. More...
 
void change (const std::string &key_, const data::vdouble &values_)
 Change the full contents of an existing real vector property with a given key/name. More...
 
void change (const std::string &key_, const data::vstring &values_)
 Change the full contents of an existing string vector property with a given key/name. More...
 
void update_flag (const std::string &key_)
 Update a boolean flag to true with a given key/name. More...
 
void update (const std::string &key_, bool value_)
 Update a boolean flag with a given key/name and value. More...
 
void update_boolean (const std::string &key_, bool value_)
 Update a boolean flag with a given key/name and value. More...
 
void update (const std::string &key_, int value_)
 Update an integer flag with a given key/name and value. More...
 
void update_integer (const std::string &key_, int value_)
 Update an integer flag with a given key/name and value. More...
 
void update (const std::string &key_, double value_)
 Update a real flag with a given key/name and value. More...
 
void update_real (const std::string &key_, double value_)
 Update a real flag with a given key/name and value. More...
 
void update_real_with_explicit_unit (const std::string &key_, double value_)
 Update a real flag with a given key/name and value. More...
 
void update_with_explicit_unit (const std::string &key_, double value_)
 Update a real flag with a given key/name and value. More...
 
void update (const std::string &key_, const std::string &value_)
 Update a string flag with a given key/name and value. More...
 
void update (const std::string &key_, const char *value_)
 Update a C-string flag with a given key/name and value. More...
 
void update_string (const std::string &key_, const std::string &value)
 Update a string flag with a given key/name and value. More...
 
void update (const std::string &key_, const data::vbool &values_)
 Update the full contents of a boolean vector with a given key/name. More...
 
void update (const std::string &key_, const data::vint &values_)
 Update the full contents of an integer vector with a given key/name. More...
 
void update (const std::string &key_, const data::vdouble &values_)
 Update the full contents of a real vector with a given key/name. More...
 
void update (const std::string &key_, const data::vstring &values_)
 Update the full contents of a string vector with a given key/name. More...
 
bool has_flag (const std::string &key_) const
 Check if a boolean value with a given key/name exists with value 'true'. More...
 
void fetch (const std::string &key_, bool &value_, int index_=0) const
 Fetch the boolean value stored with a given key/name and index. More...
 
void fetch (const std::string &key_, int &value_, int index_=0) const
 Fetch the integer value stored with a given key/name and index. More...
 
void fetch (const std::string &key_, double &value_, int index_=0) const
 Fetch the real value stored with a given key/name and index. More...
 
void fetch (const std::string &key_, std::string &value_, int index=0) const
 Fetch the string value stored with a given key/name and index. More...
 
void fetch (const std::string &key_, data::vbool &values_) const
 Fetch the boolean vector value stored with a given key/name. More...
 
void fetch (const std::string &key_, data::vint &values_) const
 Fetch the integer vector value stored with a given key/name. More...
 
void fetch (const std::string &key_, data::vdouble &values_) const
 Fetch the real vector value stored with a given key/name. More...
 
void fetch_dimensionless (const std::string &key_, data::vdouble &values_) const
 Fetch the dimensionless real vector value stored with a given key/name. More...
 
void fetch (const std::string &key_, data::vstring &values_) const
 Fetch the string vector value stored with a given key/name. More...
 
void fetch (const std::string &key_, std::set< std::string > &values_, bool allow_duplication_=false) const
 Fetch a set of string values from the vector value stored with a given key/name. More...
 
void fetch_unique_ordered (const std::string &key_, std::vector< std::string > &values_) const
 Fetch a list of unique string values from the vector value stored with a given key/name. More...
 
void fetch (const std::string &key_, std::set< int > &values, bool allow_duplication_=false) const
 Fetch a set of integer values from the vector value stored with a given key/name. More...
 
void fetch_positive (const std::string &key_, std::set< unsigned int > &values_, bool allow_duplication_=false) const
 Fetch a set of unsigned integer values from the vector value stored with a given key/name. More...
 
bool fetch_boolean (const std::string &, int index_=0) const
 Fetch the boolean value stored with a given key/name and index. More...
 
bool fetch_boolean_scalar (const std::string &name_) const
 Fetch the boolean scalar value stored with a given key/name. More...
 
bool fetch_boolean_vector (const std::string &name_, int index_) const
 Fetch the boolean vector value stored with a given key/name and index. More...
 
int fetch_integer (const std::string &name_, int index_=0) const
 Fetch the integer value stored with a given key/name and index. More...
 
unsigned int fetch_positive_integer (const std::string &name_, int index_=0) const
 Fetch the positive integer value stored with a given key/name and index. More...
 
unsigned int fetch_strict_positive_integer (const std::string &name_, int index_=0) const
 Fetch the strict positive integer value stored with a given key/name and index. More...
 
int fetch_range_integer (const std::string &name_, int min_, int max_, int index_=0) const
 Fetch the ranged integer value stored with a given key/name and index. More...
 
int fetch_integer_scalar (const std::string &name_) const
 Fetch the integer scalar value stored with a given key/name. More...
 
int fetch_integer_vector (const std::string &name_, int index_) const
 Fetch the integer vector value stored with a given key/name and index. More...
 
double fetch_real (const std::string &name_, int index_=0) const
 Fetch the real value stored with a given key/name and index. More...
 
double fetch_dimensionless_real (const std::string &name_, int index_=0) const
 Fetch the dimensionless real value stored with a given key/name and index. More...
 
double fetch_real_with_explicit_unit (const std::string &name_, int index_=0) const
 Fetch the physical quantity (with its explicit unit) value stored with a given key/name and index. More...
 
double fetch_real_with_explicit_dimension (const std::string &name_, const std::string &dimension_, int index_=0) const
 Fetch the physical quantity (with its explicit dimension) value stored with a given key/name and index. More...
 
double fetch_real_scalar (const std::string &name_) const
 Fetch the real scalar value stored with a given key/name. More...
 
double fetch_real_vector (const std::string &name_, int index_) const
 Fetch the real vector value stored with a given key/name and index. More...
 
std::string fetch_string (const std::string &name_, int index_=0) const
 Fetch the string value stored with a given key/name and index. More...
 
char fetch_one_character (const std::string &name_, int index_=0) const
 Fetch a single character value stored with a given key/name and index. More...
 
std::string fetch_string_scalar (const std::string &name_) const
 Fetch the string scalar value stored with a given key/name. More...
 
std::string fetch_string_vector (const std::string &name_, int index_) const
 Fetch the string vector value stored with a given key/name and index. More...
 
std::string fetch_path (const std::string &name_, int index_=0) const
 Fetch a file path from a string value stored with a given key/name and index. More...
 
std::string fetch_path_scalar (const std::string &name_) const
 Fetch a file path from a string scalar value stored with a given key/name. More...
 
std::string fetch_path_vector (const std::string &name_, int index_) const
 Fetch a file path from a string vector value stored with a given key/name and index. More...
 
void dump (std::ostream &out_=std::clog) const
 Basic print. More...
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 
void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const override
 Smart print. More...
 
std::string key_to_string (const std::string &key_) const
 
std::string key_to_property_string (const std::string &key_) const
 
void export_to_string_based_dictionary (std::map< std::string, std::string > &dict_, bool quoted_strings_=true) const
 
void write_configuration (const std::string &filename_, uint32_t options_=config::SMART_MODULO|config::SKIP_PRIVATE) const
 Store the properties' container object in an ASCII text file. More...
 
void read_configuration (const std::string &filename_, uint32_t options_=config::SMART_MODULO)
 
- Public Member Functions inherited from datatools::i_serializable
 i_serializable ()
 Default constructor. More...
 
virtual ~i_serializable ()
 Destructor. More...
 
virtual const std::string & get_serial_tag () const =0
 Return the serialization string identifier of the class. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 
- Public Member Functions inherited from datatools::i_clear
virtual ~i_clear ()
 Destructor. More...
 
- Public Member Functions inherited from datatools::i_cloneable
virtual i_cloneableclone (void) const =0
 
virtual ~i_cloneable ()
 
template<class CandidateType >
bool is_cloneable (const CandidateType &candidate_)
 

Static Public Member Functions

static const std::string & private_property_prefix ()
 
static std::string make_private_key (const std::string &prop_key_)
 Return a static key. More...
 
static bool key_is_private (const std::string &prop_key_)
 Check if a string matches a private 'prop_key_'. More...
 
static bool key_is_public (const std::string &prop_key_)
 Check if a string matches a public 'prop_key_'. More...
 
static void write_config (const std::string &filename_, const properties &props_, uint32_t options_=0)
 Store the properties' container object in an ASCII text file. More...
 
static void read_config (const std::string &filename_, properties &props_, uint32_t options_=0)
 
static std::string build_property_key (const std::string &prefix_, const std::string &subkey_)
 Build a new property key from a prefix and a key. More...
 
- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 
- Static Public Member Functions inherited from datatools::i_cloneable
template<class Copyable >
static Copyable * clone_it (const Copyable &a_copyable)
 

Protected Types

typedef std::map< std::string, datapmap
 

Static Protected Member Functions

static default_key_validatorglobal_default_key_validator ()
 Default global key validator (singleton) More...
 

Friends

class config
 

Detailed Description

A dictionary of arbitrary properties.

The properties class provides a serializable container that holds many different data of different types (bool, int, double, string) as well as sized arrays (std::vector) of these build-in types.

Additional features are available for some types of properties:

The properties class is provided with different I/O mechnisms:

Example:

// Instantiate a container of arbitrary parameters:
datatools::properties my_parameters;
// Store properties:
my_parameters.store("test", true, "Test flag");
my_parameters.store("nitems", 42, "Number of items");
my_parameters.store("favorite_color", "Blue", "my favorite color");
my_parameters.store("ratio", 3.14159, "The Pi ratio");
my_parameters.store_with_explicit_unit("width", 12.34 * CLHEP::meter, "The width of the table");
my_parameters.set_unit_symbol("width", "mm");
std::vector<double> pos({ 1.2 * CLHEP::km, 3.4 * CLHEP::km});
my_parameters.store("position", pos, "The position on the 2D-map");
my_parameters.set_unit_symbol("position", "km");
// Smart print:
std::cout << "My parameters: " << std::endl;
my_parameters.print_tree(std::cout);
// Save as a file:
my_parameters.write_configuration("my_params.conf");
// Fetch properties:
bool test = my_parameters.fetch_boolean("test");
uint32_t nitems = my_parameters.fetch_positive_integer("nitems");
std::string favorite_color = my_parameters.fetch_string("favorite_color");
double ratio = my_parameters.fetch_dimensionless_real("ratio");
double width = my_parameters.fetch_real_with_explicit_dimension("width", "length");
// Instantiate another container:
datatools::properties my_parameters2;
// Load it from the configuration file:
my_parameters2.read_configuration("my_params.conf");
// Smart print:
std::cout << "My parameters: " << std::endl;
my_parameters.print_tree(std::cout);
// Fetch properties:
bool test2 = my_parameters2.fetch_boolean("test");

Member Typedef Documentation

◆ keys_col_type

typedef std::vector<std::string> datatools::properties::keys_col_type

◆ pmap

typedef std::map<std::string, data> datatools::properties::pmap
protected

Constructor & Destructor Documentation

◆ properties() [1/6]

datatools::properties::properties ( )

Default constructor with embedded default key validator.

◆ properties() [2/6]

datatools::properties::properties ( const std::string &  desc_)
explicit

Constructor with explicit description and embedded default key validator.

◆ properties() [3/6]

datatools::properties::properties ( const std::string &  desc_,
const basic_key_validator  
)

Constructor with explicit description and explicit key validator.

◆ properties() [4/6]

datatools::properties::properties ( const basic_key_validator )
explicit

Constructor with explicit key validator.

◆ properties() [5/6]

datatools::properties::properties ( const std::string &  desc_,
const basic_key_validator ,
bool  deletion_on_destroy_ = true 
)

Constructor with explicit description and explicit external key validator.

◆ properties() [6/6]

datatools::properties::properties ( const basic_key_validator ,
bool  deletion_on_destroy_ = true 
)
explicit

Constructor with explicit external key validator.

◆ ~properties()

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

Destructor.

Member Function Documentation

◆ build_property_key()

static std::string datatools::properties::build_property_key ( const std::string &  prefix_,
const std::string &  subkey_ 
)
static

Build a new property key from a prefix and a key.

◆ change() [1/9]

void datatools::properties::change ( const std::string &  key_,
bool  value_,
int  index_ = 0 
)

Change the value of an existing boolean property with a given key/name and index.

◆ change() [2/9]

void datatools::properties::change ( const std::string &  key_,
int  value_,
int  index_ = 0 
)

Change the value of an existing integer property with a given key/name and index.

◆ change() [3/9]

void datatools::properties::change ( const std::string &  key_,
double  value_,
int  index_ = 0 
)

Change the value of an existing real property with a given key/name and index.

◆ change() [4/9]

void datatools::properties::change ( const std::string &  key_,
const std::string &  value_,
int  index_ = 0 
)

Change the value of an existing string property with a given key/name and index.

◆ change() [5/9]

void datatools::properties::change ( const std::string &  key_,
const char *  value_,
int  index_ = 0 
)

Change the value of an existing string property (C style) with a given key/name and index.

◆ change() [6/9]

void datatools::properties::change ( const std::string &  key_,
const data::vbool values_ 
)

Change the full contents of an existing boolean vector property with a given key/name.

◆ change() [7/9]

void datatools::properties::change ( const std::string &  key_,
const data::vint values_ 
)

Change the full contents of an existing integer vector property with a given key/name.

◆ change() [8/9]

void datatools::properties::change ( const std::string &  key_,
const data::vdouble values_ 
)

Change the full contents of an existing real vector property with a given key/name.

◆ change() [9/9]

void datatools::properties::change ( const std::string &  key_,
const data::vstring values_ 
)

Change the full contents of an existing string vector property with a given key/name.

◆ change_boolean()

void datatools::properties::change_boolean ( const std::string &  key_,
bool  value_,
int  index_ = 0 
)

Change the value of an existing boolean property with a given key/name and index.

◆ change_boolean_scalar()

void datatools::properties::change_boolean_scalar ( const std::string &  key_,
bool  value_ 
)

Change the value of an existing scalar boolean property with a given key/name.

◆ change_boolean_vector()

void datatools::properties::change_boolean_vector ( const std::string &  key_,
bool  value_,
int  index_ 
)

Change the value of an existing vector boolean property with a given key/name and index.

◆ change_integer()

void datatools::properties::change_integer ( const std::string &  key_,
int  value_,
int  index_ = 0 
)

Change the value of an existing integer property with a given key/name and index.

◆ change_integer_scalar()

void datatools::properties::change_integer_scalar ( const std::string &  key_,
int  value_ 
)

Change the value of an existing integer scalar property with a given key/name.

◆ change_integer_vector()

void datatools::properties::change_integer_vector ( const std::string &  key_,
int  value_,
int  index_ 
)

Change the value of an existing integer vector property with a given key/name and index.

◆ change_real()

void datatools::properties::change_real ( const std::string &  key_,
double  value_,
int  index_ = 0 
)

Change the value of an existing real property with a given key/name and index.

◆ change_real_scalar()

void datatools::properties::change_real_scalar ( const std::string &  key_,
double  value_ 
)

Change the value of an existing real scalar property with a given key/name.

◆ change_real_vector()

void datatools::properties::change_real_vector ( const std::string &  key_,
double  value_,
int  index_ 
)

Change the value of an existing real vector property with a given key/name and index.

◆ change_string()

void datatools::properties::change_string ( const std::string &  key_,
const std::string &  value_,
int  index_ = 0 
)

Change the value of an existing string property with a given key/name and index.

◆ change_string_scalar()

void datatools::properties::change_string_scalar ( const std::string &  key_,
const std::string &  value_ 
)

Change the value of an existing string scalar property with a given key/name.

◆ change_string_vector()

void datatools::properties::change_string_vector ( const std::string &  key_,
const std::string &  value_,
int  index_ 
)

Change the value of an existing string vector property with a given key/name and index.

◆ clean()

void datatools::properties::clean ( const std::string &  prop_key_)

Remove a property with a given key/name.

◆ clear()

virtual void datatools::properties::clear ( )
virtual

Reset method (from the datatools::i_clear interface).

Implements datatools::i_clear.

◆ dump()

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

Basic print.

◆ empty()

bool datatools::properties::empty ( ) const

Check if the properties container is empty.

◆ erase()

void datatools::properties::erase ( const std::string &  key_)

Rename a property with a new name.

Erase property with a given key/name

◆ erase_all()

void datatools::properties::erase_all ( )

Erase all properties.

◆ erase_all_ending_with()

void datatools::properties::erase_all_ending_with ( const std::string &  suffix_)

Erase all properties with key/name ending with a given suffix.

◆ erase_all_not_ending_with()

void datatools::properties::erase_all_not_ending_with ( const std::string &  suffix_)

Erase all properties with key/name not ending with a given suffix.

◆ erase_all_not_starting_with()

void datatools::properties::erase_all_not_starting_with ( const std::string &  prefix_)

Erase all properties with key/name not starting with prefix.

◆ erase_all_starting_with()

void datatools::properties::erase_all_starting_with ( const std::string &  prefix_)

Erase all properties with key/name starting with prefix.

◆ export_all()

void datatools::properties::export_all ( properties props_) const

Export all properties into another properties container.

◆ export_all_adding_prefix()

void datatools::properties::export_all_adding_prefix ( properties props_,
const std::string &  prefix_ 
) const

Export all properties into another properties container adding a prefix.

◆ export_and_rename_starting_with()

void datatools::properties::export_and_rename_starting_with ( properties props_,
const std::string &  prop_key_prefix_,
const std::string &  new_prefix_ 
) const

Export all properties with key/name starting with a given prefix to another properties container but renaming the prefix on the fly.

◆ export_ending_with()

void datatools::properties::export_ending_with ( properties props_,
const std::string &  suffix_ 
) const

Export all properties with key/name ending with a given suffix to another properties container.

◆ export_if()

template<class key_predicate >
void datatools::properties::export_if ( properties props_,
const key_predicate &  predicate_ 
) const

Export all properties with key/name fulfilling a given predicate.

◆ export_not_ending_with()

void datatools::properties::export_not_ending_with ( properties props,
const std::string &  suffix_ 
) const

Export all properties with key/name not ending with a given suffix to another properties container.

◆ export_not_if()

template<class key_predicate >
void datatools::properties::export_not_if ( properties props_,
const key_predicate &  predicate_ 
) const

Export all properties with key/name not fulfilling a given predicate.

◆ export_not_starting_with()

void datatools::properties::export_not_starting_with ( properties props_,
const std::string &  prop_key_prefix_ 
) const

Export all properties with key/name not starting with a given suffix to another properties container.

◆ export_starting_with()

void datatools::properties::export_starting_with ( properties props_,
const std::string &  prop_key_prefix_ 
) const

Export all properties with key/name starting with a given prefix to another properties container.

◆ export_to_string_based_dictionary()

void datatools::properties::export_to_string_based_dictionary ( std::map< std::string, std::string > &  dict_,
bool  quoted_strings_ = true 
) const

◆ fetch() [1/10]

void datatools::properties::fetch ( const std::string &  key_,
bool &  value_,
int  index_ = 0 
) const

Fetch the boolean value stored with a given key/name and index.

◆ fetch() [2/10]

void datatools::properties::fetch ( const std::string &  key_,
int &  value_,
int  index_ = 0 
) const

Fetch the integer value stored with a given key/name and index.

◆ fetch() [3/10]

void datatools::properties::fetch ( const std::string &  key_,
double &  value_,
int  index_ = 0 
) const

Fetch the real value stored with a given key/name and index.

◆ fetch() [4/10]

void datatools::properties::fetch ( const std::string &  key_,
std::string &  value_,
int  index = 0 
) const

Fetch the string value stored with a given key/name and index.

◆ fetch() [5/10]

void datatools::properties::fetch ( const std::string &  key_,
data::vbool values_ 
) const

Fetch the boolean vector value stored with a given key/name.

◆ fetch() [6/10]

void datatools::properties::fetch ( const std::string &  key_,
data::vint values_ 
) const

Fetch the integer vector value stored with a given key/name.

◆ fetch() [7/10]

void datatools::properties::fetch ( const std::string &  key_,
data::vdouble values_ 
) const

Fetch the real vector value stored with a given key/name.

◆ fetch() [8/10]

void datatools::properties::fetch ( const std::string &  key_,
data::vstring values_ 
) const

Fetch the string vector value stored with a given key/name.

◆ fetch() [9/10]

void datatools::properties::fetch ( const std::string &  key_,
std::set< std::string > &  values_,
bool  allow_duplication_ = false 
) const

Fetch a set of string values from the vector value stored with a given key/name.

◆ fetch() [10/10]

void datatools::properties::fetch ( const std::string &  key_,
std::set< int > &  values,
bool  allow_duplication_ = false 
) const

Fetch a set of integer values from the vector value stored with a given key/name.

◆ fetch_auxiliary_descriptions()

bool datatools::properties::fetch_auxiliary_descriptions ( std::vector< std::string > &  ) const

Fetch the auxiliary description strings associated to the container.

◆ fetch_boolean()

bool datatools::properties::fetch_boolean ( const std::string &  ,
int  index_ = 0 
) const

Fetch the boolean value stored with a given key/name and index.

◆ fetch_boolean_scalar()

bool datatools::properties::fetch_boolean_scalar ( const std::string &  name_) const

Fetch the boolean scalar value stored with a given key/name.

◆ fetch_boolean_vector()

bool datatools::properties::fetch_boolean_vector ( const std::string &  name_,
int  index_ 
) const

Fetch the boolean vector value stored with a given key/name and index.

◆ fetch_dimensionless()

void datatools::properties::fetch_dimensionless ( const std::string &  key_,
data::vdouble values_ 
) const

Fetch the dimensionless real vector value stored with a given key/name.

◆ fetch_dimensionless_real()

double datatools::properties::fetch_dimensionless_real ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the dimensionless real value stored with a given key/name and index.

◆ fetch_integer()

int datatools::properties::fetch_integer ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the integer value stored with a given key/name and index.

◆ fetch_integer_scalar()

int datatools::properties::fetch_integer_scalar ( const std::string &  name_) const

Fetch the integer scalar value stored with a given key/name.

◆ fetch_integer_vector()

int datatools::properties::fetch_integer_vector ( const std::string &  name_,
int  index_ 
) const

Fetch the integer vector value stored with a given key/name and index.

◆ fetch_one_character()

char datatools::properties::fetch_one_character ( const std::string &  name_,
int  index_ = 0 
) const

Fetch a single character value stored with a given key/name and index.

◆ fetch_path()

std::string datatools::properties::fetch_path ( const std::string &  name_,
int  index_ = 0 
) const

Fetch a file path from a string value stored with a given key/name and index.

◆ fetch_path_scalar()

std::string datatools::properties::fetch_path_scalar ( const std::string &  name_) const

Fetch a file path from a string scalar value stored with a given key/name.

◆ fetch_path_vector()

std::string datatools::properties::fetch_path_vector ( const std::string &  name_,
int  index_ 
) const

Fetch a file path from a string vector value stored with a given key/name and index.

◆ fetch_positive()

void datatools::properties::fetch_positive ( const std::string &  key_,
std::set< unsigned int > &  values_,
bool  allow_duplication_ = false 
) const

Fetch a set of unsigned integer values from the vector value stored with a given key/name.

◆ fetch_positive_integer()

unsigned int datatools::properties::fetch_positive_integer ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the positive integer value stored with a given key/name and index.

◆ fetch_range_integer()

int datatools::properties::fetch_range_integer ( const std::string &  name_,
int  min_,
int  max_,
int  index_ = 0 
) const

Fetch the ranged integer value stored with a given key/name and index.

◆ fetch_real()

double datatools::properties::fetch_real ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the real value stored with a given key/name and index.

◆ fetch_real_scalar()

double datatools::properties::fetch_real_scalar ( const std::string &  name_) const

Fetch the real scalar value stored with a given key/name.

◆ fetch_real_vector()

double datatools::properties::fetch_real_vector ( const std::string &  name_,
int  index_ 
) const

Fetch the real vector value stored with a given key/name and index.

◆ fetch_real_with_explicit_dimension()

double datatools::properties::fetch_real_with_explicit_dimension ( const std::string &  name_,
const std::string &  dimension_,
int  index_ = 0 
) const

Fetch the physical quantity (with its explicit dimension) value stored with a given key/name and index.

◆ fetch_real_with_explicit_unit()

double datatools::properties::fetch_real_with_explicit_unit ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the physical quantity (with its explicit unit) value stored with a given key/name and index.

◆ fetch_short_description()

bool datatools::properties::fetch_short_description ( std::string &  ) const

Fetch the short description string associated to the container.

◆ fetch_strict_positive_integer()

unsigned int datatools::properties::fetch_strict_positive_integer ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the strict positive integer value stored with a given key/name and index.

◆ fetch_string()

std::string datatools::properties::fetch_string ( const std::string &  name_,
int  index_ = 0 
) const

Fetch the string value stored with a given key/name and index.

◆ fetch_string_scalar()

std::string datatools::properties::fetch_string_scalar ( const std::string &  name_) const

Fetch the string scalar value stored with a given key/name.

◆ fetch_string_vector()

std::string datatools::properties::fetch_string_vector ( const std::string &  name_,
int  index_ 
) const

Fetch the string vector value stored with a given key/name and index.

◆ fetch_unique_ordered()

void datatools::properties::fetch_unique_ordered ( const std::string &  key_,
std::vector< std::string > &  values_ 
) const

Fetch a list of unique string values from the vector value stored with a given key/name.

◆ get()

const data& datatools::properties::get ( const std::string &  prop_key_) const

Access to a non-mutable reference to a property data object.

◆ get_description()

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

Returns the description string of the properties container.

◆ get_key_description()

const std::string& datatools::properties::get_key_description ( const std::string &  prop_key_) const

Get the description string associated to a property with given key/name.

◆ get_short_description()

std::string datatools::properties::get_short_description ( ) const

Get the short description string associated to the container.

◆ get_unit_symbol()

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

Return the unit symbol for a real property with a given key/name.

◆ global_default_key_validator()

static default_key_validator& datatools::properties::global_default_key_validator ( )
staticprotected

Default global key validator (singleton)

◆ has_auxiliary_descriptions()

bool datatools::properties::has_auxiliary_descriptions ( ) const

Check if some auxiliary descriptions are set.

◆ has_explicit_unit()

bool datatools::properties::has_explicit_unit ( const std::string &  prop_key_) const

Check flag for explicit unit for a real property with a given key/name.

◆ has_flag()

bool datatools::properties::has_flag ( const std::string &  key_) const

Check if a boolean value with a given key/name exists with value 'true'.

◆ has_key()

bool datatools::properties::has_key ( const std::string &  prop_key_) const

Check if a property with given key/name exists.

◆ has_short_description()

bool datatools::properties::has_short_description ( ) const

Check if a short description string is associated to the container.

◆ has_unit_symbol()

bool datatools::properties::has_unit_symbol ( const std::string &  prop_key_) const

Check flag for unit symbol for a real property with a given key/name.

◆ is_boolean()

bool datatools::properties::is_boolean ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is boolean.

◆ is_explicit_path()

bool datatools::properties::is_explicit_path ( const std::string &  prop_key_) const

Check flag for explicit path for a string property with a given key/name.

◆ is_integer()

bool datatools::properties::is_integer ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is integer.

◆ is_locked()

bool datatools::properties::is_locked ( const std::string &  prop_key_) const

Check if the instance is locked.

◆ is_private()

bool datatools::properties::is_private ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is private.

◆ is_public()

bool datatools::properties::is_public ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is public.

◆ is_real()

bool datatools::properties::is_real ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is real.

◆ is_scalar()

bool datatools::properties::is_scalar ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is scalar.

◆ is_string()

bool datatools::properties::is_string ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is string.

◆ is_vector()

bool datatools::properties::is_vector ( const std::string &  prop_key_) const

Check if data with name 'prop_key_' is vector.

◆ key()

const std::string& datatools::properties::key ( int  ) const

Returns the ith key.

◆ key_is_private()

static bool datatools::properties::key_is_private ( const std::string &  prop_key_)
static

Check if a string matches a private 'prop_key_'.

◆ key_is_public()

static bool datatools::properties::key_is_public ( const std::string &  prop_key_)
static

Check if a string matches a public 'prop_key_'.

◆ key_lock()

void datatools::properties::key_lock ( const std::string &  prop_key_)

Lock a property with given key/name.

◆ key_size()

int32_t datatools::properties::key_size ( const std::string &  prop_key_) const

Returns the size of the data stored with a given key/name.

◆ key_to_property_string()

std::string datatools::properties::key_to_property_string ( const std::string &  key_) const

◆ key_to_string()

std::string datatools::properties::key_to_string ( const std::string &  key_) const

◆ key_unlock()

void datatools::properties::key_unlock ( const std::string &  prop_key_)

Unlock a property with given key/name.

◆ keys() [1/2]

std::vector<std::string> datatools::properties::keys ( ) const

Returns the list of keys stored in the map (read-only).

◆ keys() [2/2]

void datatools::properties::keys ( std::vector< std::string > &  ) const

Set the list of keys.

◆ keys_ending_with() [1/2]

void datatools::properties::keys_ending_with ( std::vector< std::string > &  ,
const std::string &  suffix_ 
) const

builds the list of keys (by reference) stored in the map that end with suffix.

◆ keys_ending_with() [2/2]

std::vector<std::string> datatools::properties::keys_ending_with ( const std::string &  suffix_) const

returns the list of keys stored in the map that end with suffix.

◆ keys_not_ending_with() [1/2]

void datatools::properties::keys_not_ending_with ( std::vector< std::string > &  ,
const std::string &  suffix_ 
) const

builds the list of keys (by reference) stored in the map that end with suffix.

◆ keys_not_ending_with() [2/2]

std::vector<std::string> datatools::properties::keys_not_ending_with ( const std::string &  suffix_) const

returns the list of keys stored in the map that end with suffix.

◆ keys_not_starting_with() [1/2]

void datatools::properties::keys_not_starting_with ( std::vector< std::string > &  ,
const std::string &  prefix_ 
) const

builds the list of keys (by reference) stored in the map that start with prefix.

◆ keys_not_starting_with() [2/2]

std::vector<std::string> datatools::properties::keys_not_starting_with ( const std::string &  prefix_) const

returns the list of keys stored in the map that start with prefix.

◆ keys_starting_with() [1/2]

void datatools::properties::keys_starting_with ( std::vector< std::string > &  ,
const std::string &  prefix_ 
) const

builds the list of keys (by reference) stored in the map that start with prefix.

◆ keys_starting_with() [2/2]

std::vector<std::string> datatools::properties::keys_starting_with ( const std::string &  prefix_) const

returns the list of keys stored in the map that start with prefix.

◆ lock()

void datatools::properties::lock ( const std::string &  prop_key_)

Lock the properties dictionary.

◆ make_private_key()

static std::string datatools::properties::make_private_key ( const std::string &  prop_key_)
static

Return a static key.

◆ print_tree()

void datatools::properties::print_tree ( std::ostream &  out_ = std::clog,
const boost::property_tree::ptree &  options_ = empty_options() 
) const
overridevirtual

Smart print.

Reimplemented from datatools::i_tree_dumpable.

◆ private_property_prefix()

static const std::string& datatools::properties::private_property_prefix ( )
static

Prefix string used for the naming of private properties

A private property has a key starting with this prefix, namely '__' (double underscore).

◆ read_config()

static void datatools::properties::read_config ( const std::string &  filename_,
properties props_,
uint32_t  options_ = 0 
)
static

Load the properties' container object from an ASCII text file

See also
The datatools::properties::config::read method for file format

◆ read_configuration()

void datatools::properties::read_configuration ( const std::string &  filename_,
uint32_t  options_ = config::SMART_MODULO 
)

Load the properties' container object from an ASCII text file

See also
The datatools::properties::config::read method for file format

◆ reset()

void datatools::properties::reset ( )

Reset method.

◆ set_default_key_validator()

void datatools::properties::set_default_key_validator ( )

Use the default key validator.

◆ set_description()

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

Set the description string of the properties container

The description is a single line of text possibly splitted in subparts separated by the semicolon (';') character.

Examples:

Head
Head;Text;...;Text;...
;Text;...;Text;...

The leading (optional) subpart corresponds to a short text which describes the container of properties. The other subparts are optional and possibly add some auxiliary informations about the container of properties.

Examples:

My beautiful set of configuration parameters; group=geometry ; price=100 credits ; company=ACME

The leading (optional) subpart corresponds to a short text

Supported format in configuration file:

#@config short-description-text;metadata0;metadata1;metadata2

◆ set_explicit_path()

void datatools::properties::set_explicit_path ( const std::string &  prop_key_,
bool  a_explicit_path = true 
)

Set flag for explicit path for a string property with a given key/name.

◆ set_explicit_unit()

void datatools::properties::set_explicit_unit ( const std::string &  prop_key_,
bool  a_explicit_unit = true 
)

Set flag for explicit unit for a real property with a given key/name.

◆ set_flag()

void datatools::properties::set_flag ( const std::string &  prop_key_)

Set a boolean 'true' flag with a given key/name.

Parameters
prop_key_The key of the boolean property

◆ set_key_description()

void datatools::properties::set_key_description ( const std::string &  prop_key_,
const std::string &  desc_ 
)

Set the description string associated to a property with given key/name.

◆ set_key_validator() [1/2]

void datatools::properties::set_key_validator ( const basic_key_validator )

Set the current key validator.

◆ set_key_validator() [2/2]

void datatools::properties::set_key_validator ( const basic_key_validator ,
bool  deletion_on_destroy_ = true 
)

Set the current key validator with ownership.

◆ set_unit_symbol()

void datatools::properties::set_unit_symbol ( const std::string &  prop_key_,
const std::string &  unit_symbol = "" 
)

Set the unit symbol for a real property with a given key/name.

◆ size() [1/2]

int32_t datatools::properties::size ( ) const

Returns the number of stored properties.

◆ size() [2/2]

int32_t datatools::properties::size ( const std::string &  prop_key_) const

◆ store() [1/10]

void datatools::properties::store ( const std::string &  key_,
const data value_ 
)

Store data item with supplied key.

◆ store() [2/10]

void datatools::properties::store ( const std::string &  prop_key_,
bool  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a boolean property with a given key/name and value.

◆ store() [3/10]

void datatools::properties::store ( const std::string &  prop_key_,
int  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store an integer property with a given key/name and value.

◆ store() [4/10]

void datatools::properties::store ( const std::string &  prop_key_,
double  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a real property with a given key/name and value.

◆ store() [5/10]

void datatools::properties::store ( const std::string &  prop_key_,
const std::string &  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a string property with a given key/name and value.

◆ store() [6/10]

void datatools::properties::store ( const std::string &  prop_key_,
const char *  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a string property with a given key/name and value (C style)

◆ store() [7/10]

void datatools::properties::store ( const std::string &  prop_key_,
const data::vbool value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a boolean vector property with a given key/name and value.

◆ store() [8/10]

void datatools::properties::store ( const std::string &  prop_key_,
const data::vint value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a integer vector property with a given key/name and value.

◆ store() [9/10]

void datatools::properties::store ( const std::string &  prop_key_,
const data::vdouble value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a real vector property with a given key/name and value.

◆ store() [10/10]

void datatools::properties::store ( const std::string &  prop_key_,
const data::vstring value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a string vector property with a given key/name and value.

◆ store_boolean()

void datatools::properties::store_boolean ( const std::string &  prop_key_,
bool  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a boolean property with a given key/name and value.

◆ store_flag()

void datatools::properties::store_flag ( const std::string &  prop_key_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Set a boolean 'true' flag with a given key/name, a description string and a lock request.

◆ store_integer()

void datatools::properties::store_integer ( const std::string &  prop_key_,
int  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store an integer property with a given key/name and value.

◆ store_path()

void datatools::properties::store_path ( const std::string &  prop_key_,
const std::string &  path_value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a path property with a given key/name and value.

◆ store_paths()

void datatools::properties::store_paths ( const std::string &  prop_key_,
const data::vstring path_value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a path string vector property with a given key/name and value.

◆ store_real()

void datatools::properties::store_real ( const std::string &  prop_key_,
double  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a real property with a given key/name and value.

◆ store_real_with_explicit_unit()

void datatools::properties::store_real_with_explicit_unit ( const std::string &  prop_key_,
double  value_,
const std::string &  desc = "",
bool  lock_ = false 
)

Store a real property with a given key/name and value with the explicit unit flag.

config.store_real("box.zoom_factor", 2.5);
config.store_real("box.efficiency", 0.17);
config.store_real_with_explicit_unit("box.width", 3.4 * CLHEP::cm);
config.store_real_with_explicit_unit("box.height", 5.2 * CLHEP::mm);

◆ store_string()

void datatools::properties::store_string ( const std::string &  prop_key_,
const std::string &  value_,
const std::string &  desc_ = "",
bool  lock_ = false 
)

Store a string property with a given key/name and value.

◆ store_with_explicit_unit()

void datatools::properties::store_with_explicit_unit ( const std::string &  prop_key_,
double  value_,
const std::string &  desc = "",
bool  lock_ = false 
)

Store a real property with a given key/name and value with the explicit unit flag

See also
store_real_with_explicit_unit

◆ tree_dump()

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

Reimplemented from datatools::i_tree_dumpable.

◆ unlock()

void datatools::properties::unlock ( const std::string &  prop_key_)

Unlock the properties dictionary.

◆ unset_flag()

void datatools::properties::unset_flag ( const std::string &  prop_key_)

Remove a boolean flag with a given key/name.

Parameters
prop_key_The key of the boolean property

◆ unset_key_validator()

void datatools::properties::unset_key_validator ( )

Unset the current key validator.

◆ update() [1/9]

void datatools::properties::update ( const std::string &  key_,
bool  value_ 
)

Update a boolean flag with a given key/name and value.

◆ update() [2/9]

void datatools::properties::update ( const std::string &  key_,
int  value_ 
)

Update an integer flag with a given key/name and value.

◆ update() [3/9]

void datatools::properties::update ( const std::string &  key_,
double  value_ 
)

Update a real flag with a given key/name and value.

◆ update() [4/9]

void datatools::properties::update ( const std::string &  key_,
const std::string &  value_ 
)

Update a string flag with a given key/name and value.

◆ update() [5/9]

void datatools::properties::update ( const std::string &  key_,
const char *  value_ 
)

Update a C-string flag with a given key/name and value.

◆ update() [6/9]

void datatools::properties::update ( const std::string &  key_,
const data::vbool values_ 
)

Update the full contents of a boolean vector with a given key/name.

◆ update() [7/9]

void datatools::properties::update ( const std::string &  key_,
const data::vint values_ 
)

Update the full contents of an integer vector with a given key/name.

◆ update() [8/9]

void datatools::properties::update ( const std::string &  key_,
const data::vdouble values_ 
)

Update the full contents of a real vector with a given key/name.

◆ update() [9/9]

void datatools::properties::update ( const std::string &  key_,
const data::vstring values_ 
)

Update the full contents of a string vector with a given key/name.

◆ update_boolean()

void datatools::properties::update_boolean ( const std::string &  key_,
bool  value_ 
)

Update a boolean flag with a given key/name and value.

◆ update_flag()

void datatools::properties::update_flag ( const std::string &  key_)

Update a boolean flag to true with a given key/name.

◆ update_integer()

void datatools::properties::update_integer ( const std::string &  key_,
int  value_ 
)

Update an integer flag with a given key/name and value.

◆ update_real()

void datatools::properties::update_real ( const std::string &  key_,
double  value_ 
)

Update a real flag with a given key/name and value.

◆ update_real_with_explicit_unit()

void datatools::properties::update_real_with_explicit_unit ( const std::string &  key_,
double  value_ 
)

Update a real flag with a given key/name and value.

◆ update_string()

void datatools::properties::update_string ( const std::string &  key_,
const std::string &  value 
)

Update a string flag with a given key/name and value.

◆ update_with_explicit_unit()

void datatools::properties::update_with_explicit_unit ( const std::string &  key_,
double  value_ 
)

Update a real flag with a given key/name and value.

◆ write_config()

static void datatools::properties::write_config ( const std::string &  filename_,
const properties props_,
uint32_t  options_ = 0 
)
static

Store the properties' container object in an ASCII text file.

◆ write_configuration()

void datatools::properties::write_configuration ( const std::string &  filename_,
uint32_t  options_ = config::SMART_MODULO|config::SKIP_PRIVATE 
) const

Store the properties' container object in an ASCII text file.

Friends And Related Function Documentation

◆ config

friend class config
friend

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