hpp-util
4.9.0
Debugging tools for the HPP project.
pointer.hh
Go to the documentation of this file.
1
// Copyright (C) 2013 by Antonio El Khoury, CNRS.
2
//
3
// This file is part of the hpp-util.
4
//
5
// This software is provided "as is" without warranty of any kind,
6
// either expressed or implied, including but not limited to the
7
// implied warranties of fitness for a particular purpose.
8
//
9
// See the COPYING file for more information.
10
11
#ifndef HPP_UTIL_POINTER_HH
12
# define HPP_UTIL_POINTER_HH
13
14
# include <boost/smart_ptr.hpp>
15
24
25
# define HPP_POINTER_DEFS(t) \
26
typedef boost::weak_ptr <t> t##WkPtr_t; \
27
typedef boost::weak_ptr <const t> t##ConstWkPtr_t; \
28
struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
29
33
# define HPP_PREDEF_CLASS(t) \
34
class t; \
35
HPP_POINTER_DEFS(t); \
36
struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
37
38
# define HPP_STATIC_PTR_CAST(t, x) boost::static_pointer_cast < t > (x)
39
# define HPP_DYNAMIC_PTR_CAST(t, x) boost::dynamic_pointer_cast < t > (x)
40
# ifndef NDEBUG
41
# define HPP_STATIC_CAST_REF_CHECK(t, x)\
42
try {\
43
dynamic_cast < t& > (x);\
44
} catch (const std::exception& exc) {\
45
assert ("Cast in #t failed" && 0);\
46
}
47
# else
48
# define HPP_STATIC_CAST_REF_CHECK(t, x)
49
# endif // defined NDEBUG
50
#endif
include
hpp
util
pointer.hh
Generated by
1.8.13