DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Schema.cpp
Go to the documentation of this file.
1#include <ers/Schema.hpp>
2
3
4 // converters with allocation
6
8 to_schema( c, out);
9 return out;
10 }
11
13
15 to_schema( i, out);
16 return out;
17}
18
19
26
28
29 out.set_cwd( c.cwd() );
30 out.set_file_name( c.file_name() );
31 out.set_function_name( c.function_name() );
32 out.set_host_name( c.host_name() );
33 out.set_line_number( c.line_number() );
34 out.set_package_name( c.package_name() );
35
36 out.set_process_id( c.process_id() );
37 out.set_thread_id( c.thread_id() );
38 out.set_user_id( c.user_id() );
39 out.set_user_name( c.user_name() );
40 out.set_application_name( c.application_name() );
41
42}
43
44
46
47 auto c = to_schema( i.context() ) ;
48
49 (*out.mutable_context())=c;
50
51 out.set_name( i.get_class_name() );
52
53 auto inheritance = i.get_class_inheritance();
54 for ( auto & c : inheritance ) {
55 out.add_inheritance(c);
56 }
57
58 out.set_message( i.message() ) ;
59 out.set_severity( ers::to_string( i.severity() ) );
60 auto time = std::chrono::duration_cast<std::chrono::nanoseconds>(i.ptime().time_since_epoch()).count();
61 out.set_time(time);
62
63 auto & params = (* out.mutable_parameters());
64 for ( auto p : i.parameters() ) {
65 params[p.first] = p.second;
66 }
67
68}
69
70
72
73 (* out.mutable_final()) = to_schema(i);
74
75 auto cause_ptr = i.cause();
76
77 while ( cause_ptr ) {
78 auto ptr = out.add_causes() ;
79 to_schema( *cause_ptr, *ptr);
80 ptr -> set_severity(ers::to_string(i.severity())); // severity is forced to be the same as the top issue
81 cause_ptr = cause_ptr -> cause();
82 }
83
84 }
85
An abstract interface to access an Issue context.
Definition Context.hpp:30
Base class for any user define issue.
Definition Issue.hpp:69
const Context & context() const
Context of the issue.
Definition Issue.hpp:100
ers::Severity severity() const
severity of the issue
Definition Issue.hpp:112
virtual const char * get_class_name() const =0
Get key for class (used for serialisation)
const system_clock::time_point & ptime() const
original time point of the issue
Definition Issue.hpp:130
const std::string & message() const
General cause of the issue.
Definition Issue.hpp:103
const string_map & parameters() const
return array of parameters
Definition Issue.hpp:109
virtual inheritance_type get_class_inheritance() const =0
Get inheritance chain.
const Issue * cause() const
return the cause Issue of this Issue
Definition Issue.hpp:97
dunedaq::ersschema::IssueChain to_schema_chain(const Issue &i)
Definition Schema.cpp:20
std::string to_string(severity s)
dunedaq::ersschema::Context to_schema(const Context &c)
Definition Schema.cpp:5