Main Page
Class Categories
Classes
Namespaces
File List
File Members
exper-sw
cosmosw
AugerSW
Offline
source
main
Utilities
STL
ShadowPtrPolicy.h
Go to the documentation of this file.
1
#ifndef _utl_ShadowPtrPolicy_h_
2
#define _utl_ShadowPtrPolicy_h_
3
4
#include <iostream>
5
#ifdef __GNUC__
6
# include <cxxabi.h>
7
# include <cstdlib>
8
#endif
9
#include <utl/AugerException.h>
10
11
12
namespace
utl {
13
14
class
NoDereferenceCheck
{
15
public
:
16
template
<
typename
T>
17
static
void
Examine
(T*
const
)
18
{ }
19
};
20
21
22
class
ThrowOnZeroDereference
{
23
public
:
24
template
<
typename
T>
25
static
26
void
27
Examine
(T*
const
ptr)
28
{
29
if
(!ptr) {
30
std::stringstream err;
31
err <<
"Dereferencing zero pointer to "
;
32
#ifdef __GNUC__
33
int
status;
34
char
*
const
rName =
35
abi::__cxa_demangle(
typeid
(T).name(), 0, 0, &status);
36
err << rName;
37
free(rName);
38
#else
39
err <<
typeid
(T).name();
40
#endif
41
std::cerr << err.str() << std::endl;
42
throw
utl::NonExistentComponentException
(err.str());
43
}
44
}
45
};
46
47
}
48
49
50
#endif
utl::ThrowOnZeroDereference
Definition:
ShadowPtrPolicy.h:22
utl::NonExistentComponentException
Base class for exceptions trying to access non-existing components.
Definition:
AugerException.h:59
utl::NoDereferenceCheck::Examine
static void Examine(T *const)
Definition:
ShadowPtrPolicy.h:17
utl::NoDereferenceCheck
Definition:
ShadowPtrPolicy.h:14
utl::ThrowOnZeroDereference::Examine
static void Examine(T *const ptr)
Definition:
ShadowPtrPolicy.h:27
, generated on Tue Sep 26 2023.