37#include "tkproperty_list.h"
54bool tkproperty_list::has_property(
const tkstring &_property)
const
56 return (fProperties.count(_property)>0);
61 if(
has_property(_property))
return fProperties.at(_property).value;
67 if(
has_property(_property))
return fProperties.at(_property).unit;
73 if(
has_property(_property))
return fProperties.at(_property).type;
80 for(
const auto &prop : fProperties)
81 if (prop.first.match(_opt))
82 glog <<
info << left << setw(35) << prop.first << setw(35) << prop.second.value +
" " + prop.second.unit <<
"[" << prop.second.type<<
"]" <<
do_endl;
87 glog <<
info << fname <<
" data properties:" <<
do_endl;
88 for(
const auto &prop : fDataProperties)
89 if (prop.first.match(_opt))
90 glog <<
info << left << setw(35) << prop.first << prop.second <<
do_endl;
95 vector<shared_ptr<tkmeasure>> list;
96 for (
auto &data : fDataProperties) {
97 if (data.first.match(_opt)) list.push_back(data.second);
104 if(fDataProperties.count(_property)>0)
105 return fDataProperties.at(_property);
111 fProperties[_name].value = _val;
112 fProperties[_name].unit = _unit;
113 fProperties[_name].type = _type;
116void tkproperty_list::add_property(
const tkstring &_name,
const shared_ptr<tkmeasure> &_property,
const tkstring &_value_str,
const tkstring &_unit_str)
119 tkstring unit = _property->get_unit();
120 if(!_value_str.
is_empty()) val = _value_str;
121 if(_unit_str!=
"!") unit = _unit_str;
122 add_property_str(_name,val,unit,
"FLOAT");
123 fDataProperties[_name] = _property;
Contains list of properties.
tkstring get_property_unit(const tkstring &_property) const
get the property unnit as a string
void list_data_properties(const tkstring &_opt="*") const
list the available tkmeasure properties
bool has_property(const tkstring &_property) const
to check if the property is available
shared_ptr< tkmeasure > get(const tkstring &_property) const
get the property as tkmeasure
tkstring get_property_type(const tkstring &_property) const
get the property type as a string
tkstring get_property(const tkstring &_property) const
get the property value as a string
vector< shared_ptr< tkmeasure > > get_data_properties(const tkstring &_opt="*")
get a vector of data properties according to a regular expression
void list_properties(const tkstring &_opt="*") const
list the available properties
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....
static const char * form(const char *_format,...)
tklog & do_endl(tklog &log)