addToRunTimeSelectionTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 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 //- Add to hash-table of functions with typename as the key
35 #define addToRunTimeSelectionTable\
36 (baseType,thisType,argNames) \
37  \
38  /* Add the thisType constructor function to the table */ \
39  baseType::add##argNames##ConstructorToTable<thisType> \
40  add##thisType##argNames##ConstructorTo##baseType##Table_
41 
42 
43 //- Add to hash-table of functions with 'lookup' as the key
44 #define addNamedToRunTimeSelectionTable\
45 (baseType,thisType,argNames,lookup) \
46  \
47  /* Add the thisType constructor function to the table, find by lookup */ \
48  baseType::add##argNames##ConstructorToTable<thisType> \
49  add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_ \
50  (#lookup)
51 
52 
53 //- Add to hash-table of functions with typename as the key
54 #define addRemovableToRunTimeSelectionTable\
55 (baseType,thisType,argNames) \
56  \
57  /* Add the thisType constructor function to the table */ \
58  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
59  addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
60 
61 
62 //- Add to hash-table of functions with 'lookup' as the key
63 #define addRemovableNamedToRunTimeSelectionTable\
64 (baseType,thisType,argNames,lookup) \
65  \
66  /* Add the thisType constructor function to the table, find by lookup */ \
67  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
68  addRemovable_##lookup##_##thisType##argNames##ConstructorTo \
69  ##baseType##Table_(#lookup)
70 
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 //- Add to hash-table of functions with typename as the key.
75 // Use when baseType doesn't need a template argument (eg, is a typedef)
76 #define addTemplateToRunTimeSelectionTable\
77 (baseType,thisType,Targ,argNames) \
78  \
79  /* Add the thisType constructor function to the table */ \
80  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
81  add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
82 
83 
84 //- Add to hash-table of functions with 'lookup' as the key.
85 // Use when baseType doesn't need a template argument (eg, is a typedef)
86 #define addNamedTemplateToRunTimeSelectionTable\
87 (baseType,thisType,Targ,argNames,lookup) \
88  \
89  /* Add the thisType constructor function to the table, find by lookup */ \
90  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
91  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType \
92  ##Table_(#lookup)
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 //- Add to hash-table of functions with typename as the key.
98 // Use when baseType requires the Targ template argument as well
99 #define addTemplatedToRunTimeSelectionTable\
100 (baseType,thisType,Targ,argNames) \
101  \
102  /* Add the thisType constructor function to the table */ \
103  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
104  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
105 
106 
107 //- Add to hash-table of functions with 'lookup' as the key.
108 // Use when baseType requires the Targ template argument as well
109 #define addNamedTemplatedToRunTimeSelectionTable\
110 (baseType,thisType,Targ,argNames,lookup) \
111  \
112  /* Add the thisType constructor function to the table, find by lookup */ \
113  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
114  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType## \
115  Targ##Table_(#lookup)
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //