BOSS 8.0.0
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 <cstdio>
12#include <sstream>
13
14const char* const ers::InvalidReferenceIssue::CLASS_NAME = "ers::InvalidReferenceIssue";
15
16const char* const ers::InvalidReferenceIssue::REFERENCE_VALUE_KEY = "REFERENCE_VALUE";
17const char* const ers::InvalidReferenceIssue::REFERENCE_TYPE_KEY = "REFERENCE_TYPE";
18const char* const ers::InvalidReferenceIssue::REFERENCE_NAME_KEY = "REFERENCE_NAME";
19const char* const ers::InvalidReferenceIssue::REFERENCE_C_PTR_TYPE = "C Pointer";
20
21namespace {
22 ers::Issue* create_issue() { return new ers::InvalidReferenceIssue(); }
25} // namespace
26
28
31
33 const void* p, const std::string& msg,
35 : Issue( context, s ) {
36 severity( s );
37 pointer( p );
38 responsibility( r );
39 finish_setup( msg );
40} // InvalidReferenceIssue
41
42const char* ers::InvalidReferenceIssue::get_class_name() const throw() {
44} // get_class_name
45
47 char buffer[sizeof( void* ) + 1]; // space needed to print a pointer
48 snprintf( buffer, sizeof( buffer ), "%p", p );
51} // pointer
52
54 const void* p, const char* ptr_name,
56 if ( p == 0 )
57 {
58 std::ostringstream message;
59 message << "pointer '" << ptr_name << "' is null";
60 ers::InvalidReferenceIssue issue( context, s, p, message.str(), r );
61 issue.m_value_table[REFERENCE_NAME_KEY] = ptr_name;
62 throw issue;
63 } // if
64} // check
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)
bool register_issue(const std::string &name, CreateIssueCallback creator)
register an issue factory
static IssueFactory * instance()
method to access singleton
Root Issue class.
responsibility_t responsibility() const
get the responsability level of the issue
void set_value(const std::string &key, uint8_t value)
Sets a value 8 bit unsigned.
severity_t severity() const
severity_t of the issue
const std::string & message() const
Message.
void finish_setup(const std::string &message)
Finishes the setup of the Issue.
Issue(const Context &context, severity_t s)
Constructor for subclasses.
string_map_type m_value_table
Optional properties.
enum ers::_responsibility_t responsibility_t
enum ers::_severity_t severity_t