85 lines
2.7 KiB
C
85 lines
2.7 KiB
C
|
/*
|
||
|
* <Short Description>
|
||
|
* Copyright (C) 2024 Brett Terpstra
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#ifndef GP_IMAGE_TEST_FUNCTIONS_H
|
||
|
#define GP_IMAGE_TEST_FUNCTIONS_H
|
||
|
|
||
|
// FUNC_DEFINE(NAME, REQUIRED_ARGS, FUNC, ALLOWED_FUNCS)
|
||
|
// FUNC_ALLOW_ANY
|
||
|
|
||
|
#include <initializer_list>
|
||
|
#include <vector>
|
||
|
|
||
|
template<typename T>
|
||
|
using allowed_funcs = std::vector<T>;
|
||
|
|
||
|
class empty {};
|
||
|
|
||
|
#define FUNC_ALLOW_ANY std::vector<empty>();
|
||
|
#define FUNC_ALLOW_NONE std::vector<empty>();
|
||
|
|
||
|
#define FUNC_FUNCTIONS \
|
||
|
FUNC_DEFINE(RANDOM, 0, void(), allowed_funcs(FUNC_ALLOW_NONE)) \
|
||
|
FUNC_DEFINE(NOISE, 0, void(), allowed_funcs(FUNC_ALLOW_NONE)) \
|
||
|
FUNC_DEFINE(COLOR, 0, void(), allowed_funcs(FUNC_ALLOW_NONE)) \
|
||
|
FUNC_DEFINE(SCALAR, 0, void(), allowed_funcs(FUNC_ALLOW_NONE)) \
|
||
|
FUNC_DEFINE(ADD, 2, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(SUB, 2, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(MUL, 2, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(DIV, 2, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(EXP, 2, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(LOG, 1, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
FUNC_DEFINE(SQRT, 1, void(), allowed_funcs(FUNC_ALLOW_ANY, FUNC_ALLOW_ANY)) \
|
||
|
|
||
|
#undef FUNC_ALLOW_ANY
|
||
|
|
||
|
#define FUNC_DEFINE(NAME, REQUIRED_ARGS, FUNC, ALLOWED) NAME,
|
||
|
enum class function_t
|
||
|
{
|
||
|
FUNC_FUNCTIONS
|
||
|
};
|
||
|
#undef FUNC_DEFINE
|
||
|
|
||
|
#define FUNC_DEFINE(NAME, REQUIRED_ARGS, FUNC, ALLOWED) function_t::NAME,
|
||
|
static inline allowed_funcs<function_t> FUNC_ALLOW_ANY_LIST{FUNC_FUNCTIONS};
|
||
|
#define FUNC_ALLOW_ANY FUNC_ALLOW_ANY_LIST
|
||
|
#undef FUNC_DEFINE
|
||
|
|
||
|
//enum class function_t
|
||
|
//{
|
||
|
// // FUNC // inputs
|
||
|
// ADD, // 2
|
||
|
// SUB, // 2
|
||
|
// MUL, // 2
|
||
|
// DIV, // 2
|
||
|
// EXP, // 2
|
||
|
//
|
||
|
// LOG, // 1
|
||
|
// SQRT, // 1
|
||
|
// QUAD, // 1
|
||
|
//
|
||
|
// RANDOM, // 0
|
||
|
// NOISE, // 0
|
||
|
// COLOR, // 0
|
||
|
// SCALAR // 0
|
||
|
//};
|
||
|
|
||
|
static constexpr int OPERATOR_COUNT = static_cast<int>(function_t::SCALAR) + 1;
|
||
|
|
||
|
#endif //GP_IMAGE_TEST_FUNCTIONS_H
|