patch
parent
1377e99661
commit
6ca18b97aa
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(lilfbtf5 VERSION 0.1.16)
|
project(lilfbtf5 VERSION 0.1.17)
|
||||||
|
|
||||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#ifndef LILFBTF5_FWDDECL_H
|
#ifndef LILFBTF5_FWDDECL_H
|
||||||
#define LILFBTF5_FWDDECL_H
|
#define LILFBTF5_FWDDECL_H
|
||||||
|
|
||||||
|
#include <blt/std/types.h>
|
||||||
|
#include <functional>
|
||||||
|
#include "blt/std/ranges.h"
|
||||||
|
|
||||||
namespace fb
|
namespace fb
|
||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
|
@ -28,6 +32,12 @@ namespace fb
|
||||||
|
|
||||||
class func_t;
|
class func_t;
|
||||||
class tree_t;
|
class tree_t;
|
||||||
|
|
||||||
|
class type_engine_t;
|
||||||
|
class gp_system_t;
|
||||||
|
|
||||||
|
using type_id = blt::size_t;
|
||||||
|
using func_t_call_t = std::function<void(func_t&, blt::span<detail::node_t*>)>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //LILFBTF5_FWDDECL_H
|
#endif //LILFBTF5_FWDDECL_H
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* <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 LILFBTF5_SYSTEM_H
|
||||||
|
#define LILFBTF5_SYSTEM_H
|
||||||
|
|
||||||
|
#include <lilfbtf/fwddecl.h>
|
||||||
|
|
||||||
|
namespace fb
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //LILFBTF5_SYSTEM_H
|
|
@ -27,19 +27,18 @@
|
||||||
|
|
||||||
namespace fb
|
namespace fb
|
||||||
{
|
{
|
||||||
using func_t_call_t = std::function<void(func_t&, blt::span<detail::node_t*>)>;
|
|
||||||
|
|
||||||
class func_t
|
class func_t
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
blt::size_t argc_ = 0;
|
blt::size_t argc_ = 0;
|
||||||
std::string type;
|
type_id type;
|
||||||
const func_t_call_t& func;
|
const func_t_call_t& func;
|
||||||
protected:
|
protected:
|
||||||
blt::unsafe::any_t value;
|
blt::unsafe::any_t value;
|
||||||
public:
|
public:
|
||||||
explicit func_t(blt::size_t argc, const func_t_call_t& func):
|
explicit func_t(blt::size_t argc, const func_t_call_t& func, type_id type):
|
||||||
argc_(argc), func(func)
|
argc_(argc), type(type), func(func)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
[[nodiscard]] inline blt::size_t argc() const
|
[[nodiscard]] inline blt::size_t argc() const
|
||||||
|
@ -56,7 +55,7 @@ namespace fb
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string& getType()
|
[[nodiscard]] inline type_id getType() const
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* <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 LILFBTF5_TYPE_H
|
||||||
|
#define LILFBTF5_TYPE_H
|
||||||
|
|
||||||
|
#include <lilfbtf/fwddecl.h>
|
||||||
|
#include <blt/std/hashmap.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace fb
|
||||||
|
{
|
||||||
|
class type_engine_t
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
blt::hashmap_t<std::string, type_id> name_to_id;
|
||||||
|
// also used to assign IDs
|
||||||
|
std::vector<std::string> id_to_name;
|
||||||
|
// TODO: we don't need a hashmap for this.
|
||||||
|
// Also a bad idea to store references, however these functions should be declared statically so this isn't as big of an issue.
|
||||||
|
blt::hashmap_t<type_id, std::reference_wrapper<func_t_call_t>> functions;
|
||||||
|
public:
|
||||||
|
type_engine_t() = default;
|
||||||
|
|
||||||
|
type_id register_type(const std::string& type_name)
|
||||||
|
{
|
||||||
|
type_id id = id_to_name.size();
|
||||||
|
id_to_name.push_back(type_name);
|
||||||
|
name_to_id[type_name] = id;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void register_function(const std::string& type_name, func_t_call_t& func)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //LILFBTF5_TYPE_H
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* <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/>.
|
||||||
|
*/
|
||||||
|
#include <lilfbtf/system.h>
|
||||||
|
|
||||||
|
namespace fb
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* <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/>.
|
||||||
|
*/
|
||||||
|
#include <lilfbtf/type.h>
|
||||||
|
|
||||||
|
namespace fb
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue