Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / OpenFOAM / db / runTimeSelection / memberFunctions / addToMemberFunctionSelectionTable.H
blob5f0f5fc0314253ac10adc5b66024ed705eba40df
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 InClass
25     Foam::memberFunctionSelectionTables
27 Description
28     Macros for easy insertion into member function selection tables
30 \*---------------------------------------------------------------------------*/
32 #ifndef addToMemberFunctionSelectionTable_H
33 #define addToMemberFunctionSelectionTable_H
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // add to hash-table of functions with typename as the key
39 #define addToMemberFunctionSelectionTable\
40 (baseType,thisType,memberFunction,argNames)                                   \
41                                                                               \
42     /* Add the thisType memberFunction to the table */                        \
43     baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType>  \
44     add##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_
48 // add to hash-table of functions with 'lookup' as the key
49 #define addNamedToMemberFunctionSelectionTable\
50 (baseType,thisType,memberFunction,argNames,lookup)                            \
51                                                                               \
52     /* Add the thisType memberFunction to the table, find by lookup name */   \
53     baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType>  \
54     add_##lookup##_##thisType##memberFunction##argNames##MemberFunctionTo##   \
55     baseType##Table_(#lookup)
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 // add to hash-table of functions with typename as the key
62 // use when baseType doesn't need a template argument (eg, is a typedef)
63 #define addTemplateToMemberFunctionSelectionTable\
64 (baseType,thisType,Targ,memberFunction,argNames)                              \
65                                                                               \
66     /* Add the thisType memberFunction to the table */                        \
67     baseType::add##memberFunction##argNames##                                 \
68     MemberFunctionToTable<thisType<Targ> >                                    \
69     add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##         \
70     baseType##Table_
73 // add to hash-table of functions with 'lookup' as the key
74 // use when baseType doesn't need a template argument (eg, is a typedef)
75 #define addNamedTemplateToMemberFunctionSelectionTable\
76 (baseType,thisType,Targ,memberFunction,argNames,lookup)                       \
77                                                                               \
78     /* Add the thisType memberFunction to the table, find by lookup name */   \
79     baseType::add##memberFunction##argNames##                                 \
80     MemberFunctionToTable<thisType<Targ> >                                    \
81     add_##lookup##_##thisType##Targ##memberFunction##argNames##               \
82     MemberFunctionTo##baseType##Table_(#lookup)
84 // use when baseType requires the Targ template argument as well
85 #define addTemplatedToMemberFunctionSelectionTable\
86 (baseType,thisType,Targ,memberFunction,argNames)                              \
87                                                                               \
88     /* Add the thisType memberFunction to the table */                        \
89     baseType<Targ>::add##memberFunction##argNames##                           \
90     MemberFunctionToTable<thisType<Targ> >                                    \
91     add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##         \
92     baseType##Targ##Table_
94 // use when baseType requires the Targ template argument as well
95 #define addNamedTemplatedToMemberFunctionSelectionTable\
96 (baseType,thisType,Targ,memberFunction,argNames,lookup)                       \
97                                                                               \
98     /* Add the thisType memberFunction to the table, find by lookup name */   \
99     baseType<Targ>::add##memberFunction##argNames##                           \
100     MemberFunctionToTable<thisType<Targ> >                                    \
101     add_##lookup##_##thisType##Targ##memberFunction##argNames##               \
102     MemberFunctionTo##baseType##Targ##Table_(#lookup)
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 // add to hash-table of functions with typename as the key
109 // use when baseType requires the Targ template argument as well
110 #define addTemplatedToMemberFunctionSelectionTable\
111 (baseType,thisType,Targ,memberFunction,argNames)                              \
112                                                                               \
113     /* Add the thisType memberFunction to the table */                        \
114     baseType<Targ>::add##memberFunction##argNames##                           \
115     MemberFunctionToTable<thisType<Targ> >                                    \
116     add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##         \
117     baseType##Targ##Table_
120 // add to hash-table of functions with 'lookup' as the key
121 // use when baseType requires the Targ template argument as well
122 #define addNamedTemplatedToMemberFunctionSelectionTable\
123 (baseType,thisType,Targ,memberFunction,argNames,lookup)                       \
124                                                                               \
125     /* Add the thisType memberFunction to the table, find by lookup name */   \
126     baseType<Targ>::add##memberFunction##argNames##                           \
127     MemberFunctionToTable<thisType<Targ> >                                    \
128     add_##lookup##_##thisType##Targ##memberFunction##argNames##               \
129     MemberFunctionTo##baseType##Targ##Table_(#lookup)
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 #endif
136 // ************************************************************************* //