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

Add missing property getters to typed actor view

parent 921ab3c7
......@@ -88,7 +88,7 @@ public:
}
/// Returns the logical actor address.
actor_addr address() const;
actor_addr address() const noexcept;
/// Detaches the first attached object that matches `what`.
virtual size_t detach(const attachable::token& what) = 0;
......
......@@ -177,27 +177,27 @@ public:
// -- miscellaneous actor operations -----------------------------------------
/// Returns the execution unit currently used by this actor.
inline execution_unit* context() const {
execution_unit* context() const noexcept {
return context_;
}
/// Sets the execution unit for this actor.
inline void context(execution_unit* x) {
void context(execution_unit* x) noexcept {
context_ = x;
}
/// Returns the hosting actor system.
inline actor_system& system() const {
actor_system& system() const noexcept {
return home_system();
}
/// Returns the config of the hosting actor system.
inline const actor_system_config& config() const {
const actor_system_config& config() const noexcept {
return system().config();
}
/// Returns the clock of the actor system.
inline actor_clock& clock() const {
actor_clock& clock() const noexcept {
return home_system().clock();
}
......@@ -209,20 +209,20 @@ public:
/// Returns a pointer to the sender of the current message.
/// @pre `current_mailbox_element() != nullptr`
inline strong_actor_ptr& current_sender() {
strong_actor_ptr& current_sender() noexcept {
CAF_ASSERT(current_element_);
return current_element_->sender;
}
/// Returns the ID of the current message.
inline message_id current_message_id() {
message_id current_message_id() noexcept {
CAF_ASSERT(current_element_);
return current_element_->mid;
}
/// Returns the ID of the current message and marks the ID stored in the
/// current mailbox element as answered.
inline message_id take_current_message_id() {
message_id take_current_message_id() noexcept {
CAF_ASSERT(current_element_);
auto result = current_element_->mid;
current_element_->mid.mark_as_answered();
......@@ -230,14 +230,14 @@ public:
}
/// Marks the current message ID as answered.
inline void drop_current_message_id() {
void drop_current_message_id() noexcept {
CAF_ASSERT(current_element_);
current_element_->mid.mark_as_answered();
}
/// Returns a pointer to the next stage from the forwarding path of the
/// current message or `nullptr` if the path is empty.
inline strong_actor_ptr current_next_stage() {
strong_actor_ptr current_next_stage() noexcept {
CAF_ASSERT(current_element_);
auto& stages = current_element_->stages;
if (!stages.empty())
......@@ -248,7 +248,7 @@ public:
/// Returns a pointer to the next stage from the forwarding path of the
/// current message and removes it from the path. Returns `nullptr` if the
/// path is empty.
inline strong_actor_ptr take_current_next_stage() {
strong_actor_ptr take_current_next_stage() {
CAF_ASSERT(current_element_);
auto& stages = current_element_->stages;
if (!stages.empty()) {
......@@ -260,25 +260,25 @@ public:
}
/// Returns the forwarding stack from the current mailbox element.
const mailbox_element::forwarding_stack& current_forwarding_stack() {
const mailbox_element::forwarding_stack& current_forwarding_stack() noexcept {
CAF_ASSERT(current_element_);
return current_element_->stages;
}
/// Moves the forwarding stack from the current mailbox element.
mailbox_element::forwarding_stack take_current_forwarding_stack() {
mailbox_element::forwarding_stack take_current_forwarding_stack() noexcept {
CAF_ASSERT(current_element_);
return std::move(current_element_->stages);
}
/// Returns a pointer to the currently processed mailbox element.
inline mailbox_element* current_mailbox_element() {
mailbox_element* current_mailbox_element() noexcept {
return current_element_;
}
/// Returns a pointer to the currently processed mailbox element.
/// @private
inline void current_mailbox_element(mailbox_element* ptr) {
void current_mailbox_element(mailbox_element* ptr) noexcept {
current_element_ = ptr;
}
......@@ -321,7 +321,7 @@ public:
}
/// Creates a `response_promise` to respond to a request later on.
inline response_promise make_response_promise() {
response_promise make_response_promise() {
return make_response_promise<response_promise>();
}
......@@ -352,7 +352,7 @@ public:
/// Returns the currently defined fail state. If this reason is not
/// `none` then the actor will terminate with this error after executing
/// the current message handler.
inline const error& fail_state() const {
const error& fail_state() const noexcept {
return fail_state_;
}
......@@ -361,7 +361,7 @@ public:
/// @cond PRIVATE
template <class ActorHandle>
inline ActorHandle eval_opts(spawn_options opts, ActorHandle res) {
ActorHandle eval_opts(spawn_options opts, ActorHandle res) {
if (has_monitor_flag(opts))
monitor(res->address());
if (has_link_flag(opts))
......@@ -371,7 +371,7 @@ public:
// returns 0 if last_dequeued() is an asynchronous or sync request message,
// a response id generated from the request id otherwise
inline message_id get_response_id() const {
message_id get_response_id() const {
auto mid = current_element_->mid;
return (mid.is_request()) ? mid.response_id() : message_id();
}
......
......@@ -67,11 +67,81 @@ public:
// -- properties -------------------------------------------------------------
/// @copydoc abstract_actor::address
auto address() const noexcept {
return self_->address();
}
/// @copydoc abstract_actor::id
auto id() const noexcept {
return self_->id();
}
/// @copydoc abstract_actor::node
auto node() const noexcept {
return self_->node();
}
/// @copydoc abstract_actor::home_system
auto& home_system() const noexcept {
return self_->home_system();
}
/// @copydoc local_actor::context
auto context() const noexcept {
return self_->context();
}
/// @copydoc local_actor::system
auto& system() const noexcept {
return self_->system();
}
/// @copydoc local_actor::config
const auto& config() const noexcept {
return self_->config();
}
/// @copydoc local_actor::clock
auto& clock() const noexcept {
return self_->clock();
}
/// @copydoc local_actor::current_sender
auto& current_sender() noexcept {
return self_->current_sender();
}
/// @copydoc local_actor::current_message_id
auto current_message_id() noexcept {
return self_->current_message_id();
}
/// @copydoc local_actor::current_mailbox_element
auto* current_mailbox_element() {
return self_->current_mailbox_element();
}
/// @copydoc local_actor::fail_state
const auto& fail_state() const {
return self_->fail_state();
}
/// @copydoc scheduled_actor::mailbox
auto& mailbox() noexcept {
return self_->mailbox();
}
/// @copydoc scheduled_actor::stream_managers
auto& stream_managers() noexcept {
return self_->stream_managers();
}
/// @copydoc scheduled_actor::pending_stream_managers
auto& pending_stream_managers() noexcept {
return self_->pending_stream_managers();
}
// -- event handlers ---------------------------------------------------------
/// @copydoc scheduled_actor::set_default_handler
......@@ -160,18 +230,6 @@ public:
// -- miscellaneous actor operations -----------------------------------------
execution_unit* context() const {
return self_->context();
}
actor_system& system() const {
return self_->system();
}
actor_system& home_system() const {
return self_->home_system();
}
void quit(exit_reason reason = exit_reason::normal) {
self_->quit(reason);
}
......@@ -220,17 +278,6 @@ public:
return self_->delegate(dest, std::forward<Ts>(xs)...);
}
/// Returns a pointer to the sender of the current message.
/// @pre `current_mailbox_element() != nullptr`
strong_actor_ptr& current_sender() {
return self_->current_sender();
}
/// Returns a pointer to the currently processed mailbox element.
mailbox_element* current_mailbox_element() {
return self_->current_mailbox_element();
}
/// @private
actor_control_block* ctrl() const noexcept {
CAF_ASSERT(self_ != nullptr);
......
......@@ -66,7 +66,7 @@ abstract_actor::abstract_actor(actor_config& cfg)
// nop
}
actor_addr abstract_actor::address() const {
actor_addr abstract_actor::address() const noexcept {
return actor_addr{actor_control_block::from(this)};
}
......
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