1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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 Foam::memberFunctionSelectionTables
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) \
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) \
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) \
66 /* Add the thisType memberFunction to the table */ \
67 baseType::add##memberFunction##argNames## \
68 MemberFunctionToTable<thisType<Targ> > \
69 add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
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) \
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) \
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) \
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) \
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) \
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 // ************************************************************************* //