Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
11ff1257
Unverified
Commit
11ff1257
authored
Apr 10, 2020
by
Dominik Charousset
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1084
Add missing property getters to typed actor view
parents
5fc5bd29
7e11ab80
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
44 deletions
+91
-44
libcaf_core/caf/abstract_actor.hpp
libcaf_core/caf/abstract_actor.hpp
+1
-1
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+19
-19
libcaf_core/caf/typed_actor_view.hpp
libcaf_core/caf/typed_actor_view.hpp
+70
-23
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+1
-1
No files found.
libcaf_core/caf/abstract_actor.hpp
View file @
11ff1257
...
@@ -88,7 +88,7 @@ public:
...
@@ -88,7 +88,7 @@ public:
}
}
/// Returns the logical actor address.
/// Returns the logical actor address.
actor_addr
address
()
const
;
actor_addr
address
()
const
noexcept
;
/// Detaches the first attached object that matches `what`.
/// Detaches the first attached object that matches `what`.
virtual
size_t
detach
(
const
attachable
::
token
&
what
)
=
0
;
virtual
size_t
detach
(
const
attachable
::
token
&
what
)
=
0
;
...
...
libcaf_core/caf/local_actor.hpp
View file @
11ff1257
...
@@ -177,27 +177,27 @@ public:
...
@@ -177,27 +177,27 @@ public:
// -- miscellaneous actor operations -----------------------------------------
// -- miscellaneous actor operations -----------------------------------------
/// Returns the execution unit currently used by this actor.
/// Returns the execution unit currently used by this actor.
inline
execution_unit
*
context
()
cons
t
{
execution_unit
*
context
()
const
noexcep
t
{
return
context_
;
return
context_
;
}
}
/// Sets the execution unit for this actor.
/// Sets the execution unit for this actor.
inline
void
context
(
execution_unit
*
x
)
{
void
context
(
execution_unit
*
x
)
noexcept
{
context_
=
x
;
context_
=
x
;
}
}
/// Returns the hosting actor system.
/// Returns the hosting actor system.
inline
actor_system
&
system
()
cons
t
{
actor_system
&
system
()
const
noexcep
t
{
return
home_system
();
return
home_system
();
}
}
/// Returns the config of the hosting actor system.
/// Returns the config of the hosting actor system.
inline
const
actor_system_config
&
config
()
cons
t
{
const
actor_system_config
&
config
()
const
noexcep
t
{
return
system
().
config
();
return
system
().
config
();
}
}
/// Returns the clock of the actor system.
/// Returns the clock of the actor system.
inline
actor_clock
&
clock
()
cons
t
{
actor_clock
&
clock
()
const
noexcep
t
{
return
home_system
().
clock
();
return
home_system
().
clock
();
}
}
...
@@ -209,20 +209,20 @@ public:
...
@@ -209,20 +209,20 @@ public:
/// Returns a pointer to the sender of the current message.
/// Returns a pointer to the sender of the current message.
/// @pre `current_mailbox_element() != nullptr`
/// @pre `current_mailbox_element() != nullptr`
inline
strong_actor_ptr
&
current_sender
()
{
strong_actor_ptr
&
current_sender
()
noexcept
{
CAF_ASSERT
(
current_element_
);
CAF_ASSERT
(
current_element_
);
return
current_element_
->
sender
;
return
current_element_
->
sender
;
}
}
/// Returns the ID of the current message.
/// Returns the ID of the current message.
inline
message_id
current_message_id
()
{
message_id
current_message_id
()
noexcept
{
CAF_ASSERT
(
current_element_
);
CAF_ASSERT
(
current_element_
);
return
current_element_
->
mid
;
return
current_element_
->
mid
;
}
}
/// Returns the ID of the current message and marks the ID stored in the
/// Returns the ID of the current message and marks the ID stored in the
/// current mailbox element as answered.
/// current mailbox element as answered.
inline
message_id
take_current_message_id
()
{
message_id
take_current_message_id
()
noexcept
{
CAF_ASSERT
(
current_element_
);
CAF_ASSERT
(
current_element_
);
auto
result
=
current_element_
->
mid
;
auto
result
=
current_element_
->
mid
;
current_element_
->
mid
.
mark_as_answered
();
current_element_
->
mid
.
mark_as_answered
();
...
@@ -230,14 +230,14 @@ public:
...
@@ -230,14 +230,14 @@ public:
}
}
/// Marks the current message ID as answered.
/// Marks the current message ID as answered.
inline
void
drop_current_message_id
()
{
void
drop_current_message_id
()
noexcept
{
CAF_ASSERT
(
current_element_
);
CAF_ASSERT
(
current_element_
);
current_element_
->
mid
.
mark_as_answered
();
current_element_
->
mid
.
mark_as_answered
();
}
}
/// Returns a pointer to the next stage from the forwarding path of the
/// Returns a pointer to the next stage from the forwarding path of the
/// current message or `nullptr` if the path is empty.
/// 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_
);
CAF_ASSERT
(
current_element_
);
auto
&
stages
=
current_element_
->
stages
;
auto
&
stages
=
current_element_
->
stages
;
if
(
!
stages
.
empty
())
if
(
!
stages
.
empty
())
...
@@ -248,7 +248,7 @@ public:
...
@@ -248,7 +248,7 @@ public:
/// Returns a pointer to the next stage from the forwarding path of the
/// 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
/// current message and removes it from the path. Returns `nullptr` if the
/// path is empty.
/// path is empty.
inline
strong_actor_ptr
take_current_next_stage
()
{
strong_actor_ptr
take_current_next_stage
()
{
CAF_ASSERT
(
current_element_
);
CAF_ASSERT
(
current_element_
);
auto
&
stages
=
current_element_
->
stages
;
auto
&
stages
=
current_element_
->
stages
;
if
(
!
stages
.
empty
())
{
if
(
!
stages
.
empty
())
{
...
@@ -260,25 +260,25 @@ public:
...
@@ -260,25 +260,25 @@ public:
}
}
/// Returns the forwarding stack from the current mailbox element.
/// 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_
);
CAF_ASSERT
(
current_element_
);
return
current_element_
->
stages
;
return
current_element_
->
stages
;
}
}
/// Moves the forwarding stack from the current mailbox element.
/// 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_
);
CAF_ASSERT
(
current_element_
);
return
std
::
move
(
current_element_
->
stages
);
return
std
::
move
(
current_element_
->
stages
);
}
}
/// Returns a pointer to the currently processed mailbox element.
/// Returns a pointer to the currently processed mailbox element.
inline
mailbox_element
*
current_mailbox_element
()
{
mailbox_element
*
current_mailbox_element
()
noexcept
{
return
current_element_
;
return
current_element_
;
}
}
/// Returns a pointer to the currently processed mailbox element.
/// Returns a pointer to the currently processed mailbox element.
/// @private
/// @private
inline
void
current_mailbox_element
(
mailbox_element
*
ptr
)
{
void
current_mailbox_element
(
mailbox_element
*
ptr
)
noexcept
{
current_element_
=
ptr
;
current_element_
=
ptr
;
}
}
...
@@ -321,7 +321,7 @@ public:
...
@@ -321,7 +321,7 @@ public:
}
}
/// Creates a `response_promise` to respond to a request later on.
/// 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
>
();
return
make_response_promise
<
response_promise
>
();
}
}
...
@@ -352,7 +352,7 @@ public:
...
@@ -352,7 +352,7 @@ public:
/// Returns the currently defined fail state. If this reason is not
/// Returns the currently defined fail state. If this reason is not
/// `none` then the actor will terminate with this error after executing
/// `none` then the actor will terminate with this error after executing
/// the current message handler.
/// the current message handler.
inline
const
error
&
fail_state
()
cons
t
{
const
error
&
fail_state
()
const
noexcep
t
{
return
fail_state_
;
return
fail_state_
;
}
}
...
@@ -361,7 +361,7 @@ public:
...
@@ -361,7 +361,7 @@ public:
/// @cond PRIVATE
/// @cond PRIVATE
template
<
class
ActorHandle
>
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
))
if
(
has_monitor_flag
(
opts
))
monitor
(
res
->
address
());
monitor
(
res
->
address
());
if
(
has_link_flag
(
opts
))
if
(
has_link_flag
(
opts
))
...
@@ -371,7 +371,7 @@ public:
...
@@ -371,7 +371,7 @@ public:
// returns 0 if last_dequeued() is an asynchronous or sync request message,
// returns 0 if last_dequeued() is an asynchronous or sync request message,
// a response id generated from the request id otherwise
// 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
;
auto
mid
=
current_element_
->
mid
;
return
(
mid
.
is_request
())
?
mid
.
response_id
()
:
message_id
();
return
(
mid
.
is_request
())
?
mid
.
response_id
()
:
message_id
();
}
}
...
...
libcaf_core/caf/typed_actor_view.hpp
View file @
11ff1257
...
@@ -67,11 +67,81 @@ public:
...
@@ -67,11 +67,81 @@ public:
// -- properties -------------------------------------------------------------
// -- 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
/// @copydoc scheduled_actor::mailbox
auto
&
mailbox
()
noexcept
{
auto
&
mailbox
()
noexcept
{
return
self_
->
mailbox
();
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 ---------------------------------------------------------
// -- event handlers ---------------------------------------------------------
/// @copydoc scheduled_actor::set_default_handler
/// @copydoc scheduled_actor::set_default_handler
...
@@ -160,18 +230,6 @@ public:
...
@@ -160,18 +230,6 @@ public:
// -- miscellaneous actor operations -----------------------------------------
// -- 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
)
{
void
quit
(
exit_reason
reason
=
exit_reason
::
normal
)
{
self_
->
quit
(
reason
);
self_
->
quit
(
reason
);
}
}
...
@@ -220,17 +278,6 @@ public:
...
@@ -220,17 +278,6 @@ public:
return
self_
->
delegate
(
dest
,
std
::
forward
<
Ts
>
(
xs
)...);
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
/// @private
actor_control_block
*
ctrl
()
const
noexcept
{
actor_control_block
*
ctrl
()
const
noexcept
{
CAF_ASSERT
(
self_
!=
nullptr
);
CAF_ASSERT
(
self_
!=
nullptr
);
...
...
libcaf_core/src/abstract_actor.cpp
View file @
11ff1257
...
@@ -66,7 +66,7 @@ abstract_actor::abstract_actor(actor_config& cfg)
...
@@ -66,7 +66,7 @@ abstract_actor::abstract_actor(actor_config& cfg)
// nop
// nop
}
}
actor_addr
abstract_actor
::
address
()
const
{
actor_addr
abstract_actor
::
address
()
const
noexcept
{
return
actor_addr
{
actor_control_block
::
from
(
this
)};
return
actor_addr
{
actor_control_block
::
from
(
this
)};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment