1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 Macros for easy insertion into run-time selection tables
27 \*---------------------------------------------------------------------------*/
29 #ifndef addToRunTimeSelectionTable_H
30 #define addToRunTimeSelectionTable_H
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // add to hash-table of functions with typename as the key
36 #define addToRunTimeSelectionTable\
37 (baseType,thisType,argNames) \
39 /* Add the thisType constructor function to the table */ \
40 baseType::add##argNames##ConstructorToTable< thisType > \
41 add##thisType##argNames##ConstructorTo##baseType##Table_
44 // add to hash-table of functions with 'lookup' as the key
45 #define addNamedToRunTimeSelectionTable\
46 (baseType,thisType,argNames,lookup) \
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_ \
54 // add to hash-table of functions with typename as the key
55 #define addRemovableToRunTimeSelectionTable\
56 (baseType,thisType,argNames) \
58 /* Add the thisType constructor function to the table */ \
59 baseType::addRemovable##argNames##ConstructorToTable< thisType > \
60 addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
63 // add to hash-table of functions with 'lookup' as the key
64 #define addRemovableNamedToRunTimeSelectionTable\
65 (baseType,thisType,argNames,lookup) \
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)
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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) \
81 /* Add the thisType constructor function to the table */ \
82 baseType::add##argNames##ConstructorToTable< thisType< Targ > > \
83 add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
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) \
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 \
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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) \
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_
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) \
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)
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 // ************************************************************************* //