Commit 62ffbbbe authored by ufownl's avatar ufownl

Typed stateful broker

Add necessary template alias and template specialization, so we can
implement typed_stateful_broker using stateful_actor.
parent e140966f
...@@ -126,6 +126,24 @@ struct infer_handle_from_fun_impl<Result, ...@@ -126,6 +126,24 @@ struct infer_handle_from_fun_impl<Result,
static constexpr spawn_mode mode = spawn_mode::function_with_selfptr; static constexpr spawn_mode mode = spawn_mode::function_with_selfptr;
}; };
// statically typed stateful broker with self pointer
template <class Result, class State, class... Sigs>
struct infer_handle_from_fun_impl<Result,
experimental::stateful_actor<
State,
io::experimental::typed_broker<Sigs...>
>*,
true> {
using type = typed_actor<Sigs...>;
using impl =
experimental::stateful_actor<
State,
io::experimental::typed_broker<Sigs...>
>;
using behavior_type = typed_behavior<Sigs...>;
static constexpr spawn_mode mode = spawn_mode::function_with_selfptr;
};
template <class F, class Trait = typename detail::get_callable_trait<F>::type> template <class F, class Trait = typename detail::get_callable_trait<F>::type>
struct infer_handle_from_fun { struct infer_handle_from_fun {
using result_type = typename Trait::result_type; using result_type = typename Trait::result_type;
......
...@@ -104,6 +104,16 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>, ...@@ -104,6 +104,16 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
template <class State> template <class State>
using stateful_pointer = experimental::stateful_actor<State, base>*; using stateful_pointer = experimental::stateful_actor<State, base>*;
/// Identifies the broker_base class for this kind of actor with actor.
template <class State>
using stateful_broker_base =
experimental::stateful_actor<State, broker_base>;
/// Identifies the broker_base class for this kind of actor with actor.
template <class State>
using stateful_broker_pointer =
experimental::stateful_actor<State, broker_base>*;
typed_actor() = default; typed_actor() = default;
typed_actor(typed_actor&&) = default; typed_actor(typed_actor&&) = default;
typed_actor(const typed_actor&) = default; typed_actor(const typed_actor&) = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment