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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 InClass
27  Foam::memberFunctionSelectionTables
28 
29 Description
30  Macros for easy insertion into member function selection tables
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef addToMemberFunctionSelectionTable_H
35 #define addToMemberFunctionSelectionTable_H
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 
40 // add to hash-table of functions with typename as the key
41 #define addToMemberFunctionSelectionTable\
42 (baseType,thisType,memberFunction,argNames) \
43  \
44  /* Add the thisType memberFunction to the table */ \
45  baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
46  add##thisType##memberFunction##argNames##MemberFunctionTo##baseType##Table_
47 
48 
49 
50 // add to hash-table of functions with 'lookup' as the key
51 #define addNamedToMemberFunctionSelectionTable\
52 (baseType,thisType,memberFunction,argNames,lookup) \
53  \
54  /* Add the thisType memberFunction to the table, find by lookup name */ \
55  baseType::add##memberFunction##argNames##MemberFunctionToTable<thisType> \
56  add_##lookup##_##thisType##memberFunction##argNames##MemberFunctionTo## \
57  baseType##Table_(#lookup)
58 
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 
63 // add to hash-table of functions with typename as the key
64 // use when baseType doesn't need a template argument (eg, is a typedef)
65 #define addTemplateToMemberFunctionSelectionTable\
66 (baseType,thisType,Targ,memberFunction,argNames) \
67  \
68  /* Add the thisType memberFunction to the table */ \
69  baseType::add##memberFunction##argNames## \
70  MemberFunctionToTable<thisType<Targ>> \
71  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
72  baseType##Table_
73 
74 
75 // add to hash-table of functions with 'lookup' as the key
76 // use when baseType doesn't need a template argument (eg, is a typedef)
77 #define addNamedTemplateToMemberFunctionSelectionTable\
78 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
79  \
80  /* Add the thisType memberFunction to the table, find by lookup name */ \
81  baseType::add##memberFunction##argNames## \
82  MemberFunctionToTable<thisType<Targ>> \
83  add_##lookup##_##thisType##Targ##memberFunction##argNames## \
84  MemberFunctionTo##baseType##Table_(#lookup)
85 
86 // use when baseType requires the Targ template argument as well
87 #define addTemplatedToMemberFunctionSelectionTable\
88 (baseType,thisType,Targ,memberFunction,argNames) \
89  \
90  /* Add the thisType memberFunction to the table */ \
91  baseType<Targ>::add##memberFunction##argNames## \
92  MemberFunctionToTable<thisType<Targ>> \
93  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
94  baseType##Targ##Table_
95 
96 // use when baseType requires the Targ template argument as well
97 #define addNamedTemplatedToMemberFunctionSelectionTable\
98 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
99  \
100  /* Add the thisType memberFunction to the table, find by lookup name */ \
101  baseType<Targ>::add##memberFunction##argNames## \
102  MemberFunctionToTable<thisType<Targ>> \
103  add_##lookup##_##thisType##Targ##memberFunction##argNames## \
104  MemberFunctionTo##baseType##Targ##Table_(#lookup)
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 
110 // add to hash-table of functions with typename as the key
111 // use when baseType requires the Targ template argument as well
112 #define addTemplatedToMemberFunctionSelectionTable\
113 (baseType,thisType,Targ,memberFunction,argNames) \
114  \
115  /* Add the thisType memberFunction to the table */ \
116  baseType<Targ>::add##memberFunction##argNames## \
117  MemberFunctionToTable<thisType<Targ>> \
118  add##thisType##Targ##memberFunction##argNames##MemberFunctionTo## \
119  baseType##Targ##Table_
120 
121 
122 // add to hash-table of functions with 'lookup' as the key
123 // use when baseType requires the Targ template argument as well
124 #define addNamedTemplatedToMemberFunctionSelectionTable\
125 (baseType,thisType,Targ,memberFunction,argNames,lookup) \
126  \
127  /* Add the thisType memberFunction to the table, find by lookup name */ \
128  baseType<Targ>::add##memberFunction##argNames## \
129  MemberFunctionToTable<thisType<Targ>> \
130  add_##lookup##_##thisType##Targ##memberFunction##argNames## \
131  MemberFunctionTo##baseType##Targ##Table_(#lookup)
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //