addToMemberFunctionSelectionTable.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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## \
55  baseType##Table_(#lookup)
56 
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 
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_
71 
72 
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)
83 
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_
93 
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)
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 
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_
118 
119 
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)
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //