FreeFOAM The Cross-Platform CFD Toolkit
addToMemberFunctionSelectionTable.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::memberFunctionSelectionTables
26 
27 Description
28  Macros for easy insertion into member function selection tables
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef addToMemberFunctionSelectionTable_H
33 #define addToMemberFunctionSelectionTable_H
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 
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_
45 
46 
47 
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##baseType##Table_(#lookup)
55 
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 
60 // add to hash-table of functions with typename as the key
61 // use when baseType doesn't need a template argument (eg, is a typedef)
62 #define addTemplateToMemberFunctionSelectionTable\
63 (baseType,thisType,Targ,memberFunction,argNames) \
64  \
65  /* Add the thisType memberFunction to the table */ \
66  baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
67  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_
68 
69 
70 // add to hash-table of functions with 'lookup' as the key
71 // use when baseType doesn't need a template argument (eg, is a typedef)
72 #define addNamedTemplateToMemberFunctionSelectionTable\
73 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
74  \
75  /* Add the thisType memberFunction to the table, find by lookup name */ \
76  baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
77  add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Table_(#lookup)
78 
79 // use when baseType requires the Targ template argument as well
80 #define addTemplatedToMemberFunctionSelectionTable\
81 (baseType,thisType,Targ,memberFunction,argNames) \
82  \
83  /* Add the thisType memberFunction to the table */ \
84  baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
85  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
86 
87 // use when baseType requires the Targ template argument as well
88 #define addNamedTemplatedToMemberFunctionSelectionTable\
89 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
90  \
91  /* Add the thisType memberFunction to the table, find by lookup name */ \
92  baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
93  add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
94 
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 
99 // add to hash-table of functions with typename as the key
100 // use when baseType requires the Targ template argument as well
101 #define addTemplatedToMemberFunctionSelectionTable\
102 (baseType,thisType,Targ,memberFunction,argNames) \
103  \
104  /* Add the thisType memberFunction to the table */ \
105  baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
106  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_
107 
108 
109 // add to hash-table of functions with 'lookup' as the key
110 // use when baseType requires the Targ template argument as well
111 #define addNamedTemplatedToMemberFunctionSelectionTable\
112 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
113  \
114  /* Add the thisType memberFunction to the table, find by lookup name */ \
115  baseType<Targ>::add##memberFunction##argNames##MemberFunctionToTable<thisType<Targ> > \
116  add_##lookup##_##thisType##Targ##memberFunction##argNames##MemberFunctionTo##baseType##Targ##Table_(#lookup)
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************ vim: set sw=4 sts=4 et: ************************ //