FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 InClass
25  Foam::runTimeSelectionTables
26 
27 Description
28  Macros for easy insertion into run-time selection tables
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef addToRunTimeSelectionTable_H
33 #define addToRunTimeSelectionTable_H
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 
38 // add to hash-table of functions with typename as the key
39 #define addToRunTimeSelectionTable\
40 (baseType,thisType,argNames) \
41  \
42  /* Add the thisType constructor function to the table */ \
43  baseType::add##argNames##ConstructorToTable< thisType > \
44  add##thisType##argNames##ConstructorTo##baseType##Table_
45 
46 
47 // add to hash-table of functions with 'lookup' as the key
48 #define addNamedToRunTimeSelectionTable\
49 (baseType,thisType,argNames,lookup) \
50  \
51  /* Add the thisType constructor function to the table, find by lookup */ \
52  baseType::add##argNames##ConstructorToTable< thisType > \
53  add_##lookup##_##thisType##argNames##ConstructorTo##baseType##Table_(#lookup)
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 
58 // add to hash-table of functions with typename as the key
59 // use when baseType doesn't need a template argument (eg, is a typedef)
60 #define addTemplateToRunTimeSelectionTable\
61 (baseType,thisType,Targ,argNames) \
62  \
63  /* Add the thisType constructor function to the table */ \
64  baseType::add##argNames##ConstructorToTable< thisType< Targ > > \
65  add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
66 
67 
68 // add to hash-table of functions with 'lookup' as the key
69 // use when baseType doesn't need a template argument (eg, is a typedef)
70 #define addNamedTemplateToRunTimeSelectionTable\
71 (baseType,thisType,Targ,argNames,lookup) \
72  \
73  /* Add the thisType constructor function to the table, find by lookup */ \
74  baseType::add##argNames##ConstructorToTable< thisType< Targ > > \
75  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Table_(#lookup)
76 
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 
81 // add to hash-table of functions with typename as the key
82 // use when baseType requires the Targ template argument as well
83 #define addTemplatedToRunTimeSelectionTable\
84 (baseType,thisType,Targ,argNames) \
85  \
86  /* Add the thisType constructor function to the table */ \
87  baseType< Targ >::add##argNames##ConstructorToTable< thisType< Targ > > \
88  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
89 
90 
91 // add to hash-table of functions with 'lookup' as the key
92 // use when baseType requires the Targ template argument as well
93 #define addNamedTemplatedToRunTimeSelectionTable\
94 (baseType,thisType,Targ,argNames,lookup) \
95  \
96  /* Add the thisType constructor function to the table, find by lookup */ \
97  baseType< Targ >::add##argNames##ConstructorToTable< thisType< Targ > > \
98  add_##lookup##_##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_(#lookup)
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 #endif
104 
105 // ************************ vim: set sw=4 sts=4 et: ************************ //