7 #ifndef _A_UTILS_LOOPER_HEADER_
8 #define _A_UTILS_LOOPER_HEADER_
38 typedef std::shared_ptr<ImplBase> shared_base_type;
44 std::promise<void> m_oLoopStateAck;
45 std::mutex m_oStateMutex;
46 std::condition_variable m_oWakeup;
49 virtual void Run() = 0;
52 template<
typename Callable>
57 Impl(Callable&& pFunc) : pFunc(std::forward<Callable>(pFunc))
67 template<
typename Callable>
68 std::shared_ptr<Impl<Callable>> MakeCallable(Callable&& pFunc)
70 return std::make_shared<Impl<Callable>>(std::forward<Callable>(pFunc));
73 shared_base_type m_pCallable;
82 template<
typename ...Args>
87 template<
typename Callable,
typename ...Args>
90 m_pCallable = MakeCallable(std::bind(std::forward<Callable>(pFunc),
91 std::forward<Args>(args)...));
105 std::function<void()> GetCallable()
107 return std::bind(CallableHelper, m_pCallable);
111 static tVoid CallableHelper(shared_base_type pImpl);
void tVoid
The tVoid is always the definition for the void (non-type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
The looper helper class is a managed endless loop, which can be suspended.
@ Suspended
loop is suspended
@ Destroyed
loop is finished or only constructed
A common result class usable as return value throughout.
#define tTrue
Value for tBool.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.