11using boost::property_tree::ptree;
22 ptree attributes =
tree.get_child(
"<xmlattr>", tmp_ptree);
25 for(
const ptree::value_type &
a: attributes) {
26 string attrName =
a.first;
27 string attrVal =
a.second.data();
28 std::cout << attrName <<
" : " << attrVal << std::endl;
37 ptree attributes =
tree.get_child(
"<xmlattr>", tmp_ptree);
39 if(attributes.empty())
return false;
41 for(
const ptree::value_type &
a: attributes) {
42 string attrName =
a.first;
43 if(attrName == attr) {
56 ptree attributes =
tree.get_child(
"<xmlattr>", tmp_ptree);
59 for(
const ptree::value_type &
a : attributes) {
60 if(
a.first != attr)
continue;
61 return a.second.data();
93 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value);
94 if (ec != std::errc()) {
95 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not an int (it is '" << attr_value <<
"')");
106 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value);
107 if (ec != std::errc()) {
108 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not an int (it is '" << attr_value <<
"')");
120 unsigned int ret_value{0};
122 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value);
123 if (ec != std::errc()) {
124 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not an unsigned int (it is " << attr_value <<
")");
133 unsigned int ret_value{0};
135 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value);
136 if (ec != std::errc()) {
137 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not an unsigned int (it is " << attr_value <<
")");
151 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value, std::chars_format::general);
152 if (ec != std::errc()) {
153 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not a float (it is " << attr_value <<
")");
165 auto [ptr, ec] = std::from_chars(attr_value.data(), attr_value.data() + attr_value.size(), ret_value, std::chars_format::general);
166 if (ec != std::errc()) {
167 TRG_MSG_ERROR(
"attribute '" << attr <<
"' is not a float (it is " << attr_value <<
")");
boost::property_tree::ptree ptree
#define TRG_MSG_WARNING(x)
std::string readAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
unsigned int getUIntAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
float getFloatAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
void printAttributes(const boost::property_tree::ptree &tree)
int getIntAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
bool hasAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
std::string getAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
TrigConfMessaging(const std::string &name)
Constructor with parameters.
Forward iterator to traverse the main components of the trigger configuration.