Commit 5aa1818e authored by Dominik Charousset's avatar Dominik Charousset

Add backwards compatibility functions

parent 01e5078d
......@@ -367,7 +367,6 @@ public:
virtual bool await_data(timeout_type timeout);
/// Returns the next element from the mailbox or `nullptr`.
/// The default implementation simply returns `next_message()`.
virtual mailbox_element_ptr dequeue();
/// Returns the queue for storing incoming messages.
......@@ -418,6 +417,16 @@ public:
sec build_pipeline(stream_slot in, stream_slot out, stream_manager_ptr mgr);
// -- backwards compatibility ------------------------------------------------
inline mailbox_element_ptr next_message() {
return dequeue();
}
inline bool has_next_message() {
return !mailbox_.empty();
}
/// @endcond
private:
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2017 *
* 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. *
******************************************************************************/
#ifndef CAF_DETAIL_ENQUEUE_RESULT_HPP
#define CAF_DETAIL_ENQUEUE_RESULT_HPP
#include "caf/intrusive/inbox_result.hpp"
namespace caf {
namespace detail {
/// Alias for backwards compatibility.
using enqueue_result = intrusive::inbox_result;
} // namespace intrusive
} // namespace caf
#endif // CAF_DETAIL_ENQUEUE_RESULT_HPP
......@@ -36,6 +36,8 @@
#include "caf/intrusive/lifo_inbox.hpp"
#include "caf/intrusive/new_round_result.hpp"
#include "caf/detail/enqueue_result.hpp"
namespace caf {
namespace intrusive {
......@@ -71,11 +73,6 @@ public:
// -- queue and stack status functions ---------------------------------------
/// Returns an approximation of the current size.
size_t count(size_t) noexcept CAF_DEPRECATED {
return size();
}
/// Returns an approximation of the current size.
size_t size() noexcept {
fetch_more();
......@@ -98,10 +95,12 @@ public:
return inbox_.blocked();
}
/// Appends `ptr` to the inbox.
inbox_result push_back(pointer ptr) noexcept {
return inbox_.push_front(ptr);
}
/// Appends `ptr` to the inbox.
inbox_result push_back(unique_pointer ptr) noexcept {
return push_back(ptr.release());
}
......@@ -111,6 +110,24 @@ public:
return push_back(new value_type(std::forward<Ts>(xs)...));
}
// -- backwards compatibility ------------------------------------------------
/// @cond PRIVATE
detail::enqueue_result enqueue(pointer ptr) noexcept {
return static_cast<detail::enqueue_result>(inbox_.push_front(ptr));
}
size_t count() noexcept {
return size();
}
size_t count(size_t) noexcept {
return size();
}
/// @endcond
// -- queue management -------------------------------------------------------
void flush_cache() noexcept {
......
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