CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
ers::Issue Class Reference

Root Issue class. More...

#include <Issue.h>

+ Inheritance diagram for ers::Issue:

Public Member Functions

 Issue ()
 
 Issue (const Issue &issue)
 
 Issue (const string_map_type &values)
 
 Issue (const Context &context, severity_t s, const std::string &message)
 
 Issue (const Context &context, severity_t s, const std::exception *cause)
 
virtual ~Issue () throw ()
 
Issueclone () const
 
const Issuecause () const throw ()
 return the cause Issue of this Issue
 
void cause (const std::exception *cause=0)
 Initialises the cause field.
 
 operator std::string () const
 Converts the issue into a string.
 
Issue operator= (const Issue &issue)
 Affectation operator.
 
bool operator== (const Issue &other) const throw ()
 Equality operator.
 
const std::string & operator[] (const std::string &key) const throw ()
 
const std::string & get_value (const std::string &key, const std::string &def) const throw ()
 Reads the property list.
 
const std::string & get_value (const std::string &key) const throw ()
 
int get_int_value (const std::string &key, int def=0) const throw ()
 Get a value of the table as an integer.
 
long get_long_value (const std::string &key, long def=0) const throw ()
 Get a value of the table as a long integer.
 
double get_double_value (const std::string key, double def) const throw ()
 Get a value of the table as double.
 
void set_value (const std::string &key, uint8_t value) throw ()
 Sets a value 8 bit unsigned.
 
void set_value (const std::string &key, uint16_t value) throw ()
 
void set_value (const std::string &key, uint32_t value) throw ()
 
void set_value (const std::string &key, uint64_t value) throw ()
 
void set_value (const std::string &key, int8_t value) throw ()
 
void set_value (const std::string &key, int16_t value) throw ()
 
void set_value (const std::string &key, int32_t value) throw ()
 
void set_value (const std::string &key, int64_t value) throw ()
 
void set_value (const std::string &key, double value) throw ()
 Sets a value (double float)
 
void set_value (const std::string &key, const std::string &value) throw ()
 Sets a value (string)
 
void set_value (const std::string &key, const char *value) throw ()
 Sets a value (c-string)
 
void set_value (const std::string &key, const void *ptr) throw ()
 
int values_number () const
 How many key / values.
 
virtual const char * get_class_name () const throw ()
 Get key for class (used for serialisation)
 
const string_map_typeget_value_table () const
 extract value table
 
severity_t severity () const throw ()
 severity_t of the issue
 
void severity (severity_t s)
 sets the severity_t of the issue
 
bool is_error ()
 is the issue an error (or fatal).
 
std::string severity_message () const
 message associated with the severity_t of the issue
 
void responsibility (responsibility_t r)
 set the responsability of the issue
 
responsibility_t responsibility () const throw ()
 get the responsability level of the issue
 
void transience (bool tr)
 sets if the issue is transient
 
int transience () const throw ()
 is the issue transient
 
const std::string & human_description () const throw ()
 Human description message.
 
const char * what () const throw ()
 Human description message.
 
const std::string & message () const throw ()
 Message.
 
virtual int exit_value () const throw ()
 value to pass to exit
 
void add_qualifier (const std::string &qualif)
 adds a qualifier to the issue
 
std::vector< std::string > qualifiers () const
 return array of qualifiers
 

Static Public Attributes

static const char *const CLASS_KEY = "ISSUE_CLASS"
 key for class information
 
static const char *const COMPILATION_TIME_KEY = "COMPILATION_TIME"
 key for compilation time
 
static const char *const COMPILATION_TARGET_KEY = "COMPILATION_TARGET"
 key for compilation target
 
static const char *const COMPILER_KEY = "COMPILER"
 key for compilator type
 
static const char *const COMPILATION_DEBUG_LVL_KEY = "COMPILATION_DEBUG_LVL"
 
static const char *const CPP_CLASS_KEY = "ISSUE_CPP_CLASS"
 key for c++ class (might be mangled)
 
static const char *const ERS_VERSION_KEY = "ERS_VERSION"
 key for ERS version
 
static const char *const HOST_NAME_KEY = "HOST_NAME"
 key for hostname
 
static const char *const HOST_TYPE_KEY = "HOST_TYPE"
 key for host type (architecture / os)
 
static const char *const HOST_IP_ADDR_KEY = "HOST_IP"
 key for host ip address
 
static const char *const MESSAGE_KEY = "MESSAGE"
 key for human readable
 
static const char *const PROCESS_ID_KEY = "PROCESS_ID"
 key for the process id (number)
 
static const char *const PROCESS_PWD_KEY = "PROCESS_PWD"
 key for the process working directory
 
static const char *const PROGRAM_NAME_KEY = "PROGRAM_NAME"
 key for the name of the program
 
static const char *const RESPONSIBILITY_KEY = "RESPONSIBILITY"
 key for the responsibility of the issue (text)
 
static const char *const SEVERITY_KEY = "SEVERITY"
 key for the severity_t of the issue
 
static const char *const SOURCE_POSITION_KEY = "SOURCE_POSITION"
 key for position in the source code
 
static const char *const SOURCE_PACKAGE_KEY = "SOURCE_PACKAGE"
 package name associated with source code
 
static const char *const TIME_KEY = "TIME"
 key for the time of the issue (text)
 
static const char *const TRANSIENCE_KEY = "TRANSIENCE"
 key for the transience of the issue (text)
 
static const char *const USER_ID_KEY = "USER_ID"
 key for the user-id of the owner of the process
 
static const char *const USER_NAME_KEY = "USER_NAME"
 key for the user-name of the owner of the process
 
static const char *const CAUSE_PSEUDO_KEY = "CAUSE"
 key used when serializing the cause issue, this key is not used in the value table
 
static const char *const CAUSE_TEXT_KEY = "CAUSE_TEXT"
 key used to store the cause issue's message
 
static const char *const QUALIFIER_LIST_KEY = "QUALIFIERS"
 key used to store the qualifier list
 
static const char *const EXIT_VALUE_KEY = "EXIT_VALUE"
 key used to store the exit value
 
static const char *const ISSUE_CLASS_NAME = "ers::issue"
 name of the class, used for serialisation
 

Protected Member Functions

void insert (const Context *context) throw ()
 Inserts the context.
 
void insert_time () throw ()
 Inserts current time.
 
void setup_common (const Context *context) throw ()
 Sets up the common fields.
 
void finish_setup (const std::string &message) throw ()
 Finishes the setup of the Issue.
 
 Issue (const Context &context, severity_t s)
 Constructor for subclasses.
 
void set_values (const string_map_type &values) throw ()
 sets the value table
 

Protected Attributes

Issuem_cause
 Issue that caused the current issue.
 
std::string m_class_name
 class name
 
std::string m_human_description
 Human readable description (cache)
 
string_map_type m_value_table
 Optional properties.
 

Friends

class Stream
 
class IssueFactory
 

Detailed Description

Root Issue class.

This class is the root Issue object.
The class does not contain any fields with information, instead everything is stored in a hashmap as key - value paris (both strings). The object contains utility methods to allow the manipulation of those key / values and code to insert common values into it, like time, compilation information, host information etc. For an example of how to build an actual subclass of issue look at the source of ExampleIssue.

Author
Matthias Wiesmann
Version
1.1
Note
Issue chaining is handled by copying the cause issue on the stack and keeping a pointer to it. When the object is destroyed, it destroys the pointed issue. This means we can only chain issues that correctly implement the factory methods required by the IssueFactory class
See also
ers::IssueFactory
ExampleIssue

Definition at line 40 of file ers/ers-00-00-03/ers/Issue.h.

Constructor & Destructor Documentation

◆ Issue() [1/6]

Issue::Issue ( const Context context,
severity_t  s 
)
protected

Constructor for subclasses.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 121 of file ers/ers-00-00-03/src/Issue.cxx.

121 {
122 cause();
123 setup_common(&context);
124 severity(s);
125} // Issue
XmlRpcServer s
Definition: HelloServer.cpp:11
severity_t severity() const
severity_t of the issue
const Issue * cause() const
return the cause Issue of this Issue
void setup_common(const Context *context)
Sets up the common fields.

◆ Issue() [2/6]

Issue::Issue ( )

Empty constructor, should only be used when deserialising issues

Definition at line 74 of file ers/ers-00-00-03/src/Issue.cxx.

74 {
75 m_human_description.clear() ;
76 m_cause = 0 ;
77} // Issue
std::string m_human_description
Human readable description (cache)
Issue * m_cause
Issue that caused the current issue.

◆ Issue() [3/6]

Issue::Issue ( const Issue issue)

Copy constructor The m_human_description and the m_value_table fields are simply copied The The issue in the m_cause pointer if present is cloned.

Parameters
issueoriginal for copy

Definition at line 85 of file ers/ers-00-00-03/src/Issue.cxx.

85 : std::exception() {
88 if (issue.m_cause) {
89 this->m_cause = issue.m_cause->clone();
90 } else {
91 this->m_cause = 0 ;
92 }
93} // Issue
string_map_type m_value_table
Optional properties.

◆ Issue() [4/6]

Issue::Issue ( const string_map_type values)

Builds an Issue out of a value table

Parameters
valuestable of values for the issue

Definition at line 99 of file ers/ers-00-00-03/src/Issue.cxx.

99 {
100 cause();
101 set_values(values);
102 m_human_description.clear();
103} // Issue
void set_values(const string_map_type &values)
sets the value table

◆ Issue() [5/6]

Issue::Issue ( const Context context,
severity_t  s,
const std::string &  m 
)

Constructor

Parameters
contextthe context of the Issue, e.g where in the code did the issue appear
sseverity_t of the Issue
mmessage of the Issue

Definition at line 112 of file ers/ers-00-00-03/src/Issue.cxx.

112 {
113 cause();
114 setup_common(&context);
115 severity(s);
116 finish_setup(m);
117} // Issue
void finish_setup(const std::string &message)
Finishes the setup of the Issue.

◆ Issue() [6/6]

Issue::Issue ( const Context context,
severity_t  s,
const std::exception *  cause_exception 
)

Constructor - takes another exceptions as the cause for the current exception.

Parameters
contextthe context of the Issue, e.g where in the code did the issue appear
sthe severity_t of the exception
cause_exceptionthe exception that caused the current Issue

Definition at line 133 of file ers/ers-00-00-03/src/Issue.cxx.

133 {
134 ERS_PRE_CHECK_PTR(cause_exception);
135 cause(cause_exception);
136 setup_common(&context);
137 severity(s);
138 finish_setup(cause_exception->what());
139} // Issue
#define ERS_PRE_CHECK_PTR(p)

◆ ~Issue()

Issue::~Issue ( )
throw (
)
virtual

Destructor. If the m_cause pointer is not null, the pointed Issue is deleted

Reimplemented in eformat::Issue.

Definition at line 145 of file ers/ers-00-00-03/src/Issue.cxx.

145 {
146 if (m_cause) delete m_cause ;
147 m_cause = 0 ;
148} // ~Issue

Member Function Documentation

◆ add_qualifier()

void Issue::add_qualifier ( const std::string &  qualif)

adds a qualifier to the issue

Add a qualifier to the qualifier list

Parameters
qualifthe qualifier to add

Definition at line 703 of file ers/ers-00-00-03/src/Issue.cxx.

703 {
704 const std::string &qualif_s = get_value(QUALIFIER_LIST_KEY) ;
705 std::string::size_type pos = qualif_s.find(qualif);
706 if (pos!=std::string::npos) return ; // already present
707 std::string n_qualif = qualif_s+qualif + " " ;
708 set_value(QUALIFIER_LIST_KEY,n_qualif);
709} // add_qualifier
const std::string & get_value(const std::string &key, const std::string &def) const
Reads the property list.
void set_value(const std::string &key, uint8_t value)
Sets a value 8 bit unsigned.
static const char *const QUALIFIER_LIST_KEY
key used to store the qualifier list

◆ cause() [1/2]

const Issue * Issue::cause ( ) const
throw (
)

return the cause Issue of this Issue

Returns
the cause of the issue, if there is one, a null pointer otherwise

Definition at line 240 of file ers/ers-00-00-03/src/Issue.cxx.

240 {
241 return m_cause ;
242} // cause

Referenced by Issue().

◆ cause() [2/2]

void Issue::cause ( const std::exception *  c = 0)

Initialises the cause field.

Sets the cause of the issue If the cause is an Issue, it is cloned and stored in the m_cause pointer. In all cases, the description of the cause is stored in the value table using the CAUSE_TEXT_KEY key. If the cause pointer is null, the m_cause field is simply cleared.

Parameters
cpointer to the cause exception

Definition at line 252 of file ers/ers-00-00-03/src/Issue.cxx.

252 {
253 if (c==0) {
254 m_cause = 0 ;
255 return ;
256 } // No cause easy.
257 const Issue *i = dynamic_cast<const Issue *>(c) ;
258 if (i) {
259 m_cause = i->clone();
260 } else {
261 m_cause = 0 ;
262 } // if
263 set_value(CAUSE_TEXT_KEY,c->what());
264} // cause
Root Issue class.
static const char *const CAUSE_TEXT_KEY
key used to store the cause issue's message

◆ clone()

Issue * Issue::clone ( ) const

Builds a clone of the object. The object is allocated on the stack, and should be deleted by the caller

Returns
a new object that is a copy of the current object

Definition at line 160 of file ers/ers-00-00-03/src/Issue.cxx.

160 {
161 return IssueFactory::instance()->build(this) ;
162} // clone
static IssueFactory * instance()
method to access singleton
Issue * build(const std::string &name) const
build an empty issue out of a name

Referenced by cause(), Issue(), and ers::FIFOStream::send().

◆ exit_value()

int Issue::exit_value ( ) const
throw (
)
virtual

value to pass to exit

Definition at line 693 of file ers/ers-00-00-03/src/Issue.cxx.

693 {
694 int v = 1 ;
695 if (transience()==1) v = EX_TEMPFAIL ;
697} // exit_value
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
static const char *const EXIT_VALUE_KEY
key used to store the exit value
int get_int_value(const std::string &key, int def=0) const
Get a value of the table as an integer.
int transience() const
is the issue transient

◆ finish_setup()

void Issue::finish_setup ( const std::string &  msg)
throw (
)
protected

Finishes the setup of the Issue.

Finishes the setting up of the information fields. In particular, in fills in the human message and the class type fields (those fields are not available until the end of the object construction.

Note
this method should be called by the sub-class constructor, so that RTTI information is setup and correct.
Parameters
messagehuman readable message
Note
All method used within this method should throw no exceptions to avoid circular problems.

Definition at line 568 of file ers/ers-00-00-03/src/Issue.cxx.

568 {
569 // set_value(CPP_CLASS_KEY,class_name);
572} // finish_setup
static const char *const MESSAGE_KEY
key for human readable
static const char *const CLASS_KEY
key for class information
virtual const char * get_class_name() const
Get key for class (used for serialisation)

Referenced by eformat::BadVersionIssue::BadVersionIssue(), ers::EntityNotFoundIssue::EntityNotFoundIssue(), ExampleIssue::ExampleIssue(), ers::InvalidReferenceIssue::InvalidReferenceIssue(), Issue(), eformat::Issue::Issue(), ers::IssueFactoryIssue::IssueFactoryIssue(), ers::LogIssue::LogIssue(), eformat::NoSuchChildIssue::NoSuchChildIssue(), eformat::NotAlignedIssue::NotAlignedIssue(), eformat::OutOfBoundsIssue::OutOfBoundsIssue(), ers::ParseIssue::ParseIssue(), ers::RangeIssue::RangeIssue(), eformat::SizeCheckIssue::SizeCheckIssue(), eformat::TooBigCountIssue::TooBigCountIssue(), eformat::UnboundSourceIdentifierIssue::UnboundSourceIdentifierIssue(), eformat::WrongMarkerIssue::WrongMarkerIssue(), and eformat::WrongSizeIssue::WrongSizeIssue().

◆ get_class_name()

const char * Issue::get_class_name ( ) const
throw (
)
virtual

Get key for class (used for serialisation)

Returns the key used to describe this particular class when serializing This method tries to build a meaningfull class name out of C++ RTTI. This depends on the compiler providing information in a format similar to gcc. For more safety. If the gcc unmangling fails the default (ers::Issue) is used.

Reimplemented in ers::Assertion, ers::DefaultIssue, ers::EntityNotFoundIssue, ers::InvalidReferenceIssue, ers::IssueFactoryIssue, ers::LogIssue, ers::NotImplemented, ers::ParseIssue, ers::Precondition, ers::RangeIssue, and ExampleIssue.

Definition at line 587 of file ers/ers-00-00-03/src/Issue.cxx.

587 {
588 if (m_class_name.empty()) {
589 const Issue *p = this ;
590 m_class_name = ers::Core::umangle_gcc_class_name((typeid(*p)).name()).c_str();
591 if (m_class_name.empty()) {
593 } // fall back
594 }
595 return m_class_name.c_str() ;
596} // get_class_name
static std::string umangle_gcc_class_name(const char *name)
unmangles gcc RTTI names
Definition: Core.cxx:135
std::string m_class_name
class name
static const char *const ISSUE_CLASS_NAME
name of the class, used for serialisation

Referenced by ers::IssueFactory::build().

◆ get_double_value()

double Issue::get_double_value ( const std::string  key,
double  def = nan("") 
) const
throw (
)

Get a value of the table as double.

Get a property of an issue as an double

Parameters
keythe key to search for
defthe value to return if key is not found - the default value for this parameter is NaN.
Returns
value of key or def

Definition at line 344 of file ers/ers-00-00-03/src/Issue.cxx.

344 {
345 std::string v = get_value(key) ;
346 if (! v.empty()) { // not empty
347 std::istringstream in(v) ;
348 double n ;
349 in >> n ;
350 return n ;
351 // return atoi(v.c_str());
352 } else { // empty
353 return def ;
354 } // empty
355} // get_double_value
const Int_t n
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42

◆ get_int_value()

int Issue::get_int_value ( const std::string &  key,
int  def = 0 
) const
throw (
)

Get a value of the table as an integer.

Get a property of an issue as an integer

Parameters
keythe key to search for
defthe value to return if key is not found
Returns
value of key or def

Definition at line 305 of file ers/ers-00-00-03/src/Issue.cxx.

305 {
306 std::string v = get_value(key) ;
307 if (! v.empty()) { // not empty
308 std::istringstream in(v) ;
309 int n ;
310 in >> n ;
311 return n ;
312 // return atoi(v.c_str());
313 } else { // empty
314 return def ;
315 } // empty
316} // get_int_value

Referenced by exit_value(), and ExampleIssue::procrastination_level().

◆ get_long_value()

long Issue::get_long_value ( const std::string &  key,
long  def = 0 
) const
throw (
)

Get a value of the table as a long integer.

Get a property of an issue as an long

Parameters
keythe key to search for
defthe value to return if key is not found
Returns
value of key or def

Definition at line 325 of file ers/ers-00-00-03/src/Issue.cxx.

325 {
326 std::string v = get_value(key) ;
327 if (! v.empty()) { // not empty
328 std::istringstream in(v) ;
329 long n ;
330 in >> n ;
331 return n ;
332 // return atoi(v.c_str());
333 } else { // empty
334 return def ;
335 } // empty
336} // get_long_value

◆ get_value() [1/2]

const std::string & Issue::get_value ( const std::string &  key) const
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 294 of file ers/ers-00-00-03/src/Issue.cxx.

294 {
296} // get_value
static const std::string empty_string
Definition: Core.h:38

◆ get_value() [2/2]

const std::string & Issue::get_value ( const std::string &  key,
const std::string &  def 
) const
throw (
)

Reads the property list.

General method for querying properties of the Issue

Parameters
keythe key to lookup
Returns
the string value for the key and empty string if the key is not found

Definition at line 283 of file ers/ers-00-00-03/src/Issue.cxx.

283 {
284 string_map_type::const_iterator pos = m_value_table.find(key);
285 if (pos!=m_value_table.end()) {
286 return pos->second ;
287 } // if
288 return def ;
289} // get_value

Referenced by add_qualifier(), get_double_value(), ers::FilterStream::is_accept(), message(), qualifiers(), responsibility(), ers::DefaultStream::send(), ers::HumanStream::send(), severity(), severity_message(), and transience().

◆ get_value_table()

const string_map_type * Issue::get_value_table ( ) const

extract value table

Returns a read-only pointer to the value table

Returns
read only pointer to the table

Definition at line 274 of file ers/ers-00-00-03/src/Issue.cxx.

274 {
275 return &m_value_table ;
276} // get_value_table

Referenced by ers::IssueFactory::build(), ers::DefaultStream::send(), and ers::HumanStream::send().

◆ human_description()

const std::string & Issue::human_description ( ) const
throw (
)

Human description message.

Returns
human description of the Issue

Definition at line 672 of file ers/ers-00-00-03/src/Issue.cxx.

672 {
673 if (m_human_description.empty()) {
675 }
676 return m_human_description ;
677} // human_description
std::string to_string()
Definition: HumanStream.cxx:54

Referenced by ers::operator<<(), and what().

◆ insert()

void Issue::insert ( const Context context)
throw (
)
protected

Inserts the context.

Inserts the context of the issue into the issue

Parameters
contextpointer to context object

Definition at line 481 of file ers/ers-00-00-03/src/Issue.cxx.

481 {
482 if (context) {
485 set_value(COMPILER_KEY,context->compiler()) ;
488 int lvl = ers::Context::debug_level();
489 if (lvl>=0) {
491 } // if
492 int frame_number = context->stack_frames();
493 for(int i=0;i<frame_number;i++) {
494 char key_buffer[256] ;
495 snprintf(key_buffer,sizeof(key_buffer),"SOURCE-STACK-%03x",i);
496 set_value(key_buffer,context->stack_frame(i));
497 } // for
498 std::vector<std::string> qualifs = context->qualifiers() ;
499 std::vector<std::string>::const_iterator pos ;
500 for(pos=qualifs.begin();pos!=qualifs.end();pos++) {
501 add_qualifier(*pos) ;
502 } // for
503 } // if context
504} // insert
const std::string & package_name() const
Definition: Context.cxx:185
const std::string & stack_frame(int i) const
Definition: Context.cxx:223
std::vector< std::string > qualifiers() const
Definition: Context.cxx:232
static int debug_level()
Definition: Context.cxx:48
const std::string & compiler() const
Definition: Context.cxx:151
const std::string & compilation() const
Definition: Context.cxx:168
const std::string & position() const
Definition: Context.cxx:124
static std::string & host_type()
type of target host
Definition: Context.cxx:39
int stack_frames() const
Definition: Context.cxx:219
static const char *const COMPILATION_TARGET_KEY
key for compilation target
static const char *const COMPILATION_TIME_KEY
key for compilation time
static const char *const COMPILATION_DEBUG_LVL_KEY
static const char *const SOURCE_POSITION_KEY
key for position in the source code
static const char *const COMPILER_KEY
key for compilator type
void add_qualifier(const std::string &qualif)
adds a qualifier to the issue
static const char *const SOURCE_PACKAGE_KEY
package name associated with source code

◆ insert_time()

void Issue::insert_time ( )
throw (
)
protected

Inserts current time.

Inserts the current time into the issue

Definition at line 509 of file ers/ers-00-00-03/src/Issue.cxx.

509 {
510 time_t now ;
511 time(&now);
512 char time_buffer[BUFFER_SIZE] ;
513 ctime_r(&now,time_buffer) ;
514 char *cr = strchr(time_buffer,'\n');
515 if (cr) {
516 *cr = '\0' ;
517 } // carriage return
518 set_value(TIME_KEY,time_buffer);
519} // insert_time
Double_t time
static const char *const TIME_KEY
key for the time of the issue (text)
#define BUFFER_SIZE

◆ is_error()

bool Issue::is_error ( )

is the issue an error (or fatal).

Is the issue either an error or a fatal error

Returns
true if the issue is either an error or a fatal

Definition at line 619 of file ers/ers-00-00-03/src/Issue.cxx.

619 {
620 severity_t s = severity();
621 return (s==ers::error || s== ers::fatal) ;
622} // is_error
@ error
Definition: Core.h:24
@ fatal
Definition: Core.h:24
enum ers::_severity_t severity_t

Referenced by ers::StreamFactory::dispatch().

◆ message()

const std::string & Issue::message ( ) const
throw (
)

Message.

Definition at line 689 of file ers/ers-00-00-03/src/Issue.cxx.

689 {
690 return get_value(MESSAGE_KEY) ;
691} // message

◆ operator std::string()

Issue::operator std::string ( ) const

Converts the issue into a string.

Definition at line 165 of file ers/ers-00-00-03/src/Issue.cxx.

165 {
166 std::string s = human_description();
167 return s ;
168} // std::string()
const std::string & human_description() const
Human description message.

◆ operator=()

Issue Issue::operator= ( const Issue source)

Affectation operator.

Copy operator

Parameters
sourcethe original issue
Returns
the copy issue
Note
The m_cause member, if non null, is cloned

Definition at line 176 of file ers/ers-00-00-03/src/Issue.cxx.

176 {
177 Issue target(source);
178 return target ;
179} // operator=

◆ operator==()

bool Issue::operator== ( const Issue other) const
throw (
)

Equality operator.

Comparison operator

Parameters
otherissue to compare to
Returns
true if this and other are equal

Definition at line 186 of file ers/ers-00-00-03/src/Issue.cxx.

186 {
187 if (m_value_table != other.m_value_table) return false ;
188 if (m_cause == other.m_cause) return true ;
189 return (*m_cause) == *(other.m_cause) ;
190} // operator==
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ operator[]()

const std::string & Issue::operator[] ( const std::string &  key) const
throw (
)

Array access operator

Parameters
keythe resolve
Returns
string containing value
See also
get_value(const std::string &)

Definition at line 198 of file ers/ers-00-00-03/src/Issue.cxx.

198 {
199 return get_value(key,"");
200} // operator[]

◆ qualifiers()

std::vector< std::string > Issue::qualifiers ( ) const

return array of qualifiers

Gets the list of qualifiers

Returns
list of qualifiers

Definition at line 715 of file ers/ers-00-00-03/src/Issue.cxx.

715 {
716 const std::string &qualif_s = get_value(QUALIFIER_LIST_KEY) ;
717 return ers::Core::tokenize(qualif_s,", \t");
718} // qualifiers
static std::vector< std::string > tokenize(const std::string &text, const std::string &separators)
Definition: Core.cxx:151

◆ responsibility() [1/2]

responsibility_t Issue::responsibility ( ) const
throw (
)

get the responsability level of the issue

Gets the responsibility type of the Issue

Returns
the responsibiliy value of the Issue

Definition at line 637 of file ers/ers-00-00-03/src/Issue.cxx.

637 {
638 std::string value = this->get_value(RESPONSIBILITY_KEY);
640} // responsability
static responsibility_t parse_responsibility(const char *s)
string to responsibility
Definition: Core.cxx:65
static const char *const RESPONSIBILITY_KEY
key for the responsibility of the issue (text)

Referenced by ers::InvalidReferenceIssue::InvalidReferenceIssue().

◆ responsibility() [2/2]

void Issue::responsibility ( responsibility_t  r)

set the responsability of the issue

Sets the responsbility of the Issue

Parameters
rthe responsibility type

Definition at line 646 of file ers/ers-00-00-03/src/Issue.cxx.

646 {
648} // responsability
static const char * to_string(severity_t s)
severity_t to string
Definition: Core.cxx:22

◆ set_value() [1/12]

void Issue::set_value ( const std::string &  key,
const char *  value 
)
throw (
)

Sets a value (c-string)

Sets a string value in the value table

Parameters
keythe key to use for insertion
valuec-string, null pointer is ignored.

Definition at line 444 of file ers/ers-00-00-03/src/Issue.cxx.

444 {
445 if (value) {
446 std::string value_str = std::string(value) ;
447 set_value(key,value_str);
448 } // if
449} // set_value

◆ set_value() [2/12]

void Issue::set_value ( const std::string &  key,
const std::string &  value 
)
throw (
)

Sets a value (string)

Sets a string value in the value table

Parameters
keythe key to use for insertion
valuethe value to insert

Definition at line 433 of file ers/ers-00-00-03/src/Issue.cxx.

433 {
434 if (! value.empty()) {
435 m_value_table[key] = value ;
436 }
437} // set_value

◆ set_value() [3/12]

void Issue::set_value ( const std::string &  key,
const void *  ptr 
)
throw (
)

Sets a pointer in the value table

Parameters
keythe key to use for insertion
ptra pointer
Note
the pointer is stored in hex format

Definition at line 457 of file ers/ers-00-00-03/src/Issue.cxx.

457 {
458 std::ostringstream stream ;
459 stream.setf(std::ios::hex,std::ios::basefield);
460 stream << (unsigned long) ptr ;
461 m_value_table[key] = stream.str();
462} // set_value

◆ set_value() [4/12]

void Issue::set_value ( const std::string &  key,
double  value 
)
throw (
)

Sets a value (double float)

Set a numerical value in the value table

Parameters
keythe key to use for insertion
valuethe value to insert

Definition at line 422 of file ers/ers-00-00-03/src/Issue.cxx.

422 {
423 std::ostringstream stream ;
424 stream << value ;
425 m_value_table[key] = stream.str();
426} // set_value

◆ set_value() [5/12]

void Issue::set_value ( const std::string &  key,
int16_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 401 of file ers/ers-00-00-03/src/Issue.cxx.

401 {
403} // set_value
#define ISSUE_VALUE_SET_SCALAR(table, key, value)

◆ set_value() [6/12]

void Issue::set_value ( const std::string &  key,
int32_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 407 of file ers/ers-00-00-03/src/Issue.cxx.

407 {
409} // set_value

◆ set_value() [7/12]

void Issue::set_value ( const std::string &  key,
int64_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 413 of file ers/ers-00-00-03/src/Issue.cxx.

413 {
415} // set_value

◆ set_value() [8/12]

void Issue::set_value ( const std::string &  key,
int8_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 395 of file ers/ers-00-00-03/src/Issue.cxx.

395 {
397} // set_value

◆ set_value() [9/12]

void Issue::set_value ( const std::string &  key,
uint16_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 377 of file ers/ers-00-00-03/src/Issue.cxx.

377 {
379} // set_value

◆ set_value() [10/12]

void Issue::set_value ( const std::string &  key,
uint32_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 383 of file ers/ers-00-00-03/src/Issue.cxx.

383 {
385} // set_value

◆ set_value() [11/12]

void Issue::set_value ( const std::string &  key,
uint64_t  value 
)
throw (
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 389 of file ers/ers-00-00-03/src/Issue.cxx.

389 {
391} // set_value

◆ set_value() [12/12]

◆ set_values()

void Issue::set_values ( const string_map_type values)
throw (
)
protected

sets the value table

Sets the value table

Parameters
valuesthe value table to load

Definition at line 362 of file ers/ers-00-00-03/src/Issue.cxx.

362 {
363 m_value_table = values ;
364} // load_values

Referenced by ers::IssueFactory::build(), and Issue().

◆ setup_common()

void Issue::setup_common ( const Context context)
throw (
)
protected

Sets up the common fields.

This method sets up common fields for all Issues. In particular, it inserts all data concerning the Issue's context, this includes

  • Source code position (file/line)
  • Compiler version
  • Compilation time and date
Parameters
contextcontext where the exception occured, this should be the ERS_HERE macro.
Note
All method used within this method should throw no exceptions to avoid circular problems.

Definition at line 535 of file ers/ers-00-00-03/src/Issue.cxx.

535 {
536 const int errno_copy = errno ; // We need to save errno, because it might be changed
537 insert(context);
538 insert_time();
539 errno = errno_copy ; // we restaure errno
540} // setup_common
void insert_time()
Inserts current time.
void insert(const Context *context)
Inserts the context.

Referenced by Issue().

◆ severity() [1/2]

severity_t Issue::severity ( ) const
throw (
)

severity_t of the issue

Gets the severity_t of the Issue

Returns
severity_t of the Issue

Definition at line 602 of file ers/ers-00-00-03/src/Issue.cxx.

602 {
603 std::string value = get_value(SEVERITY_KEY);
604 return ers::Core::parse_severity(value);
605} // severity
static severity_t parse_severity(const char *s)
string to severity_t
Definition: Core.cxx:33
static const char *const SEVERITY_KEY
key for the severity_t of the issue

Referenced by ers::StreamFactory::debug(), ers::StreamFactory::dispatch(), ers::StreamFactory::error(), ers::StreamFactory::fatal(), ers::InvalidReferenceIssue::InvalidReferenceIssue(), is_error(), Issue(), ers::DefaultStream::send(), and ers::StreamFactory::warning().

◆ severity() [2/2]

void Issue::severity ( severity_t  s)

sets the severity_t of the issue

Set the severity_t of the Issue

Parameters
sthe severity_t level

Definition at line 611 of file ers/ers-00-00-03/src/Issue.cxx.

611 {
613} // severity

◆ severity_message()

std::string Issue::severity_message ( ) const

message associated with the severity_t of the issue

Returns
the string representing the severity_t of the issue

Definition at line 628 of file ers/ers-00-00-03/src/Issue.cxx.

628 {
629 return get_value(SEVERITY_KEY);
630} // severity_message

◆ transience() [1/2]

int Issue::transience ( ) const
throw (
)

is the issue transient

Returns
the transience of the issue, 1 = true, 0 = false, -1 = unknown

Definition at line 662 of file ers/ers-00-00-03/src/Issue.cxx.

662 {
663 std::string value = this->get_value(TRANSIENCE_KEY);
664 return ers::Core::parse_boolean(value.c_str());
665} // transience
static int parse_boolean(const char *s)
string to boolean
Definition: Core.cxx:88
static const char *const TRANSIENCE_KEY
key for the transience of the issue (text)

Referenced by exit_value().

◆ transience() [2/2]

void Issue::transience ( bool  tr)

sets if the issue is transient

Sets the transience of the issue

Parameters
trtrue if the issue is transient, false if not

Definition at line 655 of file ers/ers-00-00-03/src/Issue.cxx.

655 {
657} // transience

◆ values_number()

int Issue::values_number ( ) const

How many key / values.

Returns
the number of key/value pairs in the issue

Definition at line 469 of file ers/ers-00-00-03/src/Issue.cxx.

469 {
470 return m_value_table.size();
471} // values_number

◆ what()

const char * Issue::what ( ) const
throw (
)

Human description message.

This method overides the what method of the std::exception class. As this method is declared const, it has to use a pre-calculated string

Returns
C style string of human_description

Definition at line 684 of file ers/ers-00-00-03/src/Issue.cxx.

684 {
685 std::string desr = human_description() ;
686 return desr.c_str();
687} // what();

Referenced by EFEventLoopMgr::executeEvent(), and main().

Friends And Related Function Documentation

◆ IssueFactory

friend class IssueFactory
friend

Definition at line 42 of file ers/ers-00-00-03/ers/Issue.h.

◆ Stream

friend class Stream
friend

Definition at line 41 of file ers/ers-00-00-03/ers/Issue.h.

Member Data Documentation

◆ CAUSE_PSEUDO_KEY

const char *const Issue::CAUSE_PSEUDO_KEY = "CAUSE"
static

key used when serializing the cause issue, this key is not used in the value table

Definition at line 66 of file ers/ers-00-00-03/ers/Issue.h.

◆ CAUSE_TEXT_KEY

const char *const Issue::CAUSE_TEXT_KEY = "CAUSE_TEXT"
static

key used to store the cause issue's message

Definition at line 67 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by cause().

◆ CLASS_KEY

const char *const Issue::CLASS_KEY = "ISSUE_CLASS"
static

key for class information

Definition at line 44 of file ers/ers-00-00-03/ers/Issue.h.

◆ COMPILATION_DEBUG_LVL_KEY

const char *const Issue::COMPILATION_DEBUG_LVL_KEY = "COMPILATION_DEBUG_LVL"
static

Definition at line 48 of file ers/ers-00-00-03/ers/Issue.h.

◆ COMPILATION_TARGET_KEY

const char *const Issue::COMPILATION_TARGET_KEY = "COMPILATION_TARGET"
static

key for compilation target

Definition at line 46 of file ers/ers-00-00-03/ers/Issue.h.

◆ COMPILATION_TIME_KEY

const char *const Issue::COMPILATION_TIME_KEY = "COMPILATION_TIME"
static

key for compilation time

Definition at line 45 of file ers/ers-00-00-03/ers/Issue.h.

◆ COMPILER_KEY

const char *const Issue::COMPILER_KEY = "COMPILER"
static

key for compilator type

Definition at line 47 of file ers/ers-00-00-03/ers/Issue.h.

◆ CPP_CLASS_KEY

const char *const Issue::CPP_CLASS_KEY = "ISSUE_CPP_CLASS"
static

key for c++ class (might be mangled)

Definition at line 49 of file ers/ers-00-00-03/ers/Issue.h.

◆ ERS_VERSION_KEY

const char *const Issue::ERS_VERSION_KEY = "ERS_VERSION"
static

key for ERS version

Definition at line 50 of file ers/ers-00-00-03/ers/Issue.h.

◆ EXIT_VALUE_KEY

const char *const Issue::EXIT_VALUE_KEY = "EXIT_VALUE"
static

key used to store the exit value

Definition at line 69 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by exit_value().

◆ HOST_IP_ADDR_KEY

const char *const Issue::HOST_IP_ADDR_KEY = "HOST_IP"
static

key for host ip address

Definition at line 53 of file ers/ers-00-00-03/ers/Issue.h.

◆ HOST_NAME_KEY

const char *const Issue::HOST_NAME_KEY = "HOST_NAME"
static

key for hostname

Definition at line 51 of file ers/ers-00-00-03/ers/Issue.h.

◆ HOST_TYPE_KEY

const char *const Issue::HOST_TYPE_KEY = "HOST_TYPE"
static

key for host type (architecture / os)

Definition at line 52 of file ers/ers-00-00-03/ers/Issue.h.

◆ ISSUE_CLASS_NAME

const char *const Issue::ISSUE_CLASS_NAME = "ers::issue"
static

name of the class, used for serialisation

Definition at line 70 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by get_class_name().

◆ m_cause

Issue* ers::Issue::m_cause
protected

Issue that caused the current issue.

Definition at line 73 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by cause(), Issue(), and ~Issue().

◆ m_class_name

std::string ers::Issue::m_class_name
mutableprotected

class name

Definition at line 74 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by ers::DefaultIssue::DefaultIssue(), and get_class_name().

◆ m_human_description

std::string ers::Issue::m_human_description
mutableprotected

Human readable description (cache)

Definition at line 75 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by human_description(), and Issue().

◆ m_value_table

string_map_type ers::Issue::m_value_table
protected

Optional properties.

Definition at line 76 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by ers::InvalidReferenceIssue::check_reference(), get_value_table(), Issue(), and values_number().

◆ MESSAGE_KEY

const char *const Issue::MESSAGE_KEY = "MESSAGE"
static

key for human readable

Definition at line 54 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by message(), ers::DefaultStream::send(), and ers::HumanStream::send().

◆ PROCESS_ID_KEY

const char *const Issue::PROCESS_ID_KEY = "PROCESS_ID"
static

key for the process id (number)

Definition at line 55 of file ers/ers-00-00-03/ers/Issue.h.

◆ PROCESS_PWD_KEY

const char *const Issue::PROCESS_PWD_KEY = "PROCESS_PWD"
static

key for the process working directory

Definition at line 56 of file ers/ers-00-00-03/ers/Issue.h.

◆ PROGRAM_NAME_KEY

const char *const Issue::PROGRAM_NAME_KEY = "PROGRAM_NAME"
static

key for the name of the program

Definition at line 57 of file ers/ers-00-00-03/ers/Issue.h.

◆ QUALIFIER_LIST_KEY

const char *const Issue::QUALIFIER_LIST_KEY = "QUALIFIERS"
static

key used to store the qualifier list

Definition at line 68 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by add_qualifier(), ers::FilterStream::is_accept(), and qualifiers().

◆ RESPONSIBILITY_KEY

const char *const Issue::RESPONSIBILITY_KEY = "RESPONSIBILITY"
static

key for the responsibility of the issue (text)

Definition at line 58 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by responsibility().

◆ SEVERITY_KEY

const char *const Issue::SEVERITY_KEY = "SEVERITY"
static

key for the severity_t of the issue

Definition at line 59 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by ers::DefaultStream::send(), ers::HumanStream::send(), severity(), and severity_message().

◆ SOURCE_PACKAGE_KEY

const char *const Issue::SOURCE_PACKAGE_KEY = "SOURCE_PACKAGE"
static

package name associated with source code

Definition at line 61 of file ers/ers-00-00-03/ers/Issue.h.

◆ SOURCE_POSITION_KEY

const char *const Issue::SOURCE_POSITION_KEY = "SOURCE_POSITION"
static

key for position in the source code

Definition at line 60 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by ers::DefaultStream::send().

◆ TIME_KEY

const char *const Issue::TIME_KEY = "TIME"
static

key for the time of the issue (text)

Definition at line 62 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by insert_time(), and ers::DefaultStream::send().

◆ TRANSIENCE_KEY

const char *const Issue::TRANSIENCE_KEY = "TRANSIENCE"
static

key for the transience of the issue (text)

Definition at line 63 of file ers/ers-00-00-03/ers/Issue.h.

Referenced by transience().

◆ USER_ID_KEY

const char *const Issue::USER_ID_KEY = "USER_ID"
static

key for the user-id of the owner of the process

Definition at line 64 of file ers/ers-00-00-03/ers/Issue.h.

◆ USER_NAME_KEY

const char *const Issue::USER_NAME_KEY = "USER_NAME"
static

key for the user-name of the owner of the process

Definition at line 65 of file ers/ers-00-00-03/ers/Issue.h.


The documentation for this class was generated from the following files: