BOSS
7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
InvalidReferenceIssue.cxx
Go to the documentation of this file.
1
/*
2
* InvalidReferenceIssue.cxx
3
* ers
4
*
5
* Created by Matthias Wiesmann on 04.01.05.
6
* Copyright 2005 CERN. All rights reserved.
7
*
8
*/
9
10
#include "
ers/InvalidReferenceIssue.h
"
11
#include <sstream>
12
#include <cstdio>
13
14
const
char
*
const
ers::InvalidReferenceIssue::CLASS_NAME
=
"ers::InvalidReferenceIssue"
;
15
16
const
char
*
const
ers::InvalidReferenceIssue::REFERENCE_VALUE_KEY
=
"REFERENCE_VALUE"
;
17
const
char
*
const
ers::InvalidReferenceIssue::REFERENCE_TYPE_KEY
=
"REFERENCE_TYPE"
;
18
const
char
*
const
ers::InvalidReferenceIssue::REFERENCE_NAME_KEY
=
"REFERENCE_NAME"
;
19
const
char
*
const
ers::InvalidReferenceIssue::REFERENCE_C_PTR_TYPE
=
"C Pointer"
;
20
21
namespace
{
22
ers::Issue
*create_issue() {
return
new
ers::InvalidReferenceIssue
(); }
23
bool
registered =
ers::IssueFactory::instance
()->
register_issue
(
ers::InvalidReferenceIssue::CLASS_NAME
,create_issue) ;
24
}
// anonymous context
25
26
ers::InvalidReferenceIssue::InvalidReferenceIssue
() :
Issue
() {}
27
28
ers::InvalidReferenceIssue::InvalidReferenceIssue
(
const
Context
&context,
severity_t
s
) :
Issue
(context,
s
) {}
29
30
ers::InvalidReferenceIssue::InvalidReferenceIssue
(
const
Context
&context,
severity_t
s
,
const
void
* p,
const
std::string &msg,
responsibility_t
r) :
Issue
(context,
s
) {
31
severity
(
s
);
32
pointer
(p);
33
responsibility
(r) ;
34
finish_setup
(msg);
35
}
// InvalidReferenceIssue
36
37
38
const
char
*
ers::InvalidReferenceIssue::get_class_name
()
const
throw() {
39
return
ers::InvalidReferenceIssue::CLASS_NAME
;
40
}
// get_class_name
41
42
43
void
ers::InvalidReferenceIssue::pointer
(
const
void
*p) {
44
char
buffer[
sizeof
(
void
*)+1] ;
// space needed to print a pointer
45
snprintf(buffer,
sizeof
(buffer),
"%p"
,p);
46
set_value(REFERENCE_VALUE_KEY,buffer) ;
47
set_value(REFERENCE_TYPE_KEY,REFERENCE_C_PTR_TYPE) ;
48
}
// pointer
49
50
void
ers::InvalidReferenceIssue::check_reference
(
const
Context
&context,
severity_t
s
,
const
void
* p,
const
char
* ptr_name,
responsibility_t
r) {
51
if
(p==0) {
52
std::ostringstream message ;
53
message <<
"pointer '"
<< ptr_name <<
"' is null"
;
54
ers::InvalidReferenceIssue
issue(context,
s
,p,message.str(),r) ;
55
issue.
m_value_table
[REFERENCE_NAME_KEY] = ptr_name ;
56
throw
issue ;
57
}
// if
58
}
// check
59
60
61
62
s
XmlRpcServer s
Definition
HelloServer.cpp:11
InvalidReferenceIssue.h
ers::Context
Source context for Issue.
Definition
Context.h:42
ers::InvalidReferenceIssue
Invalid pointer issue.
Definition
InvalidReferenceIssue.h:26
ers::InvalidReferenceIssue::REFERENCE_C_PTR_TYPE
static const char *const REFERENCE_C_PTR_TYPE
Definition
InvalidReferenceIssue.h:35
ers::InvalidReferenceIssue::CLASS_NAME
static const char *const CLASS_NAME
Definition
InvalidReferenceIssue.h:31
ers::InvalidReferenceIssue::InvalidReferenceIssue
InvalidReferenceIssue()
Definition
InvalidReferenceIssue.cxx:26
ers::InvalidReferenceIssue::pointer
void pointer(const void *p)
Definition
InvalidReferenceIssue.cxx:43
ers::InvalidReferenceIssue::REFERENCE_NAME_KEY
static const char *const REFERENCE_NAME_KEY
Definition
InvalidReferenceIssue.h:34
ers::InvalidReferenceIssue::get_class_name
virtual const char * get_class_name() const
Get key for class (used for serialisation)
Definition
InvalidReferenceIssue.cxx:38
ers::InvalidReferenceIssue::REFERENCE_TYPE_KEY
static const char *const REFERENCE_TYPE_KEY
Definition
InvalidReferenceIssue.h:33
ers::InvalidReferenceIssue::check_reference
static void check_reference(const Context &context, severity_t s, const void *pointer, const char *ptr_name, responsibility_t r)
Definition
InvalidReferenceIssue.cxx:50
ers::InvalidReferenceIssue::REFERENCE_VALUE_KEY
static const char *const REFERENCE_VALUE_KEY
Definition
InvalidReferenceIssue.h:32
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::Issue::responsibility
responsibility_t responsibility() const
get the responsability level of the issue
Definition
ers/ers-00-00-03/src/Issue.cxx:637
ers::Issue::severity
severity_t severity() const
severity_t of the issue
Definition
ers/ers-00-00-03/src/Issue.cxx:602
ers::Issue::finish_setup
void finish_setup(const std::string &message)
Finishes the setup of the Issue.
Definition
ers/ers-00-00-03/src/Issue.cxx:568
ers::Issue::m_value_table
string_map_type m_value_table
Optional properties.
Definition
ers/ers-00-00-03/ers/Issue.h:76
ers::responsibility_t
enum ers::_responsibility_t responsibility_t
ers::severity_t
enum ers::_severity_t severity_t
7.1.2
Event
ers
ers-00-00-03
src
InvalidReferenceIssue.cxx
Generated by
1.12.0