Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_systems
DVarSystem
DVarListener.cpp
Go to the documentation of this file.
1
#include "
DVarListener.hpp
"
2
#include "
DVarSystem.hpp
"
3
4
namespace
iv
5
{
6
7
DVarListener::DVarListener
(
Instance
* inst ) :
8
inst( inst ),
9
dvs( inst->getSystemContainer()->getSystem<
DVarSystem
>() )
10
{
11
}
12
13
DVarListener::~DVarListener
()
14
{
15
if
( this->dvs )
16
for
(
DVarId
id
: this->listenings )
17
this->dvs->
remove_listener
(
this
,
id
);
18
}
19
20
Instance
*
DVarListener::instance
()
21
{
22
return
this->inst;
23
}
24
25
void
DVarListener::start_dvar_listening
(
DVarId
id
)
26
{
27
if
( this->dvs )
28
{
29
this->listenings.insert(
id
);
30
this->dvs->
add_listener
(
this
,
id
);
31
}
32
}
33
34
void
DVarListener::stop_dvar_listening
(
DVarId
id
)
35
{
36
if
( this->dvs )
37
{
38
this->listenings.erase(
id
);
39
this->dvs->
remove_listener
(
this
,
id
);
40
}
41
}
42
43
}