IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
modules
public
ice
module_register.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/mem_unique_ptr.hxx
>
6
#include <
ice/mem_allocator_stack.hxx
>
7
#include <
ice/string.hxx
>
8
#include <
ice/stringid.hxx
>
9
#include <
ice/array.hxx
>
10
#include <
ice/module_negotiator.hxx
>
11
#include <
ice/module_query.hxx
>
12
#include <
ice/module.hxx
>
13
14
namespace
ice
15
{
16
18
class
ModuleRegister
:
public
ice::ModuleQuery
19
{
20
public
:
21
virtual
~ModuleRegister
() noexcept = default;
22
27
virtual
bool
load_module
(
28
ice
::
Allocator
&
alloc
,
29
ice
::
String
path
30
) noexcept = 0;
31
37
virtual
bool
load_module
(
38
ice
::
Allocator
&
alloc
,
39
ice
::
FnModuleLoad
* load_fn,
40
ice
::
FnModuleUnload
* unload_fn,
41
bool
from_shared_library
42
) noexcept = 0;
43
45
virtual
bool
load_module
(
ice
::
Allocator
&
alloc
,
ice
::
ModuleInfo
const& module_info) noexcept
46
{
47
return
this->
load_module
(alloc, module_info.fn_load, module_info.fn_unload,
true
);
48
}
49
51
template
<
typename
T>
requires
(
ice::concepts::ModuleType<T>
||
ice::concepts::ModuleLoadable<T>
)
52
bool
load_module
(
ice::Allocator
&
alloc
)
noexcept
53
{
54
return
this->
load_module
(alloc, T::module_info());
55
}
56
};
57
61
auto
load_global_modules
(
62
ice::Allocator
&
alloc
,
63
ice::ModuleRegister
& modules_register
64
)
noexcept
->
ice::u32
;
65
69
auto
create_default_module_register
(
70
ice::Allocator
&
alloc
,
71
bool
load_global_modules
=
true
72
) noexcept ->
ice
::
UniquePtr
<
ice
::
ModuleRegister
>;
73
74
}
// namespace ice
ice::ModuleRegister
Type to manage loading and unloading of modules and their APIs.
Definition
module_register.hxx:19
ice::ModuleRegister::~ModuleRegister
virtual ~ModuleRegister() noexcept=default
ice::ModuleRegister::load_module
virtual bool load_module(ice::Allocator &alloc, ice::String path) noexcept=0
Loads a module from a given path.
ice::ModuleRegister::load_module
bool load_module(ice::Allocator &alloc) noexcept
Loads a module using a module type. This is the preferred way of loading modules implicitly.
Definition
module_register.hxx:52
array.hxx
ice::concepts::ModuleLoadable
Definition
module_concepts.hxx:41
ice::concepts::ModuleType
Definition
module_concepts.hxx:54
mem_allocator_stack.hxx
mem_unique_ptr.hxx
module.hxx
module_negotiator.hxx
module_query.hxx
ice::path
Definition
path_utils.hxx:10
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::String
ice::BasicString< char > String
Definition
string.hxx:82
ice::FnModuleLoad
void(ice::Allocator *, ice::ModuleNegotiatorAPIContext *, ice::ModuleNegotiatorAPI *) FnModuleLoad
Definition
module_types.hxx:23
ice::alloc
auto alloc(ice::usize size) noexcept -> ice::AllocResult
ice::load_global_modules
auto load_global_modules(ice::Allocator &alloc, ice::ModuleRegister &modules_register) noexcept -> ice::u32
Loads all modules available in the current executable.
ice::FnModuleUnload
void(ice::Allocator *) FnModuleUnload
Definition
module_types.hxx:24
ice::u32
std::uint32_t u32
Definition
types.hxx:26
ice::Allocator
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition
mem_types.hxx:25
ice::create_default_module_register
auto create_default_module_register(ice::Allocator &alloc, bool load_global_modules=true) noexcept -> ice::UniquePtr< ice::ModuleRegister >
Creates a default module register.
string.hxx
stringid.hxx
ice::ModuleInfo
Stores information of module load and unload functions.
Definition
module_info.hxx:12
ice::ModuleQuery
Definition
module_query.hxx:14
ice::UniquePtr
Definition
mem_unique_ptr.hxx:25
Generated by
1.18.0