Develop Biology
The language of life
ClassMethodMacros.h
Go to the documentation of this file.
1/*
2 * This file is a part of the Biology project by eons LLC.
3 * Biology (aka Develop Biology) is a framework for approaching software
4 * development from a natural sciences perspective.
5 *
6 * Copyright (C) 2022 Séon O'Shannon & eons LLC
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
25
30#define BIO_CLASS_METHOD(\
31 ns, \
32 caller, \
33 functionSignature, \
34 functionCall) \
35functionSignature \
36{ \
37 return this->ns::Class< caller >::functionCall; \
38}
39
40#define BIO_CLASS_METHOD_WITH_MACRO(ns, caller, macro) \
41 BIO_CLASS_METHOD(ns, BIO_EXPAND_TUPLE caller, macro)
42
43
52#define BIO_CALL_CLASS_METHOD_LOOP_WITH_MACRO(\
53 loopName, \
54 iterationsMacro, \
55 ns, \
56 caller, \
57 argsMacro \
58) \
59 BIO_CALL_LOOP( \
60 loopName, \
61 iterationsMacro, \
62 ns, \
63 caller, \
64 argsMacro)
65
72#define BIO_DISAMBIGUATE_REQUIRED_CLASS_METHODS(ns, caller) \
73 BIO_CALL_CLASS_METHOD_LOOP_WITH_MACRO( \
74 BIO_DEFINE_CLASS_METHODS_LOOP, \
75 BIO_GET_NUM_ARGS_OF_MACRO( \
76 BIO_GET_REQUIRED_CLASS_METHODS_FOR_##ns() \
77 ), \
78 ns, \
79 (caller), \
80 BIO_CALL_NS_MACRO( \
81 BIO_GET_REQUIRED_CLASS_METHODS_FOR, \
82 ns \
83 ) \
84 )
85
92#define BIO_DISAMBIGUATE_OPTIONAL_CLASS_METHODS(ns, caller) \
93 BIO_CALL_CLASS_METHOD_LOOP_WITH_MACRO( \
94 BIO_DEFINE_CLASS_METHODS_LOOP, \
95 BIO_GET_NUM_ARGS_OF_MACRO( \
96 BIO_GET_OPTIONAL_CLASS_METHODS_FOR_##ns() \
97 ), \
98 ns, \
99 (caller), \
100 BIO_CALL_NS_MACRO( \
101 BIO_GET_OPTIONAL_CLASS_METHODS_FOR, \
102 ns \
103 ) \
104 )
105
111#define BIO_DISAMBIGUATE_ALL_CLASS_METHODS(ns, caller) \
112 BIO_DISAMBIGUATE_REQUIRED_CLASS_METHODS(ns, BIO_SINGLE_ARG(caller)) \
113 BIO_DISAMBIGUATE_OPTIONAL_CLASS_METHODS(ns, BIO_SINGLE_ARG(caller))