Commit 349e1940 authored by Dominik Charousset's avatar Dominik Charousset

Templatize default_invoke_result_visitor

parent eaf70871
...@@ -38,7 +38,6 @@ set (LIBCAF_CORE_SRCS ...@@ -38,7 +38,6 @@ set (LIBCAF_CORE_SRCS
src/config_option.cpp src/config_option.cpp
src/continue_helper.cpp src/continue_helper.cpp
src/decorated_tuple.cpp src/decorated_tuple.cpp
src/default_invoke_result_visitor.cpp
src/default_attachable.cpp src/default_attachable.cpp
src/deserializer.cpp src/deserializer.cpp
src/duration.cpp src/duration.cpp
......
...@@ -27,13 +27,16 @@ ...@@ -27,13 +27,16 @@
namespace caf { namespace caf {
namespace detail { namespace detail {
template <class Self>
class default_invoke_result_visitor : public invoke_result_visitor { class default_invoke_result_visitor : public invoke_result_visitor {
public: public:
inline default_invoke_result_visitor(local_actor* ptr) : self_(ptr) { inline default_invoke_result_visitor(Self* ptr) : self_(ptr) {
// nop // nop
} }
~default_invoke_result_visitor(); ~default_invoke_result_visitor() {
// nop
}
void operator()() override { void operator()() override {
// nop // nop
...@@ -83,7 +86,7 @@ private: ...@@ -83,7 +86,7 @@ private:
deliver(rp, x); deliver(rp, x);
} }
local_actor* self_; Self* self_;
}; };
} // namespace detail } // namespace detail
......
...@@ -301,7 +301,7 @@ void blocking_actor::receive_impl(receive_cond& rcc, ...@@ -301,7 +301,7 @@ void blocking_actor::receive_impl(receive_cond& rcc,
cached_sequence seq1{mailbox().cache()}; cached_sequence seq1{mailbox().cache()};
mailbox_sequence seq2{this, bhvr.timeout()}; mailbox_sequence seq2{this, bhvr.timeout()};
message_sequence_combinator seq{&seq1, &seq2}; message_sequence_combinator seq{&seq1, &seq2};
detail::default_invoke_result_visitor visitor{this}; detail::default_invoke_result_visitor<blocking_actor> visitor{this};
// read incoming messages until we have a match or a timeout // read incoming messages until we have a match or a timeout
for (;;) { for (;;) {
// check loop pre-condition // check loop pre-condition
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/detail/default_invoke_result_visitor.hpp"
namespace caf {
namespace detail {
default_invoke_result_visitor::~default_invoke_result_visitor() {
// nop
}
} // namespace detail
} // namespace caf
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "caf/detail/private_thread.hpp" #include "caf/detail/private_thread.hpp"
#include "caf/detail/sync_request_bouncer.hpp" #include "caf/detail/sync_request_bouncer.hpp"
#include "caf/detail/default_invoke_result_visitor.hpp"
namespace caf { namespace caf {
......
...@@ -422,7 +422,7 @@ invoke_message_result scheduled_actor::consume(mailbox_element& x) { ...@@ -422,7 +422,7 @@ invoke_message_result scheduled_actor::consume(mailbox_element& x) {
return im_success; return im_success;
} }
case message_category::ordinary: { case message_category::ordinary: {
detail::default_invoke_result_visitor visitor{this}; detail::default_invoke_result_visitor<scheduled_actor> visitor{this};
bool skipped = false; bool skipped = false;
auto had_timeout = getf(has_timeout_flag); auto had_timeout = getf(has_timeout_flag);
if (had_timeout) if (had_timeout)
......
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