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
a4e4c4ff
Commit
a4e4c4ff
authored
Jan 07, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move actor decorators to a separate namespace
parent
af4f3410
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
42 deletions
+50
-42
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+2
-2
libcaf_core/caf/all.hpp
libcaf_core/caf/all.hpp
+3
-2
libcaf_core/caf/decorator/adapter.hpp
libcaf_core/caf/decorator/adapter.hpp
+7
-5
libcaf_core/caf/decorator/sequencer.hpp
libcaf_core/caf/decorator/sequencer.hpp
+7
-5
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+8
-8
libcaf_core/src/actor.cpp
libcaf_core/src/actor.cpp
+8
-7
libcaf_core/src/adapter.cpp
libcaf_core/src/adapter.cpp
+5
-4
libcaf_core/src/sequencer.cpp
libcaf_core/src/sequencer.cpp
+6
-5
libcaf_core/test/adapter.cpp
libcaf_core/test/adapter.cpp
+2
-2
libcaf_core/test/sequencer.cpp
libcaf_core/test/sequencer.cpp
+2
-2
No files found.
libcaf_core/CMakeLists.txt
View file @
a4e4c4ff
...
@@ -25,6 +25,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -25,6 +25,7 @@ set (LIBCAF_CORE_SRCS
src/actor_registry.cpp
src/actor_registry.cpp
src/actor_system.cpp
src/actor_system.cpp
src/actor_system_config.cpp
src/actor_system_config.cpp
src/adapter.cpp
src/atom.cpp
src/atom.cpp
src/attachable.cpp
src/attachable.cpp
src/behavior.cpp
src/behavior.cpp
...
@@ -33,9 +34,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -33,9 +34,7 @@ set (LIBCAF_CORE_SRCS
src/binary_deserializer.cpp
src/binary_deserializer.cpp
src/binary_serializer.cpp
src/binary_serializer.cpp
src/blocking_actor.cpp
src/blocking_actor.cpp
src/bound_actor.cpp
src/channel.cpp
src/channel.cpp
src/composed_actor.cpp
src/concatenated_tuple.cpp
src/concatenated_tuple.cpp
src/continue_helper.cpp
src/continue_helper.cpp
src/decorated_tuple.cpp
src/decorated_tuple.cpp
...
@@ -80,6 +79,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -80,6 +79,7 @@ set (LIBCAF_CORE_SRCS
src/scoped_execution_unit.cpp
src/scoped_execution_unit.cpp
src/sec.cpp
src/sec.cpp
src/serializer.cpp
src/serializer.cpp
src/sequencer.cpp
src/shared_spinlock.cpp
src/shared_spinlock.cpp
src/sync_request_bouncer.cpp
src/sync_request_bouncer.cpp
src/try_match.cpp
src/try_match.cpp
...
...
libcaf_core/caf/all.hpp
View file @
a4e4c4ff
...
@@ -47,7 +47,6 @@
...
@@ -47,7 +47,6 @@
#include "caf/replies_to.hpp"
#include "caf/replies_to.hpp"
#include "caf/serializer.hpp"
#include "caf/serializer.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/bound_actor.hpp"
#include "caf/exit_reason.hpp"
#include "caf/exit_reason.hpp"
#include "caf/local_actor.hpp"
#include "caf/local_actor.hpp"
#include "caf/ref_counted.hpp"
#include "caf/ref_counted.hpp"
...
@@ -62,7 +61,6 @@
...
@@ -62,7 +61,6 @@
#include "caf/abstract_actor.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/abstract_group.hpp"
#include "caf/abstract_group.hpp"
#include "caf/blocking_actor.hpp"
#include "caf/blocking_actor.hpp"
#include "caf/composed_actor.hpp"
#include "caf/deep_to_string.hpp"
#include "caf/deep_to_string.hpp"
#include "caf/execution_unit.hpp"
#include "caf/execution_unit.hpp"
#include "caf/memory_managed.hpp"
#include "caf/memory_managed.hpp"
...
@@ -90,6 +88,9 @@
...
@@ -90,6 +88,9 @@
#include "caf/typed_continue_helper.hpp"
#include "caf/typed_continue_helper.hpp"
#include "caf/typed_event_based_actor.hpp"
#include "caf/typed_event_based_actor.hpp"
#include "caf/decorator/adapter.hpp"
#include "caf/decorator/sequencer.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
/// @author Dominik Charousset <dominik.charousset (at) haw-hamburg.de>
/// @author Dominik Charousset <dominik.charousset (at) haw-hamburg.de>
...
...
libcaf_core/caf/
bound_acto
r.hpp
→
libcaf_core/caf/
decorator/adapte
r.hpp
View file @
a4e4c4ff
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
******************************************************************************/
#ifndef CAF_
BOUND_ACTO
R_HPP
#ifndef CAF_
DECORATOR_ADAPTE
R_HPP
#define CAF_
BOUND_ACTO
R_HPP
#define CAF_
DECORATOR_ADAPTE
R_HPP
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/actor_addr.hpp"
#include "caf/actor_addr.hpp"
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "caf/monitorable_actor.hpp"
#include "caf/monitorable_actor.hpp"
namespace
caf
{
namespace
caf
{
namespace
decorator
{
/// An actor decorator implementing `std::bind`-like compositions.
/// An actor decorator implementing `std::bind`-like compositions.
/// Bound actors are hidden actors. A bound actor exits when its
/// Bound actors are hidden actors. A bound actor exits when its
...
@@ -33,9 +34,9 @@ namespace caf {
...
@@ -33,9 +34,9 @@ namespace caf {
/// on the bound actor by default, and exit of a bound actor has
/// on the bound actor by default, and exit of a bound actor has
/// no effect on the decorated actor. Bound actors are hosted on
/// no effect on the decorated actor. Bound actors are hosted on
/// the same actor system and node as decorated actors.
/// the same actor system and node as decorated actors.
class
bound_acto
r
:
public
monitorable_actor
{
class
adapte
r
:
public
monitorable_actor
{
public:
public:
bound_acto
r
(
actor_addr
decorated
,
message
msg
);
adapte
r
(
actor_addr
decorated
,
message
msg
);
// non-system messages are processed and then forwarded;
// non-system messages are processed and then forwarded;
// system messages are handled and consumed on the spot;
// system messages are handled and consumed on the spot;
...
@@ -47,6 +48,7 @@ private:
...
@@ -47,6 +48,7 @@ private:
message
merger_
;
message
merger_
;
};
};
}
// namespace decorator
}
// namespace caf
}
// namespace caf
#endif // CAF_
BOUND_ACTO
R_HPP
#endif // CAF_
DECORATOR_ADAPTE
R_HPP
libcaf_core/caf/
composed_acto
r.hpp
→
libcaf_core/caf/
decorator/sequence
r.hpp
View file @
a4e4c4ff
...
@@ -17,14 +17,15 @@
...
@@ -17,14 +17,15 @@
* http://www.boost.org/LICENSE_1_0.txt. *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
******************************************************************************/
#ifndef CAF_
COMPOSED_ACTO
R_HPP
#ifndef CAF_
DECORATOR_SEQUENCE
R_HPP
#define CAF_
COMPOSED_ACTO
R_HPP
#define CAF_
DECORATOR_SEQUENCE
R_HPP
#include "caf/actor_addr.hpp"
#include "caf/actor_addr.hpp"
#include "caf/mailbox_element.hpp"
#include "caf/mailbox_element.hpp"
#include "caf/monitorable_actor.hpp"
#include "caf/monitorable_actor.hpp"
namespace
caf
{
namespace
caf
{
namespace
decorator
{
/// An actor decorator implementing "dot operator"-like compositions,
/// An actor decorator implementing "dot operator"-like compositions,
/// i.e., `f.g(x) = f(g(x))`. Composed actors are hidden actors.
/// i.e., `f.g(x) = f(g(x))`. Composed actors are hidden actors.
...
@@ -33,11 +34,11 @@ namespace caf {
...
@@ -33,11 +34,11 @@ namespace caf {
/// by default, and exit of a composed actor has no effect on its
/// by default, and exit of a composed actor has no effect on its
/// constituent actors. A composed actor is hosted on the same actor
/// constituent actors. A composed actor is hosted on the same actor
/// system and node as `g`, the first actor on the forwarding chain.
/// system and node as `g`, the first actor on the forwarding chain.
class
composed_acto
r
:
public
monitorable_actor
{
class
sequence
r
:
public
monitorable_actor
{
public:
public:
using
message_types_set
=
std
::
set
<
std
::
string
>
;
using
message_types_set
=
std
::
set
<
std
::
string
>
;
composed_acto
r
(
actor_addr
f
,
actor_addr
g
,
message_types_set
msg_types
);
sequence
r
(
actor_addr
f
,
actor_addr
g
,
message_types_set
msg_types
);
// non-system messages are processed and then forwarded;
// non-system messages are processed and then forwarded;
// system messages are handled and consumed on the spot;
// system messages are handled and consumed on the spot;
...
@@ -52,6 +53,7 @@ private:
...
@@ -52,6 +53,7 @@ private:
message_types_set
msg_types_
;
message_types_set
msg_types_
;
};
};
}
// namespace decorator
}
// namespace caf
}
// namespace caf
#endif // CAF_
COMPOSED_ACTO
R_HPP
#endif // CAF_
DECORATOR_SEQUENCE
R_HPP
libcaf_core/caf/typed_actor.hpp
View file @
a4e4c4ff
...
@@ -25,13 +25,14 @@
...
@@ -25,13 +25,14 @@
#include "caf/actor.hpp"
#include "caf/actor.hpp"
#include "caf/actor_cast.hpp"
#include "caf/actor_cast.hpp"
#include "caf/replies_to.hpp"
#include "caf/replies_to.hpp"
#include "caf/bound_actor.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/abstract_actor.hpp"
#include "caf/composed_actor.hpp"
#include "caf/stateful_actor.hpp"
#include "caf/stateful_actor.hpp"
#include "caf/typed_behavior.hpp"
#include "caf/typed_behavior.hpp"
#include "caf/typed_response_promise.hpp"
#include "caf/typed_response_promise.hpp"
#include "caf/decorator/adapter.hpp"
#include "caf/decorator/sequencer.hpp"
#include "caf/detail/mpi_bind.hpp"
#include "caf/detail/mpi_bind.hpp"
#include "caf/detail/mpi_composition.hpp"
#include "caf/detail/mpi_composition.hpp"
...
@@ -215,8 +216,8 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
...
@@ -215,8 +216,8 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
bind
(
Ts
&&
...
xs
)
const
{
bind
(
Ts
&&
...
xs
)
const
{
if
(
!
ptr_
)
if
(
!
ptr_
)
return
invalid_actor
;
return
invalid_actor
;
auto
ptr
=
make_counted
<
bound_acto
r
>
(
ptr_
->
address
(),
auto
ptr
=
make_counted
<
decorator
::
adapte
r
>
(
ptr_
->
address
(),
make_message
(
xs
...));
make_message
(
xs
...));
return
{
ptr
.
release
(),
false
};
return
{
ptr
.
release
(),
false
};
}
}
...
@@ -298,10 +299,9 @@ operator*(typed_actor<Xs...> f, typed_actor<Ys...> g) {
...
@@ -298,10 +299,9 @@ operator*(typed_actor<Xs...> f, typed_actor<Ys...> g) {
detail
::
type_list
<
Xs
...
>
,
detail
::
type_list
<
Xs
...
>
,
Ys
...
Ys
...
>::
type
;
>::
type
;
auto
ptr
=
make_counted
<
composed_actor
>
(
f
.
address
(),
auto
mts
=
g
->
home_system
().
message_types
(
result
{});
g
.
address
(),
auto
ptr
=
make_counted
<
decorator
::
sequencer
>
(
f
.
address
(),
g
.
address
(),
g
->
home_system
().
message_types
(
std
::
move
(
mts
));
result
{}));
return
actor_cast
<
result
>
(
std
::
move
(
ptr
));
return
actor_cast
<
result
>
(
std
::
move
(
ptr
));
}
}
...
...
libcaf_core/src/actor.cpp
View file @
a4e4c4ff
...
@@ -25,13 +25,14 @@
...
@@ -25,13 +25,14 @@
#include "caf/actor_addr.hpp"
#include "caf/actor_addr.hpp"
#include "caf/serializer.hpp"
#include "caf/serializer.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/bound_actor.hpp"
#include "caf/local_actor.hpp"
#include "caf/local_actor.hpp"
#include "caf/deserializer.hpp"
#include "caf/deserializer.hpp"
#include "caf/blocking_actor.hpp"
#include "caf/blocking_actor.hpp"
#include "caf/composed_actor.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/event_based_actor.hpp"
#include "caf/decorator/adapter.hpp"
#include "caf/decorator/sequencer.hpp"
namespace
caf
{
namespace
caf
{
actor
::
actor
(
const
invalid_actor_t
&
)
:
ptr_
(
nullptr
)
{
actor
::
actor
(
const
invalid_actor_t
&
)
:
ptr_
(
nullptr
)
{
...
@@ -78,16 +79,16 @@ actor_id actor::id() const noexcept {
...
@@ -78,16 +79,16 @@ actor_id actor::id() const noexcept {
actor
actor
::
bind_impl
(
message
msg
)
const
{
actor
actor
::
bind_impl
(
message
msg
)
const
{
if
(
!
ptr_
)
if
(
!
ptr_
)
return
invalid_actor
;
return
invalid_actor
;
return
actor_cast
<
actor
>
(
make_counted
<
bound_acto
r
>
(
address
(),
return
actor_cast
<
actor
>
(
make_counted
<
decorator
::
adapte
r
>
(
address
(),
std
::
move
(
msg
)));
std
::
move
(
msg
)));
}
}
actor
operator
*
(
actor
f
,
actor
g
)
{
actor
operator
*
(
actor
f
,
actor
g
)
{
if
(
!
f
||
!
g
)
if
(
!
f
||
!
g
)
return
invalid_actor
;
return
invalid_actor
;
auto
ptr
=
make_counted
<
composed_acto
r
>
(
f
.
address
(),
auto
ptr
=
make_counted
<
decorator
::
sequence
r
>
(
f
.
address
(),
g
.
address
(),
g
.
address
(),
std
::
set
<
std
::
string
>
{});
std
::
set
<
std
::
string
>
{});
return
actor_cast
<
actor
>
(
std
::
move
(
ptr
));
return
actor_cast
<
actor
>
(
std
::
move
(
ptr
));
}
}
...
...
libcaf_core/src/
bound_acto
r.cpp
→
libcaf_core/src/
adapte
r.cpp
View file @
a4e4c4ff
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
******************************************************************************/
#include "caf/
bound_acto
r.hpp"
#include "caf/
decorator/adapte
r.hpp"
#include "caf/sec.hpp"
#include "caf/sec.hpp"
#include "caf/actor_cast.hpp"
#include "caf/actor_cast.hpp"
...
@@ -31,8 +31,9 @@
...
@@ -31,8 +31,9 @@
#include "caf/detail/sync_request_bouncer.hpp"
#include "caf/detail/sync_request_bouncer.hpp"
namespace
caf
{
namespace
caf
{
namespace
decorator
{
bound_actor
::
bound_acto
r
(
actor_addr
decorated
,
message
msg
)
adapter
::
adapte
r
(
actor_addr
decorated
,
message
msg
)
:
monitorable_actor
(
&
decorated
->
home_system
(),
:
monitorable_actor
(
&
decorated
->
home_system
(),
decorated
->
home_system
().
next_actor_id
(),
decorated
->
home_system
().
next_actor_id
(),
decorated
->
node
(),
decorated
->
node
(),
...
@@ -46,8 +47,7 @@ bound_actor::bound_actor(actor_addr decorated, message msg)
...
@@ -46,8 +47,7 @@ bound_actor::bound_actor(actor_addr decorated, message msg)
decorated_
->
attach
(
default_attachable
::
make_monitor
(
address
()));
decorated_
->
attach
(
default_attachable
::
make_monitor
(
address
()));
}
}
void
bound_actor
::
enqueue
(
mailbox_element_ptr
what
,
void
adapter
::
enqueue
(
mailbox_element_ptr
what
,
execution_unit
*
host
)
{
execution_unit
*
host
)
{
if
(
!
what
)
if
(
!
what
)
return
;
// not even an empty message
return
;
// not even an empty message
auto
reason
=
exit_reason_
.
load
();
auto
reason
=
exit_reason_
.
load
();
...
@@ -81,4 +81,5 @@ void bound_actor::enqueue(mailbox_element_ptr what,
...
@@ -81,4 +81,5 @@ void bound_actor::enqueue(mailbox_element_ptr what,
decorated_
->
enqueue
(
std
::
move
(
what
),
host
);
decorated_
->
enqueue
(
std
::
move
(
what
),
host
);
}
}
}
// namespace decorator
}
// namespace caf
}
// namespace caf
libcaf_core/src/
composed_acto
r.cpp
→
libcaf_core/src/
sequence
r.cpp
View file @
a4e4c4ff
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
******************************************************************************/
#include "caf/
composed_acto
r.hpp"
#include "caf/
decorator/sequence
r.hpp"
#include "caf/actor_system.hpp"
#include "caf/actor_system.hpp"
#include "caf/default_attachable.hpp"
#include "caf/default_attachable.hpp"
...
@@ -26,9 +26,9 @@
...
@@ -26,9 +26,9 @@
#include "caf/detail/sync_request_bouncer.hpp"
#include "caf/detail/sync_request_bouncer.hpp"
namespace
caf
{
namespace
caf
{
namespace
decorator
{
composed_actor
::
composed_actor
(
actor_addr
f
,
actor_addr
g
,
sequencer
::
sequencer
(
actor_addr
f
,
actor_addr
g
,
message_types_set
msg_types
)
message_types_set
msg_types
)
:
monitorable_actor
(
&
g
->
home_system
(),
:
monitorable_actor
(
&
g
->
home_system
(),
g
->
home_system
().
next_actor_id
(),
g
->
home_system
().
next_actor_id
(),
g
->
node
(),
g
->
node
(),
...
@@ -44,7 +44,7 @@ composed_actor::composed_actor(actor_addr f, actor_addr g,
...
@@ -44,7 +44,7 @@ composed_actor::composed_actor(actor_addr f, actor_addr g,
g_
->
attach
(
default_attachable
::
make_monitor
(
address
()));
g_
->
attach
(
default_attachable
::
make_monitor
(
address
()));
}
}
void
composed_acto
r
::
enqueue
(
mailbox_element_ptr
what
,
void
sequence
r
::
enqueue
(
mailbox_element_ptr
what
,
execution_unit
*
context
)
{
execution_unit
*
context
)
{
if
(
!
what
)
if
(
!
what
)
return
;
// not even an empty message
return
;
// not even an empty message
...
@@ -80,8 +80,9 @@ void composed_actor::enqueue(mailbox_element_ptr what,
...
@@ -80,8 +80,9 @@ void composed_actor::enqueue(mailbox_element_ptr what,
g_
->
enqueue
(
std
::
move
(
what
),
context
);
g_
->
enqueue
(
std
::
move
(
what
),
context
);
}
}
composed_actor
::
message_types_set
composed_acto
r
::
message_types
()
const
{
sequencer
::
message_types_set
sequence
r
::
message_types
()
const
{
return
msg_types_
;
return
msg_types_
;
}
}
}
// namespace decorator
}
// namespace caf
}
// namespace caf
libcaf_core/test/
bound_acto
r.cpp
→
libcaf_core/test/
adapte
r.cpp
View file @
a4e4c4ff
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include "caf/config.hpp"
#include "caf/config.hpp"
#define CAF_SUITE
bound_acto
r
#define CAF_SUITE
adapte
r
#include "caf/test/unit_test.hpp"
#include "caf/test/unit_test.hpp"
#include "caf/all.hpp"
#include "caf/all.hpp"
...
@@ -62,7 +62,7 @@ struct fixture {
...
@@ -62,7 +62,7 @@ struct fixture {
}
// namespace <anonymous>
}
// namespace <anonymous>
CAF_TEST_FIXTURE_SCOPE
(
bound_acto
r_tests
,
fixture
)
CAF_TEST_FIXTURE_SCOPE
(
adapte
r_tests
,
fixture
)
CAF_TEST
(
identity
)
{
CAF_TEST
(
identity
)
{
auto
dbl
=
system
.
spawn
(
dbl_bhvr
);
auto
dbl
=
system
.
spawn
(
dbl_bhvr
);
...
...
libcaf_core/test/
composed_acto
r.cpp
→
libcaf_core/test/
sequence
r.cpp
View file @
a4e4c4ff
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include "caf/config.hpp"
#include "caf/config.hpp"
#define CAF_SUITE
composed_acto
r
#define CAF_SUITE
sequence
r
#include "caf/test/unit_test.hpp"
#include "caf/test/unit_test.hpp"
#include "caf/all.hpp"
#include "caf/all.hpp"
...
@@ -77,7 +77,7 @@ struct fixture {
...
@@ -77,7 +77,7 @@ struct fixture {
}
// namespace <anonymous>
}
// namespace <anonymous>
CAF_TEST_FIXTURE_SCOPE
(
composed_acto
r_tests
,
fixture
)
CAF_TEST_FIXTURE_SCOPE
(
sequence
r_tests
,
fixture
)
CAF_TEST
(
identity
)
{
CAF_TEST
(
identity
)
{
actor_system
system_of_g
;
actor_system
system_of_g
;
...
...
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