Bayeux  3.4.1
Core Foundation library for SuperNEMO
things_macros.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2012-03-31
4  * Last modified : 2013-04-22
5  */
6 #ifndef DATATOOLS_THINGS_MACROS_H
7 #define DATATOOLS_THINGS_MACROS_H
8 
9 // This Project:
10 #include <datatools/things.h>
11 
12 #define DATATOOLS_THINGS_ADD_BANK(ThingsVar,BankName,BankType,BankVar) \
13  BankType& BankVar = ThingsVar.add<BankType>(BankName);
14 
15 
16 #define DATATOOLS_THINGS_CHECK_BANK(ThingsVar,BankName,BankType) \
17  (ThingsVar.has(BankName) && ThingsVar.is_a<BankType>(BankName))
18 
19 
20 #define DATATOOLS_THINGS_CONST_BANK(ThingsVar,BankName,BankType,BankVar) \
21  { \
22  DT_THROW_IF (!ThingsVar.is_a<BankType>(BankName), \
23  std::logic_error, \
24  "No bank named '" << BankName << "' in '" << BOOST_PP_STRINGIZE(HandleVar) << "' !"); \
25  } \
26  const BankType& BankVar = ThingsVar.get<BankType>(BankName);
27 
28 
29 #define DATATOOLS_THINGS_MUTABLE_BANK(ThingsVar,BankName,BankType,BankVar) \
30  { \
31  DT_THROW_IF (!ThingsVar.is_a<BankType>(BankName), \
32  std::logic_error, \
33  "No bank named '" << BankName << "' in '" << BOOST_PP_STRINGIZE(HandleVar) << "' !"); \
34  } \
35  BankType& BankVar = ThingsVar.grab<BankType>(BankName);
36 
37 
38 #endif // DATATOOLS_THINGS_MACROS_H
39 
40 // Local Variables: --
41 // mode: c++ --
42 // c-file-style: "gnu" --
43 // tab-width: 2 --
44 // End: --