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
13template <typename... Args> struct Context {
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
36private:
37 std::tuple<std::unique_ptr<Args>...> _implsPtr;
38};
39
42
43struct CRSGuiInterface;
46
47struct CRVGuiInterface;
49
50#endif /* !__CONTEXT_H */
Context< CRSGuiInterface, NLMFactoryInterface > CanRawSenderCtx
Definition context.h:45
Context< CRVGuiInterface > CanRawViewCtx
Definition context.h:48
Context< CanDeviceInterface > CanDeviceCtx
Definition context.h:41
Definition crsguiinterface.h:12
Definition crvguiinterface.h:10
Definition candeviceinterface.h:8
Definition context.h:13
T & get() const
Definition context.h:31
Context(Args *... args)
Definition context.h:20
Definition nlmfactoryinterface.h:8