#ifndef ALSK_ALSK_IMPL_IMPLEMENT_H #define ALSK_ALSK_IMPL_IMPLEMENT_H #include #include "callable.h" #include "../context/context.h" #include "../executor/traits.h" namespace alsk { /** * @brief implement a skeleton * @param TExecutor the executor template * @param Skeleton the skeleton type * @param Context [optional] the type of the context * * @return a callable */ template class TExecutor, typename Skeleton, typename Context = DefaultContext, std::enable_if_t>* = nullptr, std::enable_if_t>>* = nullptr > auto implement() { using Executor = TExecutor; using State = CallableState; using ImplType = Impl; return Callable(Skeleton{}, Executor{}); } /** * @brief implement a skeleton * @param executor an instance of the executor * @param skeleton an instance of the skeleton to implement * @param Context [optional] the type of the context * * @return a callable */ template>* = nullptr, std::enable_if_t>* = nullptr > auto implement(Executor&& executor, S&& skeleton) { using ExecutorT = std::decay_t; using State = CallableState; using ImplType = Impl, typename ExecutorT::Tag, ExecutorT, State>; return Callable(std::forward(skeleton), std::forward(executor)); } } #endif