addToRunTimeSelectionTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  Macros for easy insertion into run-time selection tables
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #ifndef addToRunTimeSelectionTable_H
30 #define addToRunTimeSelectionTable_H
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 
35 // add to hash-table of functions with typename as the key
36 #define addToRunTimeSelectionTable\
37 (baseType,thisType,argNames) \
38  \
39  /* Add the thisType constructor function to the table */ \
40  baseType::add##argNames##ConstructorToTable<thisType> \
41  add##thisType##argNames##ConstructorTo##baseType##Table_
42 
43 
44 // add to hash-table of functions with 'lookup' as the key
45 #define addNamedToRunTimeSelectionTable\
46 (baseType,thisType,argNames,lookup) \
47  \
48  /* Add the thisType constructor function to the table, find by lookup */ \
49  baseType::add##argNames##ConstructorToTable<thisType> \
50  add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_ \
51  (#lookup)
52 
53 
54 // add to hash-table of functions with typename as the key
55 #define addRemovableToRunTimeSelectionTable\
56 (baseType,thisType,argNames) \
57  \
58  /* Add the thisType constructor function to the table */ \
59  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
60  addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
61 
62 
63 // add to hash-table of functions with 'lookup' as the key
64 #define addRemovableNamedToRunTimeSelectionTable\
65 (baseType,thisType,argNames,lookup) \
66  \
67  /* Add the thisType constructor function to the table, find by lookup */ \
68  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
69  addRemovable_##lookup##_##thisType##argNames##ConstructorTo \
70  ##baseType##Table_(#lookup)
71 
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 
76 // add to hash-table of functions with typename as the key
77 // use when baseType doesn't need a template argument (eg, is a typedef)
78 #define addTemplateToRunTimeSelectionTable\
79 (baseType,thisType,Targ,argNames) \
80  \
81  /* Add the thisType constructor function to the table */ \
82  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
83  add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
84 
85 
86 // add to hash-table of functions with 'lookup' as the key
87 // use when baseType doesn't need a template argument (eg, is a typedef)
88 #define addNamedTemplateToRunTimeSelectionTable\
89 (baseType,thisType,Targ,argNames,lookup) \
90  \
91  /* Add the thisType constructor function to the table, find by lookup */ \
92  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
93  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType \
94  ##Table_(#lookup)
95 
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 
100 // add to hash-table of functions with typename as the key
101 // use when baseType requires the Targ template argument as well
102 #define addTemplatedToRunTimeSelectionTable\
103 (baseType,thisType,Targ,argNames) \
104  \
105  /* Add the thisType constructor function to the table */ \
106  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
107  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
108 
109 
110 // add to hash-table of functions with 'lookup' as the key
111 // use when baseType requires the Targ template argument as well
112 #define addNamedTemplatedToRunTimeSelectionTable\
113 (baseType,thisType,Targ,argNames,lookup) \
114  \
115  /* Add the thisType constructor function to the table, find by lookup */ \
116  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
117  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType## \
118  Targ##Table_(#lookup)
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #endif
124 
125 // ************************************************************************* //