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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Description
27  Macros for easy insertion into run-time selection tables
28 
29 \*---------------------------------------------------------------------------*/
30 
31 #ifndef addToRunTimeSelectionTable_H
32 #define addToRunTimeSelectionTable_H
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 //- Add to hash-table of functions with typename as the key
37 #define addToRunTimeSelectionTable\
38 (baseType,thisType,argNames) \
39  \
40  /* Add the thisType constructor function to the table */ \
41  baseType::add##argNames##ConstructorToTable<thisType> \
42  add##thisType##argNames##ConstructorTo##baseType##Table_
43 
44 
45 //- Add to hash-table of functions with 'lookup' as the key
46 #define addNamedToRunTimeSelectionTable\
47 (baseType,thisType,argNames,lookup) \
48  \
49  /* Add the thisType constructor function to the table, find by lookup */ \
50  baseType::add##argNames##ConstructorToTable<thisType> \
51  add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_ \
52  (#lookup)
53 
54 
55 //- Add to hash-table of functions with typename as the key
56 #define addRemovableToRunTimeSelectionTable\
57 (baseType,thisType,argNames) \
58  \
59  /* Add the thisType constructor function to the table */ \
60  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
61  addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
62 
63 
64 //- Add to hash-table of functions with 'lookup' as the key
65 #define addRemovableNamedToRunTimeSelectionTable\
66 (baseType,thisType,argNames,lookup) \
67  \
68  /* Add the thisType constructor function to the table, find by lookup */ \
69  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
70  addRemovable_##lookup##_##thisType##argNames##ConstructorTo \
71  ##baseType##Table_(#lookup)
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 //- Add to hash-table of functions with typename as the key.
100 // Use when baseType requires the Targ template argument as well
101 #define addTemplatedToRunTimeSelectionTable\
102 (baseType,thisType,Targ,argNames) \
103  \
104  /* Add the thisType constructor function to the table */ \
105  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
106  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
107 
108 
109 //- Add to hash-table of functions with 'lookup' as the key.
110 // Use when baseType requires the Targ template argument as well
111 #define addNamedTemplatedToRunTimeSelectionTable\
112 (baseType,thisType,Targ,argNames,lookup) \
113  \
114  /* Add the thisType constructor function to the table, find by lookup */ \
115  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
116  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType## \
117  Targ##Table_(#lookup)
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #endif
123 
124 // ************************************************************************* //
addNamedTemplateToRunTimeSelectionTable
#define addNamedTemplateToRunTimeSelectionTable(baseType, thisType, Targ, argNames, lookup)
Add to hash-table of functions with 'lookup' as the key.
Definition: addToRunTimeSelectionTable.H:88
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
addTemplateToRunTimeSelectionTable
#define addTemplateToRunTimeSelectionTable(baseType, thisType, Targ, argNames)
Add to hash-table of functions with typename as the key.
Definition: addToRunTimeSelectionTable.H:78
addTemplatedToRunTimeSelectionTable
#define addTemplatedToRunTimeSelectionTable(baseType, thisType, Targ, argNames)
Add to hash-table of functions with typename as the key.
Definition: addToRunTimeSelectionTable.H:101
addNamedTemplatedToRunTimeSelectionTable
#define addNamedTemplatedToRunTimeSelectionTable(baseType, thisType, Targ, argNames, lookup)
Add to hash-table of functions with 'lookup' as the key.
Definition: addToRunTimeSelectionTable.H:111