Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Unit information associated to a parameter. More...
#include <bayeux/datatools/introspection/unit_support.h>
Public Types | |
enum | unit_info_xc_flags { UI_XC_CLEAR = bit_mask::bit00, UI_XC_UNIT_SUPPORT = bit_mask::bit01, UI_XC_PREFERRED_UNIT = bit_mask::bit02, UI_XC_DEFAULT, DD_XC_LAST = UI_XC_PREFERRED_UNIT } |
Flags for export to a container of properties. More... | |
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 | |
unit_info () | |
Default constructor. More... | |
unit_info (unit_support_type, const std::string &unit_token_, const std::string &unit_token2_="") | |
Constructor. More... | |
virtual | ~unit_info () |
Destructor. More... | |
bool | is_valid () const |
Check validity. More... | |
bool | has_implicit_unit () const |
Check the implicit unit trait. More... | |
bool | has_explicit_unit_dimension () const |
Check the explicit unitdimension trait. More... | |
void | set_unit_support (unit_support_type) |
Set the unit support. More... | |
unit_support_type | get_unit_support () const |
Return the unit support. More... | |
void | set_implicit_unit_symbol (const std::string &) |
Set the implicit unit symbol. More... | |
const std::string & | get_implicit_unit_symbol () const |
Return the implicit unit symbol. More... | |
void | set_explicit_unit_dimension_label (const std::string &) |
Set the explicit unit dimension label. More... | |
const std::string & | get_explicit_unit_dimension_label () const |
Return the explicit unit dimension. More... | |
bool | has_preferred_unit_symbol () const |
Check if preferred unit symbol is set. More... | |
void | set_preferred_unit_symbol (const std::string &) |
Set the preferred unit symbol. More... | |
const std::string & | get_preferred_unit_symbol () const |
Return the preferred unit symbol. More... | |
void | make_none () |
Make the unit info with no unit support. More... | |
void | make_implicit_unit (const std::string &unit_symbol_, const std::string &preferred_unit_symbol_="") |
Make the unit info with implicit unit. More... | |
void | make_explicit_unit_dimension (const std::string &unit_dimension_label_, const std::string &preferred_unit_symbol_="") |
Make the unit info with explicit unit dimension. More... | |
void | initialize (const datatools::properties &) |
void | reset () |
Reset. More... | |
void | export_to_config (datatools::properties &config_, uint32_t flags_=UI_XC_DEFAULT, const std::string &prefix_="") const |
Export to a container of properties. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Smart print. More... | |
bool | operator== (const unit_info &ui_) const |
Public Member Functions inherited from datatools::i_tree_dumpable | |
i_tree_dumpable () | |
Constructor. More... | |
virtual | ~i_tree_dumpable () |
Destructor. More... | |
virtual void | print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const |
Main new interface method for printing. 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 |
Additional Inherited Members | |
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_) |
Unit information associated to a parameter.
datatools::introspection::unit_info::unit_info | ( | ) |
Default constructor.
datatools::introspection::unit_info::unit_info | ( | unit_support_type | , |
const std::string & | unit_token_, | ||
const std::string & | unit_token2_ = "" |
||
) |
Constructor.
|
virtual |
Destructor.
void datatools::introspection::unit_info::export_to_config | ( | datatools::properties & | config_, |
uint32_t | flags_ = UI_XC_DEFAULT , |
||
const std::string & | prefix_ = "" |
||
) | const |
Export to a container of properties.
const std::string& datatools::introspection::unit_info::get_explicit_unit_dimension_label | ( | ) | const |
Return the explicit unit dimension.
const std::string& datatools::introspection::unit_info::get_implicit_unit_symbol | ( | ) | const |
Return the implicit unit symbol.
const std::string& datatools::introspection::unit_info::get_preferred_unit_symbol | ( | ) | const |
Return the preferred unit symbol.
unit_support_type datatools::introspection::unit_info::get_unit_support | ( | ) | const |
Return the unit support.
bool datatools::introspection::unit_info::has_explicit_unit_dimension | ( | ) | const |
Check the explicit unitdimension trait.
bool datatools::introspection::unit_info::has_implicit_unit | ( | ) | const |
Check the implicit unit trait.
bool datatools::introspection::unit_info::has_preferred_unit_symbol | ( | ) | const |
Check if preferred unit symbol is set.
void datatools::introspection::unit_info::initialize | ( | const datatools::properties & | ) |
Initialize from a set of properties
Examples: a) No unit support:
b) Implicit unit support:
c) Explicit unit dimension support:
bool datatools::introspection::unit_info::is_valid | ( | ) | const |
Check validity.
void datatools::introspection::unit_info::make_explicit_unit_dimension | ( | const std::string & | unit_dimension_label_, |
const std::string & | preferred_unit_symbol_ = "" |
||
) |
Make the unit info with explicit unit dimension.
void datatools::introspection::unit_info::make_implicit_unit | ( | const std::string & | unit_symbol_, |
const std::string & | preferred_unit_symbol_ = "" |
||
) |
Make the unit info with implicit unit.
void datatools::introspection::unit_info::make_none | ( | ) |
Make the unit info with no unit support.
Make the class "equality comparable" (needed by Boost/optional for some reason...) Do not understand why (see also the "data_description::has_unit_info()" method) In order to use the "boost::none" semantic, I had to add the "unit_info::operator==(...)" operator despite what is written at: http://www.boost.org/doc/libs/1_59_0/libs/optional/doc/html/boost_optional/tutorial/relational_operators.html
That's fine but is not true with Boost 1.55.
The use of "boost::none" semantic was introduced to prepare the support for recent C++ compilers (with C++11 support) that seems to not support anymore the following semantics:
but require:
However, for builtin types (int, float...), it works. This must be clarified in the future.
void datatools::introspection::unit_info::reset | ( | ) |
Reset.
void datatools::introspection::unit_info::set_explicit_unit_dimension_label | ( | const std::string & | ) |
Set the explicit unit dimension label.
void datatools::introspection::unit_info::set_implicit_unit_symbol | ( | const std::string & | ) |
Set the implicit unit symbol.
void datatools::introspection::unit_info::set_preferred_unit_symbol | ( | const std::string & | ) |
Set the preferred unit symbol.
void datatools::introspection::unit_info::set_unit_support | ( | unit_support_type | ) |
Set the unit support.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.