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