BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/ers/include/ers/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
15namespace 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
27 protected:
28 void pointer( const void* p );
29 InvalidReferenceIssue( const Context& context, severity_t s );
30
31 public:
32 static const char* const CLASS_NAME;
33 static const char* const REFERENCE_VALUE_KEY;
34 static const char* const REFERENCE_TYPE_KEY;
35 static const char* const REFERENCE_NAME_KEY;
36 static const char* const REFERENCE_C_PTR_TYPE;
38 InvalidReferenceIssue( const Context& context, severity_t s, const void* pointer,
39 const std::string& message, responsibility_t r = resp_unknown );
40 virtual const char* get_class_name() const throw();
41 static void check_reference( const Context& context, severity_t s, const void* pointer,
42 const char* ptr_name, responsibility_t r );
43 }; // InvalidReferenceIssue
44
45} // namespace ers
46
47/** \def ERS_PRE_CHECK_PTR(p) checks that C/C++ pointer \c p is valid (non null) and throws an
48 * ers::InvalidReferenceIssue if not If the pointer is invalid, this is considered as a client
49 * responsibility. \note Do not use this to check constant pointers, as the check is compiled
50 * out if the pointer is constant
51 */
52
53#if ( !defined( N_ERS_ASSERT ) )
54# if ( defined( __GNUC__ ) )
55# define ERS_PRE_CHECK_PTR( p ) \
56 if ( !__builtin_constant_p( p ) ) \
57 ers::InvalidReferenceIssue::check_reference( ERS_HERE, ers::error, p, #p, \
58 ers::resp_client );
59# else
60# define ERS_PRE_CHECK_PTR( p ) \
61 ers::InvalidReferenceIssue::check_reference( ERS_HERE, ers::error, p, #p, \
62 ers::resp_client )
63# endif
64#else
65# define ERS_PRE_CHECK_PTR( p )
66#endif
67
68/** \def ERS_CHECK_PTR(p) checks that C/C++ pointer \c p is valid (non null) and throws an
69 * ers::InvalidReferenceIssue if not If the pointer is invalid, this is considered as a server
70 * responsibility. \note Do not use this to check constant pointers, as the check is compiled
71 * out if the pointer is constant
72 */
73
74#if ( !defined( N_ERS_ASSERT ) )
75# if ( defined( __GNUC__ ) )
76# define ERS_CHECK_PTR( p ) \
77 if ( !__builtin_constant_p( p ) ) \
78 ers::InvalidReferenceIssue::check_reference( ERS_HERE, ers::error, p, #p, \
79 ers::resp_server )
80# else
81# define ERS_CHECK_PTR( p ) \
82 ers::InvalidReferenceIssue::check_reference( ERS_HERE, ers::error, p, #p, \
83 ers::resp_server )
84# endif
85#else
86# define ERS_CHECK_PTR( p )
87#endif
88
89#endif
XmlRpcServer s
Source context for Issue.
virtual const char * get_class_name() const
Get key for class (used for serialisation).
static void check_reference(const Context &context, severity_t s, const void *pointer, const char *ptr_name, responsibility_t r)
InvalidReferenceIssue(const Context &context, severity_t s)
const std::string & message() const
Message.
Issue(const Context &context, severity_t s)
Constructor for subclasses.
enum ers::_responsibility_t responsibility_t
enum ers::_severity_t severity_t