#include <MuctpiXMLHelper.h>
|
| | MuctpiXMLHelper () |
| std::string | readAttribute (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) |
| std::string | getAttribute (const boost::property_tree::ptree &tree, const std::string &attr, const std::string &defval) |
| int | getIntAttribute (const boost::property_tree::ptree &tree, const std::string &attr) |
| int | getIntAttribute (const boost::property_tree::ptree &tree, const std::string &attr, int defval) |
| unsigned int | getUIntAttribute (const boost::property_tree::ptree &tree, const std::string &attr) |
| unsigned int | getUIntAttribute (const boost::property_tree::ptree &tree, const std::string &attr, unsigned int &defval) |
| float | getFloatAttribute (const boost::property_tree::ptree &tree, const std::string &attr) |
| float | getFloatAttribute (const boost::property_tree::ptree &tree, const std::string &attr, float &defval) |
| void | printAttributes (const boost::property_tree::ptree &tree) |
|
| bool | msgLvl (const MSGTC::Level lvl) const |
| | Test the output level.
|
| MsgStreamTC & | msg () const |
| | The standard message stream.
|
| MsgStreamTC & | msg (const MSGTC::Level lvl) const |
| | The standard message stream.
|
| const std::string & | getName () const |
| | name accessor
|
|
| boost::thread_specific_ptr< MsgStreamTC > | m_msg_tls |
| | MsgStreamTC instance (a std::cout like with print-out levels)
|
| std::string | m_name |
Definition at line 13 of file MuctpiXMLHelper.h.
◆ MuctpiXMLHelper()
| MuctpiXMLHelper::MuctpiXMLHelper |
( |
| ) |
|
◆ getAttribute() [1/2]
| std::string MuctpiXMLHelper::getAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 68 of file MuctpiXMLHelper.cxx.
68 {
71 return "";
72 }
74}
#define TRG_MSG_WARNING(x)
std::string readAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
bool hasAttribute(const boost::property_tree::ptree &tree, const std::string &attr)
◆ getAttribute() [2/2]
| std::string MuctpiXMLHelper::getAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr, |
|
|
const std::string & | defval ) |
◆ getFloatAttribute() [1/2]
| float MuctpiXMLHelper::getFloatAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 144 of file MuctpiXMLHelper.cxx.
144 {
147 return 0;
148 }
149 float ret_value{0};
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 <<
")");
155 }
156 return ret_value;
157}
void printAttributes(const boost::property_tree::ptree &tree)
◆ getFloatAttribute() [2/2]
| float MuctpiXMLHelper::getFloatAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr, |
|
|
float & | defval ) |
Definition at line 160 of file MuctpiXMLHelper.cxx.
160 {
162 return defval;
163 float ret_value{0};
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 <<
")");
169 }
170 return ret_value;
171}
◆ getIntAttribute() [1/2]
| int MuctpiXMLHelper::getIntAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 85 of file MuctpiXMLHelper.cxx.
85 {
88 return 0;
89 }
90
91 int ret_value{0};
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 <<
"')");
96 }
97 return ret_value;
98}
◆ getIntAttribute() [2/2]
| int MuctpiXMLHelper::getIntAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr, |
|
|
int | defval ) |
Definition at line 101 of file MuctpiXMLHelper.cxx.
101 {
103 return defval;
104 int ret_value{0};
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 <<
"')");
109 }
110 return ret_value;
111}
◆ getName()
| const std::string & TrigConf::TrigConfMessaging::getName |
( |
| ) |
const |
|
inlineinherited |
◆ getUIntAttribute() [1/2]
| unsigned int MuctpiXMLHelper::getUIntAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 115 of file MuctpiXMLHelper.cxx.
115 {
118 return 0;
119 }
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 <<
")");
125 }
126 return ret_value;
127}
◆ getUIntAttribute() [2/2]
| unsigned int MuctpiXMLHelper::getUIntAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr, |
|
|
unsigned int & | defval ) |
Definition at line 130 of file MuctpiXMLHelper.cxx.
130 {
132 return defval;
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 <<
")");
138 }
139 return ret_value;
140}
◆ hasAttribute()
| bool MuctpiXMLHelper::hasAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 33 of file MuctpiXMLHelper.cxx.
33 {
34
35
38
40
41 for(
const ptree::value_type &
a: attributes) {
43 if(attrName == attr) {
44 return true;
45 }
46 }
47 return false;
48}
boost::property_tree::ptree ptree
◆ msg() [1/2]
| MsgStreamTC & TrigConf::TrigConfMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 86 of file TrigConfMessaging.h.
87 {
89 if (!ms) {
92 }
94 }
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
◆ msg() [2/2]
| MsgStreamTC & TrigConf::TrigConfMessaging::msg |
( |
const MSGTC::Level | lvl | ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 96 of file TrigConfMessaging.h.
97 {
99 }
MsgStreamTC & msg() const
The standard message stream.
◆ msgLvl()
| bool TrigConf::TrigConfMessaging::msgLvl |
( |
const MSGTC::Level | lvl | ) |
const |
|
inlineinherited |
Test the output level.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
- Return values
-
| true | Messages at level "lvl" will be printed |
Definition at line 75 of file TrigConfMessaging.h.
76 {
79 return true;
80 }
81 else {
82 return false;
83 }
84 }
◆ printAttributes()
| void MuctpiXMLHelper::printAttributes |
( |
const boost::property_tree::ptree & | tree | ) |
|
Definition at line 18 of file MuctpiXMLHelper.cxx.
18 {
19
20
23
24
25 for(
const ptree::value_type &
a: attributes) {
27 string attrVal =
a.second.data();
28 std::cout <<
attrName <<
" : " << attrVal << std::endl;
29 }
30}
◆ readAttribute()
| string MuctpiXMLHelper::readAttribute |
( |
const boost::property_tree::ptree & | tree, |
|
|
const std::string & | attr ) |
Definition at line 52 of file MuctpiXMLHelper.cxx.
52 {
53
54
57
58
59 for(
const ptree::value_type &
a : attributes) {
60 if(
a.first != attr)
continue;
61 return a.second.data();
62 }
63 return "";
64}
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStreamTC instance (a std::cout like with print-out levels)
Definition at line 71 of file TrigConfMessaging.h.
◆ m_name
| std::string TrigConf::TrigConfMessaging::m_name |
|
privateinherited |
The documentation for this class was generated from the following files: