ers::Precondition Class Reference

Precondition issue. More...

#include <Precondition.h>

Inheritance diagram for ers::Precondition:

ers::Assertion ers::Issue List of all members.

Public Member Functions

 Precondition ()
 Precondition (const Context &context, severity_t s, const char *condition, const std::string &message, bool constant_expression=false)
virtual const char * get_class_name () const 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.
bool operator== (const Issue &other) const throw ()
 Equality operator.
const std::stringoperator[] (const std::string &key) const throw ()
const std::stringget_value (const std::string &key, const std::string &def) const throw ()
 Reads the property list.
const std::stringget_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.
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::stringhuman_description () const throw ()
 Human description message.
const char * what () const throw ()
 Human description message.
const std::stringmessage () 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::stringqualifiers () const
 return array of qualifiers

Static Public Attributes

static const char *const PRECONDITION_CLASS = "ers::Precondition"
static const char *const ASSERT_CONDITION_KEY = "ASSERTION_CONDITION"
static const char *const CLASS_NAME = "ers::Assertion"
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

virtual std::string build_message (const char *condition_text, const std::string &message, bool constant_expression=false) throw ()
 Precondition (const Context &context, severity_t s)
void setup (const char *condition, const std::string &message, bool constant_expression)
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.
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.

Static Protected Attributes

static const char *const MESSAGE_ELEMENTS [] = { "Assertion '", "' failed: ", " (this condition is constant)" }

Detailed Description

Precondition issue.

A precondition is a special type of assertion that checks the entry condition for a function. Typically, precondition check entry values for function, and members state in object methods

Author:
Matthias Wiesmann
Version:
1.0

Definition at line 24 of file Precondition.h.


Constructor & Destructor Documentation

ers::Precondition::Precondition ( const Context c,
severity_t  s 
) [protected]

Constructor used by subclasses

Parameters:
c context of the issue
s severity_t of the issue
c context of the issue

Definition at line 32 of file Precondition.cxx.

00032 : Assertion(c,s) {}  

ers::Precondition::Precondition (  ) 

Constructor used by deserialisation

Definition at line 24 of file Precondition.cxx.

00024 : Assertion() {} 

ers::Precondition::Precondition ( const Context context,
severity_t  s,
const char *  condition,
const std::string msg,
bool  constant_expression = false 
)

Main constructor, it should be used for building Precondition Issues

Parameters:
context context of the issue
s severity_t of the issue
condition text of the condition of the precondition
msg message for condition
constant_expression does compiler think expression is constant

Definition at line 42 of file Precondition.cxx.

References ers::Assertion::setup().

00042                                                                                                                                          : Assertion(context,s) {
00043     this->setup(condition,msg,constant_expression); 
00044 } // Precondition


Member Function Documentation

void Issue::add_qualifier ( const std::string qualif  )  [inherited]

adds a qualifier to the issue

Add a qualifier to the qualifier list

Parameters:
qualif the qualifier to add

Definition at line 703 of file Issue.cxx.

References ers::Issue::get_value(), RealDBUtil::npos, boss::pos, ers::Issue::QUALIFIER_LIST_KEY, ers::Issue::set_value(), and deljobs::string.

00703                                                  {
00704     const std::string &qualif_s = get_value(QUALIFIER_LIST_KEY) ; 
00705     std::string::size_type pos = qualif_s.find(qualif);
00706     if (pos!=std::string::npos) return ; // already present
00707     std::string n_qualif = qualif_s+qualif + " " ; 
00708     set_value(QUALIFIER_LIST_KEY,n_qualif); 
00709 } // add_qualifier

std::string ers::Precondition::build_message ( const char *  condition_text,
const std::string msg,
bool  constant_expression = false 
) throw () [protected, virtual]

Builds the message associated with an assertion

Parameters:
condition_text the condition in textual form
msg the message associated with the condition
constant_expression is the condition constant (as detected by compiler).
Returns:
message describing the failure of the assertion

Reimplemented from ers::Assertion.

Definition at line 57 of file Precondition.cxx.

00057                                                                                                                            {
00058     std::ostringstream m ;
00059     m << "Precondition '" << condition_text << "' failed: " << msg ;
00060     if (constant_expression) {
00061         m << " (this condition is constant)" ; 
00062     } // constant expression 
00063     return m.str();
00064 } // build_message

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

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:
c pointer to the cause exception

Definition at line 252 of file Issue.cxx.

References ers::Issue::CAUSE_TEXT_KEY, genRecEmupikp::i, ers::Issue::m_cause, and ers::Issue::set_value().

00252                                        {
00253     if (c==0) {
00254         m_cause = 0 ; 
00255         return ; 
00256     } // No cause easy. 
00257     const Issue *i = dynamic_cast<const Issue *>(c) ; 
00258     if (i) {
00259         m_cause = i->clone(); 
00260     } else {
00261         m_cause = 0 ; 
00262     } // if
00263     set_value(CAUSE_TEXT_KEY,c->what()); 
00264 } // cause

const Issue * Issue::cause (  )  const throw () [inherited]

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 Issue.cxx.

References ers::Issue::m_cause.

Referenced by ers::Issue::Issue().

00240                                         {
00241     return m_cause ; 
00242 } // cause

Issue * Issue::clone (  )  const [inherited]

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 Issue.cxx.

References ers::IssueFactory::build(), and ers::IssueFactory::instance().

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

00160                           { 
00161     return IssueFactory::instance()->build(this) ; 
00162 } // clone

int Issue::exit_value (  )  const throw () [virtual, inherited]

value to pass to exit

Definition at line 693 of file Issue.cxx.

References ers::Issue::EXIT_VALUE_KEY, ers::Issue::get_int_value(), ers::Issue::transience(), and v.

00693                                     {
00694     int v = 1 ; 
00695     if (transience()==1) v = EX_TEMPFAIL ; 
00696     return get_int_value(EXIT_VALUE_KEY,v); 
00697 } // exit_value

void Issue::finish_setup ( const std::string msg  )  throw () [protected, inherited]

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:
message human readable message
Note:
All method used within this method should throw no exceptions to avoid circular problems.

Definition at line 568 of file Issue.cxx.

Referenced by eformat::BadVersionIssue::BadVersionIssue(), ers::EntityNotFoundIssue::EntityNotFoundIssue(), ExampleIssue::ExampleIssue(), ers::InvalidReferenceIssue::InvalidReferenceIssue(), ers::Issue::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(), ers::Assertion::setup(), eformat::SizeCheckIssue::SizeCheckIssue(), eformat::TooBigCountIssue::TooBigCountIssue(), eformat::UnboundSourceIdentifierIssue::UnboundSourceIdentifierIssue(), eformat::WrongMarkerIssue::WrongMarkerIssue(), and eformat::WrongSizeIssue::WrongSizeIssue().

00568                                                      {
00569     // set_value(CPP_CLASS_KEY,class_name); 
00570     set_value(CLASS_KEY, get_class_name()) ;
00571     set_value(MESSAGE_KEY,msg); 
00572 } // finish_setup

const char * ers::Precondition::get_class_name (  )  const throw () [virtual]

Returns:
name key for the class

Reimplemented from ers::Assertion.

Definition at line 48 of file Precondition.cxx.

References PRECONDITION_CLASS.

00048 { return PRECONDITION_CLASS ;} 

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

Get a value of the table as double.

Get a property of an issue as an double

Parameters:
key the key to search for
def the 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 Issue.cxx.

References ers::Issue::get_value(), deljobs::string, and v.

00344                                                                                     {
00345     std::string v = get_value(key) ;      
00346     if (! v.empty()) { // not empty 
00347         std::istringstream in(v) ;
00348         double n ; 
00349         in >> n ;
00350         return n ; 
00351         // return atoi(v.c_str());
00352     } else { // empty 
00353         return def ; 
00354     } // empty     
00355 } // get_double_value

int Issue::get_int_value ( const std::string key,
int  def = 0 
) const throw () [inherited]

Get a value of the table as an integer.

Get a property of an issue as an integer

Parameters:
key the key to search for
def the value to return if key is not found
Returns:
value of key or def

Definition at line 305 of file Issue.cxx.

References key, deljobs::string, and v.

Referenced by eformat::SizeCheckIssue::actual(), eformat::TooBigCountIssue::count(), eformat::WrongMarkerIssue::current(), eformat::BadVersionIssue::current(), ers::Issue::exit_value(), eformat::WrongMarkerIssue::expected(), eformat::SizeCheckIssue::informed(), eformat::TooBigCountIssue::max_count(), eformat::OutOfBoundsIssue::pos(), ExampleIssue::procrastination_level(), eformat::NoSuchChildIssue::requested(), eformat::WrongSizeIssue::size(), eformat::OutOfBoundsIssue::size(), eformat::NotAlignedIssue::size(), eformat::UnboundSourceIdentifierIssue::source_id(), eformat::BadVersionIssue::supported(), and eformat::NoSuchChildIssue::total().

00305                                                                     {
00306     std::string v = get_value(key) ;      
00307     if (! v.empty()) { // not empty 
00308         std::istringstream in(v) ;
00309         int n ; 
00310         in >> n ;
00311         return n ; 
00312         // return atoi(v.c_str());
00313     } else { // empty 
00314         return def ; 
00315     } // empty 
00316 } // get_int_value

long Issue::get_long_value ( const std::string key,
long  def = 0 
) const throw () [inherited]

Get a value of the table as a long integer.

Get a property of an issue as an long

Parameters:
key the key to search for
def the value to return if key is not found
Returns:
value of key or def

Definition at line 325 of file Issue.cxx.

References key, deljobs::string, and v.

00325                                                                        {
00326     std::string v = get_value(key) ;      
00327     if (! v.empty()) { // not empty 
00328         std::istringstream in(v) ;
00329         long n ; 
00330         in >> n ;
00331         return n ; 
00332         // return atoi(v.c_str());
00333     } else { // empty 
00334         return def ; 
00335     } // empty 
00336 } // get_long_value

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

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 Issue.cxx.

References ers::Core::empty_string, and key.

00294                                                                     {
00295     return get_value(key,Core::empty_string) ; 
00296 } // get_value

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

Reads the property list.

General method for querying properties of the Issue

Parameters:
key the 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 Issue.cxx.

References key, and boss::pos.

Referenced by ers::Issue::add_qualifier(), eformat::NotAlignedIssue::base(), ers::Issue::get_double_value(), ers::FilterStream::is_accept(), ers::Issue::message(), eformat::UnboundSourceIdentifierIssue::my_context(), ers::Issue::qualifiers(), ers::Issue::responsibility(), ers::HumanStream::send(), ers::DefaultStream::send(), ers::Issue::severity(), ers::Issue::severity_message(), and ers::Issue::transience().

00283                                                                                           {
00284     string_map_type::const_iterator pos = m_value_table.find(key);
00285     if (pos!=m_value_table.end()) {
00286         return pos->second ; 
00287     } // if
00288     return def ; 
00289 } // get_value

const string_map_type * Issue::get_value_table (  )  const [inherited]

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 Issue.cxx.

References ers::Issue::m_value_table.

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

00274                                                     {
00275     return &m_value_table ; 
00276 } // get_value_table

const std::string & Issue::human_description (  )  const throw () [inherited]

Human description message.

Returns:
human description of the Issue

Definition at line 672 of file Issue.cxx.

References ers::Issue::m_human_description, and ers::HumanStream::to_string().

Referenced by ers::Issue::operator std::string(), and ers::Issue::what().

00672                                                          {
00673     if (m_human_description.empty()) {
00674          m_human_description = HumanStream::to_string(this) ; 
00675     } 
00676     return m_human_description ; 
00677 }  // human_description

void Issue::insert ( const Context context  )  throw () [protected, inherited]

Inserts the context.

Inserts the context of the issue into the issue

Parameters:
context pointer to context object

Definition at line 481 of file Issue.cxx.

References ers::Context::debug_level(), genRecEmupikp::i, and boss::pos.

00481                                                  {
00482     if (context) {
00483         set_value(SOURCE_POSITION_KEY,context->position()) ; 
00484         set_value(SOURCE_PACKAGE_KEY,context->package_name()); 
00485         set_value(COMPILER_KEY,context->compiler()) ; 
00486         set_value(COMPILATION_TIME_KEY,context->compilation()) ; 
00487         set_value(COMPILATION_TARGET_KEY,context->host_type()) ; 
00488         int lvl = ers::Context::debug_level();
00489         if (lvl>=0) {
00490             set_value(COMPILATION_DEBUG_LVL_KEY,lvl); 
00491         } // if
00492         int frame_number = context->stack_frames();
00493         for(int i=0;i<frame_number;i++) {
00494             char key_buffer[256] ; 
00495             snprintf(key_buffer,sizeof(key_buffer),"SOURCE-STACK-%03x",i);
00496             set_value(key_buffer,context->stack_frame(i)); 
00497         } // for
00498         std::vector<std::string> qualifs = context->qualifiers() ;
00499         std::vector<std::string>::const_iterator pos ; 
00500         for(pos=qualifs.begin();pos!=qualifs.end();pos++) {
00501             add_qualifier(*pos) ; 
00502         } // for
00503     } // if context 
00504 } // insert

void Issue::insert_time (  )  throw () [protected, inherited]

Inserts current time.

Inserts the current time into the issue

Definition at line 509 of file Issue.cxx.

References BUFFER_SIZE, ers::Issue::set_value(), and ers::Issue::TIME_KEY.

00509                                 {
00510     time_t now ;
00511     time(&now); 
00512     char time_buffer[BUFFER_SIZE] ; 
00513     ctime_r(&now,time_buffer) ; 
00514     char *cr = strchr(time_buffer,'\n');
00515     if (cr) {
00516         *cr = '\0' ;
00517     } // carriage return 
00518     set_value(TIME_KEY,time_buffer); 
00519 } // insert_time

bool Issue::is_error (  )  [inherited]

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 Issue.cxx.

References ers::error, ers::fatal, s, and ers::Issue::severity().

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

00619                      {
00620     severity_t s = severity(); 
00621     return (s==ers::error || s== ers::fatal) ;
00622 } // is_error

const std::string & Issue::message (  )  const throw () [inherited]

Message.

Definition at line 689 of file Issue.cxx.

References ers::Issue::get_value(), and ers::Issue::MESSAGE_KEY.

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

00689                                               {
00690     return get_value(MESSAGE_KEY) ; 
00691 } // message

Issue::operator std::string (  )  const [inherited]

Converts the issue into a string.

Definition at line 165 of file Issue.cxx.

References ers::Issue::human_description(), s, and deljobs::string.

00165                                 {
00166     std::string s = human_description();
00167     return s ;
00168 } // std::string()

bool Issue::operator== ( const Issue other  )  const throw () [inherited]

Equality operator.

Comparison operator

Parameters:
other issue to compare to
Returns:
true if this and other are equal

Definition at line 186 of file Issue.cxx.

References false, EvtCyclic3::other(), and true.

00186                                                        {
00187     if (m_value_table != other.m_value_table) return false ; 
00188     if (m_cause == other.m_cause) return true ; 
00189     return (*m_cause) == *(other.m_cause) ; 
00190 } // operator==

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

Array access operator

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

Definition at line 198 of file Issue.cxx.

References key.

00198                                                                       {
00199     return get_value(key,"");
00200 } // operator[]

std::vector< std::string > Issue::qualifiers (  )  const [inherited]

return array of qualifiers

Gets the list of qualifiers

Returns:
list of qualifiers

Definition at line 715 of file Issue.cxx.

References ers::Issue::get_value(), ers::Issue::QUALIFIER_LIST_KEY, deljobs::string, and ers::Core::tokenize().

00715                                              {
00716     const std::string &qualif_s = get_value(QUALIFIER_LIST_KEY) ; 
00717     return ers::Core::tokenize(qualif_s,", \t"); 
00718 } // qualifiers

responsibility_t Issue::responsibility (  )  const throw () [inherited]

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 Issue.cxx.

References ers::Issue::get_value(), ers::Core::parse_responsibility(), ers::Issue::RESPONSIBILITY_KEY, and deljobs::string.

Referenced by ers::InvalidReferenceIssue::InvalidReferenceIssue(), and ers::Assertion::setup().

00637                                                       {
00638     std::string value = this->get_value(RESPONSIBILITY_KEY); 
00639     return ers::Core::parse_responsibility(value);
00640 } // responsability

void Issue::responsibility ( responsibility_t  r  )  [inherited]

set the responsability of the issue

Sets the responsbility of the Issue

Parameters:
r the responsibility type

Definition at line 646 of file Issue.cxx.

References ers::Issue::RESPONSIBILITY_KEY, ers::Issue::set_value(), and ers::Core::to_string().

00646                                               {
00647     set_value(RESPONSIBILITY_KEY,ers::Core::to_string(r)) ; 
00648 } // responsability

void Issue::set_value ( const std::string key,
const void *  ptr 
) throw () [inherited]

Sets a pointer in the value table

Parameters:
key the key to use for insertion
ptr a pointer
Note:
the pointer is stored in hex format

Definition at line 457 of file Issue.cxx.

00457                                                                    {
00458     std::ostringstream stream ;
00459     stream.setf(std::ios::hex,std::ios::basefield); 
00460     stream << (unsigned long) ptr ; 
00461     m_value_table[key] = stream.str();
00462 } // set_value

void Issue::set_value ( const std::string key,
const char *  value 
) throw () [inherited]

Sets a value (c-string).

Sets a string value in the value table

Parameters:
key the key to use for insertion
value c-string, null pointer is ignored.

Definition at line 444 of file Issue.cxx.

References deljobs::string.

00444                                                                      {
00445     if (value) {
00446         std::string value_str = std::string(value) ; 
00447         set_value(key,value_str); 
00448     } // if 
00449 } // set_value

void Issue::set_value ( const std::string key,
const std::string value 
) throw () [inherited]

Sets a value (string).

Sets a string value in the value table

Parameters:
key the key to use for insertion
value the value to insert

Definition at line 433 of file Issue.cxx.

00433                                                                           {
00434     if (! value.empty()) {
00435         m_value_table[key] = value ;
00436     }
00437 } // set_value

void Issue::set_value ( const std::string key,
double  value 
) throw () [inherited]

Sets a value (double float).

Set a numerical value in the value table

Parameters:
key the key to use for insertion
value the value to insert

Definition at line 422 of file Issue.cxx.

00422                                                                 {
00423     std::ostringstream stream ;
00424     stream << value ; 
00425     m_value_table[key] = stream.str();
00426 } // set_value

void Issue::set_value ( const std::string key,
int64_t  value 
) throw () [inherited]

Definition at line 413 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00413                                                                  {
00414     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00415 } // set_value

void Issue::set_value ( const std::string key,
int32_t  value 
) throw () [inherited]

Definition at line 407 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00407                                                                  {
00408     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00409 } // set_value

void Issue::set_value ( const std::string key,
int16_t  value 
) throw () [inherited]

Definition at line 401 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00401                                                                  {
00402     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00403 } // set_value

void Issue::set_value ( const std::string key,
int8_t  value 
) throw () [inherited]

Definition at line 395 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00395                                                                 {
00396     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00397 } // set_value

void Issue::set_value ( const std::string key,
uint64_t  value 
) throw () [inherited]

Definition at line 389 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00389                                                                   {
00390     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00391 } // set_value

void Issue::set_value ( const std::string key,
uint32_t  value 
) throw () [inherited]

Definition at line 383 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00383                                                                   {
00384     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00385 } // set_value

void Issue::set_value ( const std::string key,
uint16_t  value 
) throw () [inherited]

Definition at line 377 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

00377                                                                   {
00378     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00379 } // set_value

void Issue::set_value ( const std::string key,
uint8_t  value 
) throw () [inherited]

Sets a value 8 bit unsigned.

Set a numerical value in the value table

Parameters:
key the key to use for insertion
value the value to insert

Definition at line 371 of file Issue.cxx.

References ISSUE_VALUE_SET_SCALAR.

Referenced by ers::Issue::add_qualifier(), eformat::BadVersionIssue::BadVersionIssue(), ers::Issue::cause(), ers::EntityNotFoundIssue::EntityNotFoundIssue(), ExampleIssue::ExampleIssue(), ers::Issue::insert_time(), eformat::NoSuchChildIssue::NoSuchChildIssue(), eformat::NotAlignedIssue::NotAlignedIssue(), ers::ParseIssue::offending_line_number(), eformat::OutOfBoundsIssue::OutOfBoundsIssue(), ers::InvalidReferenceIssue::pointer(), ers::RangeIssue::RangeIssue(), ers::Issue::responsibility(), ers::RangeIssue::set_range(), ers::Assertion::setup(), ers::Issue::severity(), eformat::SizeCheckIssue::SizeCheckIssue(), eformat::TooBigCountIssue::TooBigCountIssue(), ers::Issue::transience(), eformat::UnboundSourceIdentifierIssue::UnboundSourceIdentifierIssue(), eformat::WrongMarkerIssue::WrongMarkerIssue(), and eformat::WrongSizeIssue::WrongSizeIssue().

00371                                                                  {
00372     ISSUE_VALUE_SET_SCALAR(m_value_table,key,value); 
00373 } // set_value

void Issue::set_values ( const string_map_type values  )  throw () [protected, inherited]

sets the value table

Sets the value table

Parameters:
values the value table to load

Definition at line 362 of file Issue.cxx.

Referenced by ers::Issue::Issue().

00362                                                             {
00363     m_value_table = values ;
00364 } // load_values

void ers::Assertion::setup ( const char *  condition_text,
const std::string msg,
bool  constant_expression 
) [protected, inherited]

Setup method, should be called at the end of the constructor by class and subclasses

Definition at line 56 of file Assertion.cxx.

References ers::Assertion::ASSERT_CONDITION_KEY, ers::Assertion::build_message(), ers::Issue::EXIT_VALUE_KEY, ers::Issue::finish_setup(), ers::Issue::m_value_table, ers::resp_server, ers::Issue::responsibility(), ers::Issue::set_value(), and ers::Issue::transience().

Referenced by ers::Assertion::Assertion(), ers::NotImplemented::NotImplemented(), and Precondition().

00056                                                                                                     {
00057     m_value_table[ASSERT_CONDITION_KEY] = *condition_text ;
00058     responsibility(resp_server); 
00059     set_value(EXIT_VALUE_KEY,EX_SOFTWARE);
00060     transience( ! constant_expression); 
00061     finish_setup(build_message(condition_text,msg,constant_expression));
00062 } // setup

void Issue::setup_common ( const Context context  )  throw () [protected, inherited]

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

Parameters:
context context 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 Issue.cxx.

Referenced by ers::Issue::Issue().

00535                                                        {
00536     const int errno_copy = errno ; // We need to save errno, because it might be changed 
00537     insert(context);
00538     insert_time();
00539     errno = errno_copy ; // we restaure errno 
00540 } // setup_common

void Issue::severity ( severity_t  s  )  [inherited]

sets the severity_t of the issue

Set the severity_t of the Issue

Parameters:
s the severity_t level

Definition at line 611 of file Issue.cxx.

References ers::Issue::set_value(), ers::Issue::SEVERITY_KEY, and ers::Core::to_string().

00611                                  {
00612     set_value(SEVERITY_KEY,ers::Core::to_string(s)); 
00613 } // severity

severity_t Issue::severity (  )  const throw () [inherited]

severity_t of the issue

Gets the severity_t of the Issue

Returns:
severity_t of the Issue

Definition at line 602 of file Issue.cxx.

References ers::Issue::get_value(), ers::Core::parse_severity(), ers::Issue::SEVERITY_KEY, and deljobs::string.

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

00602                                          {
00603     std::string value = get_value(SEVERITY_KEY); 
00604     return ers::Core::parse_severity(value);
00605 } // severity

std::string Issue::severity_message (  )  const [inherited]

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 Issue.cxx.

References ers::Issue::get_value(), and ers::Issue::SEVERITY_KEY.

00628                                         {
00629     return get_value(SEVERITY_KEY);  
00630 } // severity_message

int Issue::transience (  )  const throw () [inherited]

is the issue transient

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

Definition at line 662 of file Issue.cxx.

References ers::Issue::get_value(), ers::Core::parse_boolean(), deljobs::string, and ers::Issue::TRANSIENCE_KEY.

Referenced by ers::Issue::exit_value(), and ers::Assertion::setup().

00662                                      {
00663     std::string value = this->get_value(TRANSIENCE_KEY); 
00664     return ers::Core::parse_boolean(value.c_str());
00665 } // transience

void Issue::transience ( bool  tr  )  [inherited]

sets if the issue is transient

Sets the transience of the issue

Parameters:
tr true if the issue is transient, false if not

Definition at line 655 of file Issue.cxx.

References ers::Issue::set_value(), ers::Core::to_string(), and ers::Issue::TRANSIENCE_KEY.

00655                               {
00656     set_value(TRANSIENCE_KEY,ers::Core::to_string(tr)) ; 
00657 } // transience

int Issue::values_number (  )  const [inherited]

How many key / values.

Returns:
the number of key/value pairs in the issue

Definition at line 469 of file Issue.cxx.

References ers::Issue::m_value_table.

00469                                {
00470     return m_value_table.size(); 
00471 } // values_number

const char * Issue::what (  )  const throw () [inherited]

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 Issue.cxx.

References ers::Issue::human_description(), and deljobs::string.

Referenced by EFEventLoopMgr::executeEvent(), main(), MixerAlg::nextEvent(), and RawDataInputSvc::nextEvent().

00684                                       {
00685     std::string desr = human_description() ; 
00686     return desr.c_str(); 
00687 } // what();  


Member Data Documentation

const char *const ers::Assertion::ASSERT_CONDITION_KEY = "ASSERTION_CONDITION" [static, inherited]

Key for assertion condition description

Definition at line 39 of file Assertion.h.

Referenced by ers::Assertion::setup().

const char *const Issue::CAUSE_PSEUDO_KEY = "CAUSE" [static, inherited]

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

Definition at line 66 of file Issue.h.

const char *const Issue::CAUSE_TEXT_KEY = "CAUSE_TEXT" [static, inherited]

key used to store the cause issue's message

Definition at line 67 of file Issue.h.

Referenced by ers::Issue::cause().

const char *const Issue::CLASS_KEY = "ISSUE_CLASS" [static, inherited]

key for class information

Definition at line 44 of file Issue.h.

const char *const ers::Assertion::CLASS_NAME = "ers::Assertion" [static, inherited]

Reimplemented in ers::NotImplemented.

Definition at line 40 of file Assertion.h.

Referenced by ers::Assertion::get_class_name().

const char *const Issue::COMPILATION_DEBUG_LVL_KEY = "COMPILATION_DEBUG_LVL" [static, inherited]

Definition at line 48 of file Issue.h.

const char *const Issue::COMPILATION_TARGET_KEY = "COMPILATION_TARGET" [static, inherited]

key for compilation target

Definition at line 46 of file Issue.h.

const char *const Issue::COMPILATION_TIME_KEY = "COMPILATION_TIME" [static, inherited]

key for compilation time

Definition at line 45 of file Issue.h.

const char *const Issue::COMPILER_KEY = "COMPILER" [static, inherited]

key for compilator type

Definition at line 47 of file Issue.h.

const char *const Issue::CPP_CLASS_KEY = "ISSUE_CPP_CLASS" [static, inherited]

key for c++ class (might be mangled)

Definition at line 49 of file Issue.h.

const char *const Issue::ERS_VERSION_KEY = "ERS_VERSION" [static, inherited]

key for ERS version

Definition at line 50 of file Issue.h.

const char *const Issue::EXIT_VALUE_KEY = "EXIT_VALUE" [static, inherited]

key used to store the exit value

Definition at line 69 of file Issue.h.

Referenced by ers::Issue::exit_value(), and ers::Assertion::setup().

const char *const Issue::HOST_IP_ADDR_KEY = "HOST_IP" [static, inherited]

key for host ip address

Definition at line 53 of file Issue.h.

const char *const Issue::HOST_NAME_KEY = "HOST_NAME" [static, inherited]

key for hostname

Definition at line 51 of file Issue.h.

const char *const Issue::HOST_TYPE_KEY = "HOST_TYPE" [static, inherited]

key for host type (architecture / os)

Definition at line 52 of file Issue.h.

const char *const Issue::ISSUE_CLASS_NAME = "ers::issue" [static, inherited]

name of the class, used for serialisation

Definition at line 70 of file Issue.h.

Referenced by ers::Issue::get_class_name().

Issue* ers::Issue::m_cause [protected, inherited]

Issue that caused the current issue.

Definition at line 73 of file Issue.h.

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

std::string ers::Issue::m_class_name [mutable, protected, inherited]

class name

Definition at line 74 of file Issue.h.

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

std::string ers::Issue::m_human_description [mutable, protected, inherited]

Human readable description (cache).

Definition at line 75 of file Issue.h.

Referenced by ers::Issue::human_description(), and ers::Issue::Issue().

string_map_type ers::Issue::m_value_table [protected, inherited]

Optional properties.

Definition at line 76 of file Issue.h.

Referenced by ers::ParseIssue::file_name(), ers::Issue::get_value_table(), ers::Issue::Issue(), ers::ParseIssue::offending_line(), ers::Assertion::setup(), and ers::Issue::values_number().

const char *const ers::Assertion::MESSAGE_ELEMENTS = { "Assertion '", "' failed: ", " (this condition is constant)" } [static, protected, inherited]

Definition at line 37 of file Assertion.h.

const char *const Issue::MESSAGE_KEY = "MESSAGE" [static, inherited]

key for human readable

Definition at line 54 of file Issue.h.

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

const char *const ers::Precondition::PRECONDITION_CLASS = "ers::Precondition" [static]

Definition at line 29 of file Precondition.h.

Referenced by get_class_name().

const char *const Issue::PROCESS_ID_KEY = "PROCESS_ID" [static, inherited]

key for the process id (number)

Definition at line 55 of file Issue.h.

const char *const Issue::PROCESS_PWD_KEY = "PROCESS_PWD" [static, inherited]

key for the process working directory

Definition at line 56 of file Issue.h.

const char *const Issue::PROGRAM_NAME_KEY = "PROGRAM_NAME" [static, inherited]

key for the name of the program

Definition at line 57 of file Issue.h.

const char *const Issue::QUALIFIER_LIST_KEY = "QUALIFIERS" [static, inherited]

key used to store the qualifier list

Ê

Definition at line 68 of file Issue.h.

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

const char *const Issue::RESPONSIBILITY_KEY = "RESPONSIBILITY" [static, inherited]

key for the responsibility of the issue (text)

Definition at line 58 of file Issue.h.

Referenced by ers::Issue::responsibility().

const char *const Issue::SEVERITY_KEY = "SEVERITY" [static, inherited]

key for the severity_t of the issue

Definition at line 59 of file Issue.h.

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

const char *const Issue::SOURCE_PACKAGE_KEY = "SOURCE_PACKAGE" [static, inherited]

package name associated with source code

Definition at line 61 of file Issue.h.

const char *const Issue::SOURCE_POSITION_KEY = "SOURCE_POSITION" [static, inherited]

key for position in the source code

 

Definition at line 60 of file Issue.h.

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

const char *const Issue::TIME_KEY = "TIME" [static, inherited]

key for the time of the issue (text)

Definition at line 62 of file Issue.h.

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

const char *const Issue::TRANSIENCE_KEY = "TRANSIENCE" [static, inherited]

key for the transience of the issue (text)

Definition at line 63 of file Issue.h.

Referenced by ers::Issue::transience().

const char *const Issue::USER_ID_KEY = "USER_ID" [static, inherited]

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

Definition at line 64 of file Issue.h.

const char *const Issue::USER_NAME_KEY = "USER_NAME" [static, inherited]

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

Definition at line 65 of file Issue.h.


Generated on Tue Nov 29 23:36:32 2016 for BOSS_7.0.2 by  doxygen 1.4.7