Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / foam / db / runTimeSelection / addToRunTimeSelectionTable.H
blob9910cb47ae43e3d342ec31058d86ec9de2fd02f4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 InClass
25     Foam::runTimeSelectionTables
27 Description
28     Macros for easy insertion into run-time selection tables
30 \*---------------------------------------------------------------------------*/
32 #ifndef addToRunTimeSelectionTable_H
33 #define addToRunTimeSelectionTable_H
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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_
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)
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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_
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)
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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_
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)
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103 #endif
105 // ************************************************************************* //