Commit 7ad680ec authored by Dominik Charousset's avatar Dominik Charousset

Enable anon_send in composable behaviors

parent 70f560bc
...@@ -65,9 +65,10 @@ struct is_weak_ptr { ...@@ -65,9 +65,10 @@ struct is_weak_ptr {
}; };
template <class T> template <class T>
struct is_weak_ptr<T*> { struct is_weak_ptr<T*> : std::false_type {};
static constexpr bool value = false;
}; template <class... Ts>
struct is_weak_ptr<typed_actor_pointer<Ts...>> : std::false_type {};
template <class T> template <class T>
struct is_non_null_handle { struct is_non_null_handle {
......
...@@ -44,6 +44,7 @@ template <class, class, int> class actor_cast_access; ...@@ -44,6 +44,7 @@ template <class, class, int> class actor_cast_access;
template <class...> class result; template <class...> class result;
template <class...> class delegated; template <class...> class delegated;
template <class...> class typed_actor; template <class...> class typed_actor;
template <class...> class typed_actor_pointer;
template <class...> class typed_response_promise; template <class...> class typed_response_promise;
template <class...> class typed_event_based_actor; template <class...> class typed_event_based_actor;
......
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
>::type >::type
>::value, >::value,
"this actor does not accept the response message"); "this actor does not accept the response message");
this->system().scheduler().delayed_send( dptr()->system().scheduler().delayed_send(
rtime, this->ctrl(), actor_cast<strong_actor_ptr>(dest), rtime, this->ctrl(), actor_cast<strong_actor_ptr>(dest),
message_id::make(P), make_message(std::forward<Ts>(xs)...)); message_id::make(P), make_message(std::forward<Ts>(xs)...));
} }
...@@ -161,10 +161,15 @@ public: ...@@ -161,10 +161,15 @@ public:
token token
>::value, >::value,
"receiver does not accept given message"); "receiver does not accept given message");
this->system().scheduler().delayed_send( dptr()->system().scheduler().delayed_send(
rtime, nullptr, actor_cast<strong_actor_ptr>(dest), rtime, nullptr, actor_cast<strong_actor_ptr>(dest),
message_id::make(P), make_message(std::forward<Ts>(xs)...)); message_id::make(P), make_message(std::forward<Ts>(xs)...));
} }
private:
Subtype* dptr() {
return static_cast<Subtype*>(this);
}
}; };
} // namespace mixin } // namespace mixin
......
...@@ -29,6 +29,9 @@ namespace caf { ...@@ -29,6 +29,9 @@ namespace caf {
template <class... Sigs> template <class... Sigs>
class typed_actor_pointer { class typed_actor_pointer {
public: public:
/// Stores the template parameter pack.
using signatures = detail::type_list<Sigs...>;
template <class Supertype> template <class Supertype>
typed_actor_pointer(Supertype* selfptr) : view_(selfptr) { typed_actor_pointer(Supertype* selfptr) : view_(selfptr) {
using namespace caf::detail; using namespace caf::detail;
...@@ -47,6 +50,11 @@ public: ...@@ -47,6 +50,11 @@ public:
return &view_; return &view_;
} }
/// @private
actor_control_block* get() const {
return actor_control_block::from(view_.selfptr());
}
private: private:
typed_actor_view<Sigs...> view_; typed_actor_view<Sigs...> view_;
}; };
......
...@@ -95,6 +95,11 @@ public: ...@@ -95,6 +95,11 @@ public:
return self_->response(std::forward<Ts>(xs)...); return self_->response(std::forward<Ts>(xs)...);
} }
/// @private
scheduled_actor* selfptr() const {
return self_;
}
private: private:
scheduled_actor* self_; scheduled_actor* self_;
}; };
......
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