DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Utils.hpp
Go to the documentation of this file.
1
9#ifndef OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
10#define OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
11
12
13#include <string>
14#include <list>
15#include <map>
16
17#include <google/protobuf/message.h>
19#include "ers/ers.hpp"
20#include "logging/Logging.hpp" // NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
21
22#include <google/protobuf/util/time_util.h>
23
24
25namespace dunedaq {
26
29 "Failure to create an object of type " << type,
30 ((std::string)type)
31 )
32
36 "Message " << type
37 << " cannot be reconstructed from entry of type " << entry,
38 ((std::string)type),
39 ((std::string)entry)
40 )
41
43 MissingField,
44 "Field " << field << " not present in message " << message,
45 ((std::string)field)((std::string)message)
46 )
47
48
49}
50
51namespace dunedaq::opmonlib {
52
53 using CustomOrigin = std::map<std::string, std::string> ;
54 using cr_map_type = std::invoke_result<decltype(&dunedaq::opmon::OpMonEntry::data),
56 using map_type = std::remove_const<std::remove_reference<cr_map_type>::type>::type;
57
58
63 template<class T>
64 void set_value(google::protobuf::Message & m, const std::string & name, T value);
65
66 template<class T>
67 void set_value( const google::protobuf::Reflection & ,
68 google::protobuf::Message & ,
69 const google::protobuf::FieldDescriptor* , T );
70
71 opmon::OpMonId make_origin( const std::string & session, const std::string & app ) ;
72
73 dunedaq::opmon::OpMonEntry to_entry(const google::protobuf::Message & m,
74 const CustomOrigin & co);
75
76 template<class M>
78
79 void from_entry(google::protobuf::Message & m,
81 std::string top_block = "");
82
83 map_type to_map(const google::protobuf::Message & m,
84 std::string top_block = "");
85
86 std::string to_string( const dunedaq::opmon::OpMonId & );
87
89 const std::string & element);
90
92 const std::string & element ) ;
93
94} // namespace dunedaq::opmonlib
95
96#include "details/Utils.hxx"
97
98#endif // OPMONLIB_INCLUDE_OPMONLIB_UTILS_HPP_
#define ERS_DECLARE_ISSUE_BASE(namespace_name, class_name, base_class_name, message, base_attributes, attributes)
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
const ::google::protobuf::Map< std::string, ::dunedaq::opmon::OpMonValue > & data() const
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:205
void set_value(google::protobuf::Message &m, const std::string &name, T value)
Definition Utils.hxx:17
std::remove_const< std::remove_reference< cr_map_type >::type >::type map_type
Definition Utils.hpp:56
M from_entry(const dunedaq::opmon::OpMonEntry &)
Definition Utils.hxx:2
dunedaq::opmon::OpMonEntry to_entry(const google::protobuf::Message &m, const CustomOrigin &co)
Definition Utils.cpp:20
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:36
std::string to_string(const dunedaq::opmon::OpMonId &)
Definition Utils.cpp:167
std::map< std::string, std::string > CustomOrigin
Definition Utils.hpp:53
std::invoke_result< decltype(&dunedaq::opmon::OpMonEntry::data), dunedaq::opmon::OpMonEntry >::type cr_map_type
Definition Utils.hpp:54
Including Qt Headers.
Unknown serialization type
FailedInfoReconstruction
Definition Utils.hpp:35
NameMismatch
Definition Utils.hpp:34