DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Utils.hpp
Go to the documentation of this file.
1
8
9#ifndef OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
10#define OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
11
12#include <list>
13#include <map>
14#include <string>
15
16#include "ers/ers.hpp"
17#include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
19#include <google/protobuf/message.h>
20
21#include <google/protobuf/util/time_util.h>
22
23namespace dunedaq {
24
27 "Failure to create an object of type " << type,
28 ((std::string)type))
29
33 "Message " << type << " cannot be reconstructed from entry of type " << entry,
34 ((std::string)type),
35 ((std::string)entry))
36
38 MissingField,
39 "Field " << field << " not present in message " << message,
40 ((std::string)field)((std::string)message))
41
42}
43
44namespace dunedaq::opmonlib {
45
46using CustomOrigin = std::map<std::string, std::string>;
48using map_type = std::remove_const<std::remove_reference<cr_map_type>::type>::type;
49
54template<class T>
55void
56set_value(google::protobuf::Message& m, const std::string& name, T value);
57
58template<class T>
59void
60set_value(const google::protobuf::Reflection&, google::protobuf::Message&, const google::protobuf::FieldDescriptor*, T);
61
63make_origin(const std::string& session, const std::string& app);
64
66to_entry(const google::protobuf::Message& m, const CustomOrigin& co);
67
68template<class M>
69M
71
72void
73from_entry(google::protobuf::Message& m, const dunedaq::opmon::OpMonEntry&, std::string top_block = "");
74
76to_map(const google::protobuf::Message& m, std::string top_block = "");
77
78std::string
80
82operator+=(dunedaq::opmon::OpMonId&, const std::string& element);
83
85operator+(const dunedaq::opmon::OpMonId&, const std::string& element);
86
87} // namespace dunedaq::opmonlib
88
89#include "details/Utils.hxx"
90
91#endif // OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
const ::google::protobuf::Map< std::string, ::dunedaq::opmon::OpMonValue > & data() const
std::invoke_result< decltype(&dunedaq::opmon::OpMonEntry::data), dunedaq::opmon::OpMonEntry >::type cr_map_type
Definition Utils.hpp:47
const dunedaq::opmon::OpMonId & operator+=(dunedaq::opmon::OpMonId &, const std::string &element)
Definition Utils.cpp:185
dunedaq::opmon::OpMonId operator+(const dunedaq::opmon::OpMonId &, const std::string &element)
Definition Utils.cpp:206
void set_value(google::protobuf::Message &m, const std::string &name, T value)
Definition Utils.hxx:19
std::remove_const< std::remove_reference< cr_map_type >::type >::type map_type
Definition Utils.hpp:48
M from_entry(const dunedaq::opmon::OpMonEntry &)
Definition Utils.hxx:3
dunedaq::opmon::OpMonEntry to_entry(const google::protobuf::Message &m, const CustomOrigin &co)
Definition Utils.cpp:21
opmon::OpMonId make_origin(const std::string &session, const std::string &app)
Definition Utils.cpp:12
map_type to_map(const google::protobuf::Message &m, std::string top_block="")
Definition Utils.cpp:37
std::string to_string(const dunedaq::opmon::OpMonId &)
Definition Utils.cpp:166
std::map< std::string, std::string > CustomOrigin
Definition Utils.hpp:46
The DUNE-DAQ namespace.
FailedInfoReconstruction
Definition Utils.hpp:32
ERS_DECLARE_ISSUE(cibmodules, CIBCommunicationError, " CIB Hardware Communication Error: "<< descriptor,((std::string) descriptor)) ERS_DECLARE_ISSUE(cibmodules
ERS_DECLARE_ISSUE_BASE(timinglibs, ProgressUpdate, appfwk::GeneralDAQModuleIssue, message,((std::string) name),((std::string) message)) ERS_DECLARE_ISSUE_BASE(timinglibs
NameMismatch
Definition Utils.hpp:31