Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_systems
DelayedLoadSystem
DelayedLoadSystem.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
DelayedLoad.hpp
"
4
#include <
ivorium_core/ivorium_core.hpp
>
5
#include <unordered_map>
6
7
namespace
iv
8
{
9
10
class
DelayedLoader;
11
12
class
DelayedLoadStatus
13
{
14
public
:
15
DelayedLoadStatus
();
16
17
int
items_total
;
18
int
items_done
;
19
int
complexity_total
;
20
int
complexity_done
;
21
};
22
25
class
DelayedLoadSystem
:
public
System
26
{
27
public
:
28
DelayedLoadSystem
(
SystemContainer
* sc );
29
virtual
std::string
debug_name
()
const override
{
return
"DelayedLoadSystem"
; }
30
31
bool
loadStep
();
32
33
//--------------------- DelayedLoadSystem --------------------
37
void
QueueDelayedLoad
(
DelayedLoad
* load,
int
complexity_bytes );
38
void
ClearDelayedLoad
(
DelayedLoad
* load );
39
43
void
loader_register
(
DelayedLoader
* );
44
void
loader_unregister
(
DelayedLoader
* );
45
void
BlockLoading
(
DelayedLoader
*,
bool
block );
46
bool
LoadingRunning
();
47
51
DelayedLoadStatus
const
&
Status
();
52
53
private
:
54
void
Notify_LoadStart();
55
void
Notify_LoadFinish();
56
void
Notify_ItemQueued(
DelayedLoad
const
* item,
int
complexity_bytes );
57
void
Notify_ItemLoaded(
DelayedLoad
const
* item,
int
complexity_bytes );
58
59
private
:
60
std::unordered_map< DelayedLoad *, int > _to_load;
61
62
volatile_set< DelayedLoader * >
_loaders;
63
volatile_set< DelayedLoader * >
_blockers;
64
65
bool
_loading;
66
DelayedLoadStatus
status;
67
};
68
69
}