CGEM BOSS
6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
Precondition.cxx
Go to the documentation of this file.
1
/*
2
* Precondition.cxx
3
* ers
4
*
5
* Created by Matthias Wiesmann on 08.12.04.
6
* Copyright 2004 CERN. All rights reserved.
7
*
8
*/
9
10
#include "
ers/Precondition.h
"
11
#include <iostream>
12
#include <sstream>
13
14
const
char
*
const
ers::Precondition::PRECONDITION_CLASS
=
"ers::Precondition"
;
15
16
namespace
{
17
ers::Issue
*create_issue() {
return
new
ers::Precondition
(); }
18
bool
registered =
ers::IssueFactory::instance
()->
register_issue
(
ers::Precondition::PRECONDITION_CLASS
,create_issue) ;
19
}
// anonymous context
20
21
/** Constructor used by deserialisation
22
*/
23
24
ers::Precondition::Precondition
() :
Assertion
() {}
25
26
/** Constructor used by subclasses
27
* \param c context of the issue
28
* \param s severity_t of the issue
29
* \param c context of the issue
30
*/
31
32
ers::Precondition::Precondition
(
const
Context
&c,
severity_t
s
) :
Assertion
(c,
s
) {}
33
34
/** Main constructor, it should be used for building Precondition Issues
35
* \param context context of the issue
36
* \param s severity_t of the issue
37
* \param condition text of the condition of the precondition
38
* \param msg message for condition
39
* \param constant_expression does compiler think expression is constant
40
*/
41
42
ers::Precondition::Precondition
(
const
Context
&context,
severity_t
s
,
const
char
*condition,
const
std::string &msg ,
bool
constant_expression) :
Assertion
(context,
s
) {
43
this->
setup
(condition,msg,constant_expression);
44
}
// Precondition
45
46
/** \return name key for the class */
47
48
const
char
*
ers::Precondition::get_class_name
()
const
throw () {
return
PRECONDITION_CLASS ;}
49
50
/** Builds the message associated with an assertion
51
* \param condition_text the condition in textual form
52
* \param msg the message associated with the condition
53
* \param constant_expression is the condition constant (as detected by compiler).
54
* \return message describing the failure of the assertion
55
*/
56
57
std::string
ers::Precondition::build_message
(
const
char
* condition_text,
const
std::string &msg,
bool
constant_expression)
throw
() {
58
std::ostringstream m ;
59
m <<
"Precondition '"
<< condition_text <<
"' failed: "
<< msg ;
60
if
(constant_expression) {
61
m <<
" (this condition is constant)"
;
62
}
// constant expression
63
return
m.str();
64
}
// build_message
s
XmlRpcServer s
Definition
HelloServer.cpp:11
Precondition.h
ers::Assertion
This Issue represents a basic assertion.
Definition
Event/ers/ers-00-00-03/ers/Assertion.h:32
ers::Assertion::setup
void setup(const char *condition, const std::string &message, bool constant_expression)
Definition
Event/ers/ers-00-00-03/src/Assertion.cxx:56
ers::Context
Source context for Issue.
Definition
Context.h:42
ers::IssueFactory::register_issue
bool register_issue(const std::string &name, CreateIssueCallback creator)
register an issue factory
Definition
IssueFactory.cxx:47
ers::IssueFactory::instance
static IssueFactory * instance()
method to access singleton
Definition
IssueFactory.cxx:28
ers::Issue
Root Issue class.
Definition
ers/ers-00-00-03/ers/Issue.h:40
ers::Precondition
Precondition issue.
Definition
Precondition.h:24
ers::Precondition::Precondition
Precondition()
Definition
Precondition.cxx:24
ers::Precondition::build_message
virtual std::string build_message(const char *condition_text, const std::string &message, bool constant_expression=false)
Definition
Precondition.cxx:57
ers::Precondition::get_class_name
virtual const char * get_class_name() const
Definition
Precondition.cxx:48
ers::Precondition::PRECONDITION_CLASS
static const char *const PRECONDITION_CLASS
Definition
Precondition.h:29
ers::severity_t
enum ers::_severity_t severity_t
6.6.5.h
Event
ers
ers-00-00-03
src
Precondition.cxx
Generated by
1.12.0