14#include "tkproperty_list.h"
33 return (fProperties.count(_property)>0);
38 if(
has_property(_property))
return fProperties.at(_property).value;
44 if(
has_property(_property))
return fProperties.at(_property).unit;
50 if(
has_property(_property))
return fProperties.at(_property).type;
57 for(
const auto &prop : fProperties)
58 if (prop.first.match(_opt))
59 glog <<
info << left << setw(35) << prop.first << setw(35) << prop.second.value +
" " + prop.second.unit <<
"[" << prop.second.type<<
"]" <<
do_endl;
64 glog <<
info << fname <<
" data properties:" <<
do_endl;
65 for(
const auto &prop : fDataProperties)
66 if (prop.first.match(_opt))
67 glog <<
info << left << setw(35) << prop.first << prop.second <<
do_endl;
72 vector<shared_ptr<tkmeasure>> list;
73 for (
auto &data : fDataProperties) {
74 if (data.first.match(_opt)) list.push_back(data.second);
81 if(fDataProperties.count(_property)>0)
82 return fDataProperties.at(_property);
88 fProperties[_name].value = _val;
89 fProperties[_name].unit = _unit;
90 fProperties[_name].type = _type;
93void tkproperty_list::add_property(
const tkstring &_name,
const shared_ptr<tkmeasure> &_property,
const tkstring &_value_str,
const tkstring &_unit_str)
96 tkstring unit = _property->get_unit();
97 if(!_value_str.
is_empty()) val = _value_str;
98 if(_unit_str!=
"!") unit = _unit_str;
99 add_property_str(_name,val,unit,
"FLOAT");
100 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)