BOSS
7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
InvalidReferenceIssue.h
Go to the documentation of this file.
1
/*
2
* InvalidReferenceIssue.h
3
* ers
4
*
5
* Created by Matthias Wiesmann on 04.01.05.
6
* Copyright 2005 CERN. All rights reserved.
7
*
8
*/
9
10
#ifndef ERS_INVALID_REFERENCE
11
#define ERS_INVALID_REFERENCE
12
13
#include "
ers/Issue.h
"
14
15
namespace
ers
{
16
17
/** This issue represents an invalid reference.
18
* This class can be used for any type of reference,
19
* but most of the present mechanisms are designed for C/C++ memory references,
20
* aka. pointers.
21
* \author Matthias Wiesmann
22
* \version 1.0
23
* \brief Invalid pointer issue.
24
*/
25
26
class
InvalidReferenceIssue
:
public
Issue
{
27
protected
:
28
void
pointer
(
const
void
*p);
29
InvalidReferenceIssue
(
const
Context
&context,
severity_t
s
) ;
30
public
:
31
static
const
char
*
const
CLASS_NAME
;
32
static
const
char
*
const
REFERENCE_VALUE_KEY
;
33
static
const
char
*
const
REFERENCE_TYPE_KEY
;
34
static
const
char
*
const
REFERENCE_NAME_KEY
;
35
static
const
char
*
const
REFERENCE_C_PTR_TYPE
;
36
InvalidReferenceIssue
() ;
37
InvalidReferenceIssue
(
const
Context
&context,
severity_t
s
,
const
void
*
pointer
,
const
std::string &
message
,
responsibility_t
r =
resp_unknown
) ;
38
virtual
const
char
*
get_class_name
()
const
throw() ;
39
static
void
check_reference
(const
Context
&context,
severity_t
s
, const
void
*
pointer
, const
char
* ptr_name,
responsibility_t
r);
40
} ;
// InvalidReferenceIssue
41
42
}
// ers
43
44
/** \def ERS_PRE_CHECK_PTR(p) checks that C/C++ pointer \c p is valid (non null) and throws an ers::InvalidReferenceIssue if not
45
* If the pointer is invalid, this is considered as a client responsibility.
46
* \note Do not use this to check constant pointers, as the check is compiled out if the pointer is constant
47
*/
48
49
#if (!defined(N_ERS_ASSERT))
50
#if (defined(__GNUC__))
51
#define ERS_PRE_CHECK_PTR(p) if (! __builtin_constant_p(p)) ers::InvalidReferenceIssue::check_reference(ERS_HERE,ers::error,p,#p,ers::resp_client) ;
52
#else
53
#define ERS_PRE_CHECK_PTR(p) ers::InvalidReferenceIssue::check_reference(ERS_HERE,ers::error,p,#p,ers::resp_client)
54
#endif
55
#else
56
#define ERS_PRE_CHECK_PTR(p)
57
#endif
58
59
/** \def ERS_CHECK_PTR(p) checks that C/C++ pointer \c p is valid (non null) and throws an ers::InvalidReferenceIssue if not
60
* If the pointer is invalid, this is considered as a server responsibility.
61
* \note Do not use this to check constant pointers, as the check is compiled out if the pointer is constant
62
*/
63
64
#if (!defined(N_ERS_ASSERT))
65
#if (defined(__GNUC__))
66
#define ERS_CHECK_PTR(p) if (! __builtin_constant_p(p)) ers::InvalidReferenceIssue::check_reference(ERS_HERE,ers::error,p,#p,ers::resp_server)
67
#else
68
#define ERS_CHECK_PTR(p) ers::InvalidReferenceIssue::check_reference(ERS_HERE,ers::error,p,#p,ers::resp_server)
69
#endif
70
#else
71
#define ERS_CHECK_PTR(p)
72
#endif
73
74
#endif
75
s
XmlRpcServer s
Definition:
HelloServer.cpp:11
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::Issue
Root Issue class.
Definition:
ers/ers-00-00-03/ers/Issue.h:40
ers::Issue::message
const std::string & message() const
Message.
Definition:
ers/ers-00-00-03/src/Issue.cxx:689
Issue.h
ers
Definition:
Event/ers/ers-00-00-03/ers/Assertion.h:20
ers::responsibility_t
enum ers::_responsibility_t responsibility_t
ers::resp_unknown
@ resp_unknown
Definition:
Core.h:25
ers::severity_t
enum ers::_severity_t severity_t
source
Event
ers
ers-00-00-03
ers
InvalidReferenceIssue.h
Generated by
1.9.6