Bayeux
3.4.1
Core Foundation library for SuperNEMO
bayeux
datatools
handle_macros.h
Go to the documentation of this file.
1
/* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3
* Creation date : 2012-03-20
4
* Last modified : 2013-04-23
5
*/
6
7
#ifndef DATATOOLS_HANDLE_MACROS_H
8
#define DATATOOLS_HANDLE_MACROS_H
9
10
// Standard Library:
11
#include <stdexcept>
12
#include <sstream>
13
14
// Third Party:
15
// - Boost:
16
#include <boost/preprocessor/stringize.hpp>
17
18
// This Project:
19
#include <
datatools/handle.h
>
20
21
// Macros:
22
23
#define DATATOOLS_HANDLE_DECLARE(HandleVar,Type) \
24
::datatools::handle<Type> HandleVar; \
25
\
26
27
28
#define DATATOOLS_HANDLE_DECLARE_NEW(HandleVar,Type) \
29
::datatools::handle<Type> HandleVar(new Type); \
30
\
31
32
33
#define DATATOOLS_HANDLE_GET_REF(RefVar,HandleVar,Type) \
34
DT_THROW_IF (! HandleVar, \
35
std::logic_error, \
36
"Handle '" << BOOST_PP_STRINGIZE(HandleVar) << "' has no data !"); \
37
const Type& RefVar = HandleVar.get();
38
39
40
#define DATATOOLS_HANDLE_GRAB_REF(RefVar,HandleVar,Type) \
41
DT_THROW_IF (! HandleVar, \
42
std::logic_error, \
43
"Handle '" << BOOST_PP_STRINGIZE(HandleVar) << "' has no data !"); \
44
Type& RefVar = HandleVar.grab();
45
46
47
#endif // DATATOOLS_HANDLE_MACROS_H
48
49
// Local Variables: --
50
// mode: c++ --
51
// c-file-style: "gnu" --
52
// tab-width: 2 --
53
// End: --
handle.h
Generated by
1.8.15