DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Base class for any user define issue. More...
#include <Issue.hpp>
Public Member Functions | |
Issue (const Context &context, const std::string &message=std::string()) | |
Issue (const Context &context, const std::exception &cause) | |
Issue (const Context &context, const std::string &message, const std::exception &cause) | |
Issue (const Issue &other) | |
virtual | ~Issue () noexcept |
virtual Issue * | clone () const =0 |
virtual const char * | get_class_name () const =0 |
Get key for class (used for serialisation) | |
virtual inheritance_type | get_class_inheritance () const =0 |
Get inheritance chain. | |
virtual void | raise () const =0 |
throws a copy of this issue preserving the real issue type | |
void | add_qualifier (const std::string &qualif) |
adds a qualifier to the issue | |
const Issue * | cause () const |
return the cause Issue of this Issue | |
const Context & | context () const |
Context of the issue. | |
const std::string & | message () const |
General cause of the issue. | |
const std::vector< std::string > & | qualifiers () const |
return array of qualifiers | |
const string_map & | parameters () const |
return array of parameters | |
ers::Severity | severity () const |
severity of the issue | |
template<class Precision = std::chrono::seconds> | |
std::string | time (const std::string &format="%Y-%b-%d %H:%M:%S", bool isUTC=false) const |
string representation of local time of the issue | |
template<class Precision > | |
std::string | localtime (const std::string &format="%Y-%b-%d %H:%M:%S") const |
string representation of UTC time of the issue | |
template<class Precision > | |
std::string | gmtime (const std::string &format="%Y-%b-%d %H:%M:%S") const |
std::time_t | time_t () const |
seconds since 1 Jan 1970 | |
const system_clock::time_point & | ptime () const |
original time point of the issue | |
const char * | what () const noexcept |
General cause of the issue. | |
ers::Severity | set_severity (ers::Severity severity) const |
void | wrap_message (const std::string &begin, const std::string &end) |
Protected Member Functions | |
Issue (Severity severity, const system_clock::time_point &time, const ers::Context &context, const std::string &message, const std::vector< std::string > &qualifiers, const std::map< std::string, std::string > ¶meters, const ers::Issue *cause=0) | |
Gets a value of any type that has an input operator for the standard stream defined. | |
template<typename T > | |
void | get_value (const std::string &key, T &value) const |
void | get_value (const std::string &key, const char *&value) const |
void | get_value (const std::string &key, std::string &value) const |
Sets a value of any type that has an output operator for the standard stream defined. | |
template<typename T > | |
void | set_value (const std::string &key, T value) |
void | set_message (const std::string &message) |
void | prepend_message (const std::string &message) |
Static Protected Member Functions | |
static auto | _get_inheritance () |
Private Member Functions | |
Issue & | operator= (const Issue &other)=delete |
Private Attributes | |
std::unique_ptr< const Issue > | m_cause |
Issue that caused the current issue. | |
std::unique_ptr< Context > | m_context |
Context of the current issue. | |
std::string | m_message |
Issue's explanation text. | |
std::vector< std::string > | m_qualifiers |
List of associated qualifiers. | |
Severity | m_severity |
Issue's severity. | |
system_clock::time_point | m_time |
Time when issue was thrown. | |
string_map | m_values |
List of user defined attributes. | |
Friends | |
class | IssueFactory |
Base class for any user define issue.
This is a base class for any user define issue. The class stores all attributes declared in a user define descendant class in a hashmap as sting key/value pairs. The object defines a number of methods for providing access to this map. For an example of how to define a custom subclass of the Issue have a look at the SampleIssues.h file.
Issue::Issue | ( | const Context & | context, |
const std::string & | message = std::string() ) |
This constructor create a new issue with the given message.
context | the context of the Issue, e.g where in the code the issue appeared |
message | the user message associated with this issue |
Definition at line 69 of file Issue.cpp.
Issue::Issue | ( | const Context & | context, |
const std::exception & | cause ) |
This constructor takes another exceptions as its cause.
context | the context of the Issue, e.g where in the code the issue appeared |
cause | the other exception that has caused this one |
Definition at line 84 of file Issue.cpp.
Issue::Issue | ( | const Context & | context, |
const std::string & | message, | ||
const std::exception & | cause ) |
This constructor takes another exceptions as its cause.
context | the context of the Issue, e.g where in the code did the issue appear |
message | the user message associated with this issue |
cause | exception that caused the current issue |
Issue::Issue | ( | const Issue & | other | ) |
Definition at line 53 of file Issue.cpp.
|
protected |
Gets a value of any type that has an input operator for the standard stream defined.
Definition at line 115 of file Issue.cpp.
|
inlinestaticprotected |
void Issue::add_qualifier | ( | const std::string & | qualifier | ) |
adds a qualifier to the issue
Add a new qualifier to the qualifiers list of this issue
qualifier | the qualifier to add |
|
inline |
|
pure virtual |
Implemented in dunedaq::logging::Logging::InternalMessage, and ers::AnyIssue.
|
inline |
|
pure virtual |
Get inheritance chain.
Implemented in ers::AnyIssue.
|
pure virtual |
Get key for class (used for serialisation)
Implemented in dunedaq::logging::Logging::InternalMessage, and ers::AnyIssue.
|
protected |
|
protected |
Sets a value of any type that has an output operator for the standard stream defined.
|
protected |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
inline |
|
inline |
|
pure virtual |
throws a copy of this issue preserving the real issue type
Implemented in dunedaq::logging::Logging::InternalMessage, and ers::AnyIssue.
|
inlineprotected |
Definition at line 159 of file Issue.hpp.
ers::Severity Issue::set_severity | ( | ers::Severity | severity | ) | const |
|
protected |
|
inline |
std::string ers::Issue::time | ( | const std::string & | format = "%Y-%b-%d %H:%M:%S", |
bool | isUTC = false ) const |
string representation of local time of the issue
Definition at line 218 of file Issue.hpp.
std::time_t ers::Issue::time_t | ( | ) | const |
|
inlinenoexcept |
void Issue::wrap_message | ( | const std::string & | begin, |
const std::string & | end ) |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |