BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Main Page
Related Pages
Data Structures
Files
File List
base
src
util
Castable.h
1
#pragma once
2
3
#include <typeinfo>
4
5
namespace
BeeeOn {
6
7
class
Castable
{
8
public
:
9
template
<
typename
T>
10
bool
is()
11
{
12
return
dynamic_cast<
T *
>
(
this
) !=
nullptr
;
13
}
14
15
template
<
typename
T>
16
bool
is()
const
17
{
18
return
dynamic_cast<
const
T *
>
(
this
) !=
nullptr
;
19
}
20
21
template
<
typename
C>
22
const
C &cast()
const
23
{
24
return
dynamic_cast<
const
C &
>
(*this);
25
}
26
27
template
<
typename
C>
28
C &cast()
29
{
30
return
dynamic_cast<
C &
>
(*this);
31
}
32
33
protected
:
34
virtual
~
Castable
()
35
{
36
}
37
};
38
39
}
BeeeOn::Castable
Definition:
Castable.h:7
Generated by
1.8.5