CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
context.h
Go to the documentation of this file.
1
#ifndef __CONTEXT_H
2
#define __CONTEXT_H
3
4
#include <memory>
5
#include <tuple>
6
13
template
<
typename
... Args>
struct
Context
{
20
Context
(
Args
*...
args
)
21
// need explicitely mark unique_ptr type as GCC 5 fails to deduce type
22
: _implsPtr(std::
unique_ptr
<
Args
>(
args
)...)
23
{
24
}
25
31
template
<
typename
T>
T
&
get
()
const
32
{
33
return
*std::get<std::unique_ptr<T>>(_implsPtr).
get
();
34
}
35
36
private
:
37
std::tuple<std::unique_ptr<Args>...> _implsPtr;
38
};
39
40
struct
CanDeviceInterface
;
41
typedef
Context<CanDeviceInterface>
CanDeviceCtx
;
42
43
struct
CRSGuiInterface
;
44
struct
NLMFactoryInterface
;
45
typedef
Context<CRSGuiInterface, NLMFactoryInterface>
CanRawSenderCtx
;
46
47
struct
CRVGuiInterface
;
48
typedef
Context<CRVGuiInterface>
CanRawViewCtx
;
49
50
#endif
/* !__CONTEXT_H */
CanRawSenderCtx
Context< CRSGuiInterface, NLMFactoryInterface > CanRawSenderCtx
Definition
context.h:45
CanRawViewCtx
Context< CRVGuiInterface > CanRawViewCtx
Definition
context.h:48
CanDeviceCtx
Context< CanDeviceInterface > CanDeviceCtx
Definition
context.h:41
CRSGuiInterface
Definition
crsguiinterface.h:12
CRVGuiInterface
Definition
crvguiinterface.h:10
CanDeviceInterface
Definition
candeviceinterface.h:8
Context
Definition
context.h:13
Context::get
T & get() const
Definition
context.h:31
Context::Context
Context(Args *... args)
Definition
context.h:20
NLMFactoryInterface
Definition
nlmfactoryinterface.h:8
src
common
context.h
Generated by
1.9.8