Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_systems
ResourceManagementSystem
SingularResource.inl
Go to the documentation of this file.
1
namespace
iv
2
{
3
4
template
<
class
RT >
5
SingularResource< RT >::SingularResource
(
Instance
* inst,
ResourcePath
const
& path ) :
6
cm( inst, this,
"SingularResource"
),
7
access( inst ),
8
resource( nullptr )
9
{
10
this->cm.owns( this->access.cm );
11
this->path( path );
12
}
13
14
template
<
class
RT >
15
Instance
*
SingularResource< RT >::instance
()
const
16
{
17
return
this->access.
instance
();
18
}
19
20
template
<
class
RT >
21
void
SingularResource< RT >::path
(
ResourcePath
const
& path )
22
{
23
if
( path ==
ResourcePath
() || path ==
ResourcePath
(
"/"
) )
24
this->resource =
nullptr
;
25
else
26
this->resource = this->access.template get< RT >( path );
27
}
28
29
template
<
class
RT >
30
RT
const
*
SingularResource< RT >::get
()
const
31
{
32
return
this->resource;
33
}
34
35
template
<
class
RT >
36
RT
const
&
SingularResource< RT >::operator*
()
const
37
{
38
return
*this->resource;
39
}
40
41
template
<
class
RT >
42
RT
const
*
SingularResource< RT >::operator->
()
const
43
{
44
return
this->resource;
45
}
46
47
}