BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
ers/ers-00-00-02/src/Issue.cxx
Go to the documentation of this file.
1/*
2 * Issue.cxx
3 * ers
4 *
5 * Created by Matthias Wiesmann on 26.11.04.
6 * Copyright 2004 CERN. All rights reserved.
7 *
8 */
9
10
11#include <iostream>
12#include <sstream>
13#include <errno.h>
14#include <unistd.h>
15#include <stdlib.h>
16#include <time.h>
17#include <math.h>
18#include <sysexits.h>
19
20#include "ers/ers.h"
21#include "ers/HumanStream.h"
22#include <cstring>
23#include <typeinfo>
24#define BUFFER_SIZE 256
25
26#define ISSUE_VALUE_SET_SCALAR(table,key,value) { std::ostringstream stream ; stream << value ; table[key] = stream.str(); }
27
28/** This block insert the relevant function into the Issue Factory table.
29 * This is needed to ensure that serialisation classes work
30 */
31
32namespace {
33 ers::Issue *create_issue() { return new ers::Issue(); }
35}
36
37using namespace ers ;
38
39const char* const Issue::CLASS_KEY = "ISSUE_CLASS" ;
40const char* const Issue::COMPILATION_TIME_KEY = "COMPILATION_TIME" ;
41const char* const Issue::COMPILATION_TARGET_KEY = "COMPILATION_TARGET" ;
42const char* const Issue::COMPILATION_DEBUG_LVL_KEY = "COMPILATION_DEBUG_LVL" ;
43const char* const Issue::COMPILER_KEY = "COMPILER" ;
44const char* const Issue::CPP_CLASS_KEY = "ISSUE_CPP_CLASS" ;
45const char* const Issue::ERS_VERSION_KEY = "ERS_VERSION" ;
46const char* const Issue::HOST_NAME_KEY = "HOST_NAME" ;
47const char* const Issue::HOST_TYPE_KEY = "HOST_TYPE" ;
48const char* const Issue::HOST_IP_ADDR_KEY = "HOST_IP" ;
49const char* const Issue::MESSAGE_KEY = "MESSAGE" ;
50const char* const Issue::PROCESS_ID_KEY = "PROCESS_ID" ;
51const char* const Issue::PROCESS_PWD_KEY = "PROCESS_PWD" ;
52const char* const Issue::PROGRAM_NAME_KEY = "PROGRAM_NAME";
53const char* const Issue::RESPONSIBILITY_KEY = "RESPONSIBILITY" ;
54const char* const Issue::SEVERITY_KEY = "SEVERITY" ;
55const char* const Issue::SOURCE_POSITION_KEY = "SOURCE_POSITION" ;
56const char* const Issue::SOURCE_PACKAGE_KEY = "SOURCE_PACKAGE" ;
57const char* const Issue::TIME_KEY = "TIME" ;
58const char* const Issue::TRANSIENCE_KEY = "TRANSIENCE" ;
59const char* const Issue::USER_ID_KEY = "USER_ID" ;
60const char* const Issue::USER_NAME_KEY = "USER_NAME" ;
61const char* const Issue::CAUSE_TEXT_KEY = "CAUSE_TEXT" ;
62const char* const Issue::CAUSE_PSEUDO_KEY = "CAUSE" ;
63const char* const Issue::QUALIFIER_LIST_KEY = "QUALIFIERS" ;
64const char* const Issue::EXIT_VALUE_KEY = "EXIT_VALUE" ;
65
66const char* const Issue::ISSUE_CLASS_NAME = "ers::issue" ;
67
68// Constructors
69// ====================================================
70
71/** Empty constructor, should only be used when deserialising issues
72 */
73
75 m_human_description.clear() ;
76 m_cause = 0 ;
77} // Issue
78
79/** Copy constructor
80 * The \c m_human_description and the \c m_value_table fields are simply copied
81 * The The issue in the \c m_cause pointer if present is cloned.
82 * \param issue original for copy
83 */
84
85Issue::Issue(const Issue &issue) : 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
94
95/** Builds an Issue out of a value table
96 * \param values table of values for the issue
97 */
98
100 cause();
101 set_values(values);
102 m_human_description.clear();
103} // Issue
104
105
106/** Constructor
107 * \param context the context of the Issue, e.g where in the code did the issue appear
108 * \param s severity_t of the Issue
109 * \param m message of the Issue
110 */
111
112Issue::Issue(const Context &context, severity_t s, const std::string &m) {
113 cause();
114 setup_common(&context);
115 severity(s);
116 finish_setup(m);
117} // Issue
118
119/** @overload */
120
122 cause();
123 setup_common(&context);
124 severity(s);
125} // Issue
126
127/** Constructor - takes another exceptions as the cause for the current exception.
128 * \param context the context of the Issue, e.g where in the code did the issue appear
129 * \param s the severity_t of the exception
130 * \param cause_exception the exception that caused the current Issue
131 */
132
133Issue::Issue(const Context &context, severity_t s, const std::exception *cause_exception) {
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
140
141/** Destructor.
142 * If the \c m_cause pointer is not null, the pointed Issue is deleted
143 */
144
145Issue::~Issue() throw() {
146 if (m_cause) delete m_cause ;
147 m_cause = 0 ;
148} // ~Issue
149
150
151// Operators and factory methods
152// ====================================================
153
154
155/** Builds a clone of the object.
156 * The object is allocated on the stack, and should be deleted by the caller
157 * \return a new object that is a copy of the current object
158 */
159
161 return IssueFactory::instance()->build(this) ;
162} // clone
163
164
165Issue::operator std::string() const {
166 std::string s = human_description();
167 return s ;
168} // std::string()
169
170/** Copy operator
171 * \param source the original issue
172 * \return the copy issue
173 * \note The \c m_cause member, if non null, is cloned
174 */
175
177 Issue target(source);
178 return target ;
179} // operator=
180
181/** Comparison operator
182 * \param other issue to compare to
183 * \return \c true if \c this and \c other are equal
184 */
185
186bool Issue::operator==(const Issue &other) const throw() {
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==
191
192/** Array access operator
193 * \param key the resolve
194 * \return string containing value
195 * \see get_value(const std::string &)
196 */
197
198const std::string & Issue::operator[](const std::string &key) const throw() {
199 return get_value(key,"");
200} // operator[]
201
202
203
204// ====================================================
205// Stream Operators
206// ====================================================
207
208
209/** Standard Streaming operator - puts the human description into the Stream.
210 * \param s the destination Stream
211 * \param i the Issue to Stream
212 * \see Issue::human_description()
213 */
214
215std::ostream& ers::operator<<(std::ostream& s, const Issue& i) {
216 return s << i.human_description() ;
217} // operator<<
218
219/** Sends the Issue into a Stream
220 * \param s the Stream to send the Issue into
221 * \param i the Issue to send
222 * \return the Stream
223 * \see serialize_to()
224 */
225
227 s.send(&i);
228 return s ;
229} // operator<<
230
231
232// ====================================================
233// Manipulation of the m_cause field
234// ====================================================
235
236/**
237 * \return the cause of the issue, if there is one, a null pointer otherwise
238 */
239
240const Issue *Issue::cause() const throw() {
241 return m_cause ;
242} // cause
243
244/** Sets the cause of the issue
245 * If the cause is an Issue, it is cloned and stored in the \c m_cause pointer.
246 * In all cases, the description of the cause is stored in the value table using
247 * the \c CAUSE_TEXT_KEY key.
248 * If the cause pointer is null, the \c m_cause field is simply cleared.
249 * \param c pointer to the cause exception
250 */
251
252void Issue::cause(const std::exception *c) {
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
265
266
267// Value Table manipulation Methods
268// ====================================================
269
270/** Returns a read-only pointer to the value table
271 * @return read only pointer to the table
272 */
273
275 return &m_value_table ;
276} // get_value_table
277
278/** General method for querying properties of the Issue
279 * \param key the key to lookup
280 * @return the string value for the key and empty string if the key is not found
281 */
282
283const std::string &Issue::get_value(const std::string &key, const std::string &def) const throw() {
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
290
291/** \overload
292 */
293
294const std::string &Issue::get_value(const std::string &key) const throw() {
295 return get_value(key,Core::empty_string) ;
296} // get_value
297
298
299/** Get a property of an issue as an integer
300 * \param key the key to search for
301 * \param def the value to return if key is not found
302 * \return value of key or \c def
303 */
304
305int Issue::get_int_value(const std::string &key, int def) const throw() {
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
317
318
319/** Get a property of an issue as an long
320* \param key the key to search for
321* \param def the value to return if key is not found
322* \return value of key or \c def
323*/
324
325long Issue::get_long_value(const std::string &key, long def) const throw() {
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
337
338/** Get a property of an issue as an double
339 * \param key the key to search for
340 * \param def the value to return if key is not found - the default value for this parameter is NaN.
341 * \return value of key or \c def
342 */
343
344double Issue::get_double_value(const std::string key, double def=nan("")) const throw() {
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
356
357
358/** Sets the value table
359 * \param values the value table to load
360 */
361
362void Issue::set_values(const string_map_type &values) throw() {
363 m_value_table = values ;
364} // load_values
365
366/** Set a numerical value in the value table
367 * \param key the key to use for insertion
368 * \param value the value to insert
369 */
370
371void Issue::set_value(const std::string &key, uint8_t value) throw() {
372 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
373} // set_value
374
375/** \overload */
376
377void Issue::set_value(const std::string &key, uint16_t value) throw() {
378 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
379} // set_value
380
381/** \overload */
382
383void Issue::set_value(const std::string &key, uint32_t value) throw() {
384 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
385} // set_value
386
387/** \overload */
388
389void Issue::set_value(const std::string &key, uint64_t value) throw() {
390 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
391} // set_value
392
393/** \overload */
394
395void Issue::set_value(const std::string &key, int8_t value) throw() {
396 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
397} // set_value
398
399/** \overload */
400
401void Issue::set_value(const std::string &key, int16_t value) throw() {
402 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
403} // set_value
404
405/** \overload */
406
407void Issue::set_value(const std::string &key, int32_t value) throw() {
408 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
409} // set_value
410
411/** \overload */
412
413void Issue::set_value(const std::string &key, int64_t value) throw() {
414 ISSUE_VALUE_SET_SCALAR(m_value_table,key,value);
415} // set_value
416
417/** Set a numerical value in the value table
418 * \param key the key to use for insertion
419 * \param value the value to insert
420 */
421
422void Issue::set_value(const std::string &key, double value) throw() {
423 std::ostringstream stream ;
424 stream << value ;
425 m_value_table[key] = stream.str();
426} // set_value
427
428/** Sets a string value in the value table
429 * \param key the key to use for insertion
430 * \param value the value to insert
431 */
432
433void Issue::set_value(const std::string &key, const std::string &value) throw() {
434 if (! value.empty()) {
435 m_value_table[key] = value ;
436 }
437} // set_value
438
439/** Sets a string value in the value table
440 * \param key the key to use for insertion
441 * \param value c-string, null pointer is ignored.
442 */
443
444void Issue::set_value(const std::string &key, const char* value) throw() {
445 if (value) {
446 std::string value_str = std::string(value) ;
447 set_value(key,value_str);
448 } // if
449} // set_value
450
451/** Sets a pointer in the value table
452 * \param key the key to use for insertion
453 * \param ptr a pointer
454 * \note the pointer is stored in hex format
455 */
456
457void Issue::set_value(const std::string &key, const void* ptr) throw() {
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
463
464
465/**
466 * \return the number of key/value pairs in the issue
467 */
468
470 return m_value_table.size();
471} // values_number
472
473// ====================================================
474// Insertions Methods
475// ====================================================
476
477/** Inserts the context of the issue into the issue
478* \param context pointer to context object
479*/
480
481void Issue::insert(const Context *context) throw() {
482 if (context) {
483 set_value(SOURCE_POSITION_KEY,context->position()) ;
484 set_value(SOURCE_PACKAGE_KEY,context->package_name());
485 set_value(COMPILER_KEY,context->compiler()) ;
486 set_value(COMPILATION_TIME_KEY,context->compilation()) ;
487 set_value(COMPILATION_TARGET_KEY,context->host_type()) ;
488 int lvl = ers::Context::debug_level();
489 if (lvl>=0) {
490 set_value(COMPILATION_DEBUG_LVL_KEY,lvl);
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
505
506/** Inserts the current time into the issue
507*/
508
509void Issue::insert_time() throw() {
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
520
521// ====================================================
522// Setup Methods
523// ====================================================
524
525/** This method sets up common fields for all Issues.
526 * In particular, it inserts all data concerning the Issue's context, this includes
527 * \li Source code position (file/line)
528 * \li Compiler version
529 * \li Compilation time and date
530 *
531 * \param context context where the exception occured, this should be the ERS_HERE macro.
532 * \note All method used within this method should throw no exceptions to avoid circular problems.
533 */
534
535void Issue::setup_common(const Context *context) throw() {
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
541
542/* Cut out stuff to remove dependency
543* \li Hostname
544 * \li Process id
545 * \li OS and processor of the host
546 Process p ;
547 set_value(PROCESS_ID_KEY,p.process_id());
548 System::User user ;
549 set_value(USER_ID_KEY,user.identity()) ;
550 set_value(USER_NAME_KEY,user.name_safe()) ;
551 set_value(PROCESS_PWD_KEY,System::File::working_directory());
552 System::LocalHost *localhost = System::LocalHost::instance();
553 set_value(HOST_NAME_KEY,localhost->full_name());
554 set_value(HOST_IP_ADDR_KEY,localhost->ip_string());
555 set_value(HOST_TYPE_KEY,localhost->description());
556
557*/
558
559
560/** Finishes the setting up of the information fields.
561 * In particular, in fills in the human message and the class type fields
562 * (those fields are not available until the end of the object construction.
563 * @note this method should be called by the sub-class constructor, so that RTTI information is setup and correct.
564 * \param message human readable message
565 * \note All method used within this method should throw no exceptions to avoid circular problems.
566 */
567
568void Issue::finish_setup(const std::string &msg) throw() {
569 // set_value(CPP_CLASS_KEY,class_name);
570 set_value(CLASS_KEY, get_class_name()) ;
571 set_value(MESSAGE_KEY,msg);
572} // finish_setup
573
574
575
576// ====================================================
577// Field Access Methods
578// ====================================================
579
580/** Returns the key used to describe this particular class when serializing
581 * This method tries to build a meaningfull class name out of C++ RTTI.
582 * This depends on the compiler providing information in a format similar to gcc.
583 * For more safety.
584 * If the gcc unmangling fails the default (ers::Issue) is used.
585 */
586
587const char*Issue::get_class_name() const throw() {
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
597
598/** Gets the severity_t of the Issue
599 * @return severity_t of the Issue
600 */
601
603 std::string value = get_value(SEVERITY_KEY);
604 return ers::Core::parse_severity(value);
605} // severity
606
607/** Set the severity_t of the Issue
608 * \param s the severity_t level
609 */
610
613} // severity
614
615/** Is the issue either an error or a fatal error
616 * \return \c true if the issue is either an error or a fatal
617 */
618
620 severity_t s = severity();
621 return (s==ers::error || s== ers::fatal) ;
622} // is_error
623
624/**
625 * \return the string representing the severity_t of the issue
626 */
627
628std::string Issue::severity_message() const {
629 return get_value(SEVERITY_KEY);
630} // severity_message
631
632
633/** Gets the responsibility type of the Issue
634 * \return the responsibiliy value of the Issue
635 */
636
638 std::string value = this->get_value(RESPONSIBILITY_KEY);
640} // responsability
641
642/** Sets the responsbility of the Issue
643 * \param r the responsibility type
644 */
645
648} // responsability
649
650
651/** Sets the transience of the issue
652 * \param tr true if the issue is transient, false if not
653 */
654
655void Issue::transience(bool tr) {
657} // transience
658
659/** @return the transience of the issue, 1 = true, 0 = false, -1 = unknown
660 */
661
662int Issue::transience() const throw () {
663 std::string value = this->get_value(TRANSIENCE_KEY);
664 return ers::Core::parse_boolean(value.c_str());
665} // transience
666
667
668/**
669 * @return human description of the Issue
670 */
671
672const std::string &Issue::human_description() const throw() {
673 if (m_human_description.empty()) {
675 }
676 return m_human_description ;
677} // human_description
678
679/** This method overides the what method of the std::exception class.
680 * As this method is declared const, it has to use a pre-calculated string
681 * @return C style string of human_description
682 */
683
684const char *Issue::what() const throw() {
685 std::string desr = human_description() ;
686 return desr.c_str();
687} // what();
688
689const std::string &Issue::message() const throw() {
690 return get_value(MESSAGE_KEY) ;
691} // message
692
693int Issue::exit_value() const throw() {
694 int v = 1 ;
695 if (transience()==1) v = EX_TEMPFAIL ;
697} // exit_value
698
699/** Add a qualifier to the qualifier list
700 * \param qualif the qualifier to add
701 */
702
703void Issue::add_qualifier(const std::string &qualif) {
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
710
711/** Gets the list of qualifiers
712 * \return list of qualifiers
713 */
714
715std::vector<std::string> Issue::qualifiers() const {
716 const std::string &qualif_s = get_value(QUALIFIER_LIST_KEY) ;
717 return ers::Core::tokenize(qualif_s,", \t");
718} // qualifiers
719
720
721
722
723
724
725
const Int_t n
Double_t time
XmlRpcServer s
Definition: HelloServer.cpp:11
#define ERS_PRE_CHECK_PTR(p)
**********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
*************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
Source context for Issue.
Definition: Context.h:42
static int debug_level()
Definition: Context.cxx:48
static int parse_boolean(const char *s)
string to boolean
Definition: Core.cxx:88
static std::string umangle_gcc_class_name(const char *name)
unmangles gcc RTTI names
Definition: Core.cxx:135
static responsibility_t parse_responsibility(const char *s)
string to responsibility
Definition: Core.cxx:65
static std::vector< std::string > tokenize(const std::string &text, const std::string &separators)
Definition: Core.cxx:151
static const std::string empty_string
Definition: Core.h:38
static const char * to_string(severity_t s)
severity_t to string
Definition: Core.cxx:22
static severity_t parse_severity(const char *s)
string to severity_t
Definition: Core.cxx:33
std::string to_string()
Definition: HumanStream.cxx:54
bool register_issue(const std::string &name, CreateIssueCallback creator)
register an issue factory
static IssueFactory * instance()
method to access singleton
Issue * build(const std::string &name) const
build an empty issue out of a name
Root Issue class.
static const char *const HOST_TYPE_KEY
key for host type (architecture / os)
responsibility_t responsibility() const
get the responsability level of the issue
void set_values(const string_map_type &values)
sets the value table
int values_number() const
How many key / values.
static const char *const USER_NAME_KEY
key for the user-name of the owner of the process
static const char *const PROGRAM_NAME_KEY
key for the name of the program
static const char *const ERS_VERSION_KEY
key for ERS version
std::string m_class_name
class name
static const char *const CPP_CLASS_KEY
key for c++ class (might be mangled)
const std::string & get_value(const std::string &key, const std::string &def) const
Reads the property list.
static const char *const COMPILATION_TARGET_KEY
key for compilation target
std::string severity_message() const
message associated with the severity_t of the issue
long get_long_value(const std::string &key, long def=0) const
Get a value of the table as a long integer.
const std::string & operator[](const std::string &key) const
static const char *const MESSAGE_KEY
key for human readable
void set_value(const std::string &key, uint8_t value)
Sets a value 8 bit unsigned.
static const char *const USER_ID_KEY
key for the user-id of the owner of the process
static const char *const SEVERITY_KEY
key for the severity_t of the issue
void insert_time()
Inserts current time.
std::string m_human_description
Human readable description (cache)
static const char *const EXIT_VALUE_KEY
key used to store the exit value
static const char *const COMPILATION_TIME_KEY
key for compilation time
severity_t severity() const
severity_t of the issue
bool is_error()
is the issue an error (or fatal).
std::vector< std::string > qualifiers() const
return array of qualifiers
const std::string & message() const
Message.
int get_int_value(const std::string &key, int def=0) const
Get a value of the table as an integer.
void finish_setup(const std::string &message)
Finishes the setup of the Issue.
static const char *const RESPONSIBILITY_KEY
key for the responsibility of the issue (text)
static const char *const TRANSIENCE_KEY
key for the transience of the issue (text)
static const char *const TIME_KEY
key for the time of the issue (text)
const std::string & human_description() const
Human description message.
static const char *const COMPILATION_DEBUG_LVL_KEY
static const char *const CAUSE_TEXT_KEY
key used to store the cause issue's message
static const char *const SOURCE_POSITION_KEY
key for position in the source code
Issue * m_cause
Issue that caused the current issue.
const Issue * cause() const
return the cause Issue of this Issue
static const char *const PROCESS_PWD_KEY
key for the process working directory
static const char *const CAUSE_PSEUDO_KEY
key used when serializing the cause issue, this key is not used in the value table
const char * what() const
Human description message.
static const char *const COMPILER_KEY
key for compilator type
static const char *const HOST_NAME_KEY
key for hostname
static const char *const QUALIFIER_LIST_KEY
key used to store the qualifier list
const string_map_type * get_value_table() const
extract value table
static const char *const CLASS_KEY
key for class information
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
int transience() const
is the issue transient
string_map_type m_value_table
Optional properties.
virtual const char * get_class_name() const
Get key for class (used for serialisation)
static const char *const HOST_IP_ADDR_KEY
key for host ip address
void insert(const Context *context)
Inserts the context.
static const char *const ISSUE_CLASS_NAME
name of the class, used for serialisation
Issue operator=(const Issue &issue)
Affectation operator.
virtual int exit_value() const
value to pass to exit
double get_double_value(const std::string key, double def) const
Get a value of the table as double.
void setup_common(const Context *context)
Sets up the common fields.
static const char *const PROCESS_ID_KEY
key for the process id (number)
bool operator==(const Issue &other) const
Equality operator.
Root/Null issue stream.
Definition: Stream.h:35
#define ISSUE_VALUE_SET_SCALAR(table, key, value)
#define BUFFER_SIZE
ers header and documentation file
enum ers::_responsibility_t responsibility_t
std::ostream & operator<<(std::ostream &, const Issue &)
@ error
Definition: Core.h:24
@ fatal
Definition: Core.h:24
std::map< std::string, std::string > string_map_type
Definition: Core.h:26
enum ers::_severity_t severity_t