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
fa6707df
Commit
fa6707df
authored
Apr 27, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Homogenize actor constructors
parent
415bed8f
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
31 additions
and
59 deletions
+31
-59
libcaf_core/caf/abstract_actor.hpp
libcaf_core/caf/abstract_actor.hpp
+0
-3
libcaf_core/caf/actor_config.hpp
libcaf_core/caf/actor_config.hpp
+10
-4
libcaf_core/caf/actor_proxy.hpp
libcaf_core/caf/actor_proxy.hpp
+1
-1
libcaf_core/caf/event_based_actor.hpp
libcaf_core/caf/event_based_actor.hpp
+1
-1
libcaf_core/caf/forwarding_actor_proxy.hpp
libcaf_core/caf/forwarding_actor_proxy.hpp
+1
-1
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+0
-4
libcaf_core/caf/monitorable_actor.hpp
libcaf_core/caf/monitorable_actor.hpp
+0
-3
libcaf_core/caf/stateful_actor.hpp
libcaf_core/caf/stateful_actor.hpp
+1
-1
libcaf_core/caf/typed_event_based_actor.hpp
libcaf_core/caf/typed_event_based_actor.hpp
+1
-1
libcaf_core/src/abstract_actor.cpp
libcaf_core/src/abstract_actor.cpp
+0
-4
libcaf_core/src/abstract_coordinator.cpp
libcaf_core/src/abstract_coordinator.cpp
+1
-1
libcaf_core/src/actor_proxy.cpp
libcaf_core/src/actor_proxy.cpp
+1
-2
libcaf_core/src/adapter.cpp
libcaf_core/src/adapter.cpp
+1
-1
libcaf_core/src/blocking_actor.cpp
libcaf_core/src/blocking_actor.cpp
+2
-2
libcaf_core/src/forwarding_actor_proxy.cpp
libcaf_core/src/forwarding_actor_proxy.cpp
+3
-1
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+0
-16
libcaf_core/src/monitorable_actor.cpp
libcaf_core/src/monitorable_actor.cpp
+0
-6
libcaf_core/src/sequencer.cpp
libcaf_core/src/sequencer.cpp
+1
-1
libcaf_core/src/splitter.cpp
libcaf_core/src/splitter.cpp
+1
-1
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+1
-1
libcaf_io/caf/io/basp_broker.hpp
libcaf_io/caf/io/basp_broker.hpp
+1
-1
libcaf_io/caf/io/broker.hpp
libcaf_io/caf/io/broker.hpp
+1
-1
libcaf_io/caf/io/typed_broker.hpp
libcaf_io/caf/io/typed_broker.hpp
+1
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+2
-1
No files found.
libcaf_core/caf/abstract_actor.hpp
View file @
fa6707df
...
@@ -250,9 +250,6 @@ protected:
...
@@ -250,9 +250,6 @@ protected:
/// Creates a new actor instance.
/// Creates a new actor instance.
explicit
abstract_actor
(
actor_config
&
cfg
);
explicit
abstract_actor
(
actor_config
&
cfg
);
/// Creates a new actor instance.
explicit
abstract_actor
(
int
flags
=
0
);
private:
private:
// prohibit copies, assigments, and heap allocations
// prohibit copies, assigments, and heap allocations
void
*
operator
new
(
size_t
);
void
*
operator
new
(
size_t
);
...
...
libcaf_core/caf/actor_config.hpp
View file @
fa6707df
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/input_range.hpp"
#include "caf/input_range.hpp"
#include "caf/abstract_channel.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -31,15 +32,20 @@ class actor_config {
...
@@ -31,15 +32,20 @@ class actor_config {
public:
public:
execution_unit
*
host
;
execution_unit
*
host
;
int
flags
;
int
flags
;
input_range
<
const
group
>*
groups
=
nullptr
;
input_range
<
const
group
>*
groups
;
std
::
function
<
behavior
(
local_actor
*
)
>
init_fun
;
std
::
function
<
behavior
(
local_actor
*
)
>
init_fun
;
explicit
actor_config
(
execution_unit
*
ptr
=
nullptr
,
explicit
actor_config
(
execution_unit
*
ptr
=
nullptr
)
int
preset_flags
=
0
)
:
host
(
ptr
),
:
host
(
ptr
),
flags
(
preset_flags
)
{
flags
(
abstract_channel
::
is_abstract_actor_flag
),
groups
(
nullptr
)
{
// nop
// nop
}
}
inline
actor_config
&
add_flag
(
int
x
)
{
flags
|=
x
;
return
*
this
;
}
};
};
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/caf/actor_proxy.hpp
View file @
fa6707df
...
@@ -34,7 +34,7 @@ namespace caf {
...
@@ -34,7 +34,7 @@ namespace caf {
/// or different hardware, or in a separate process.
/// or different hardware, or in a separate process.
class
actor_proxy
:
public
monitorable_actor
{
class
actor_proxy
:
public
monitorable_actor
{
public:
public:
actor_proxy
(
);
explicit
actor_proxy
(
actor_config
&
cfg
);
~
actor_proxy
();
~
actor_proxy
();
...
...
libcaf_core/caf/event_based_actor.hpp
View file @
fa6707df
...
@@ -38,7 +38,7 @@ class event_based_actor : public abstract_event_based_actor<behavior, true> {
...
@@ -38,7 +38,7 @@ class event_based_actor : public abstract_event_based_actor<behavior, true> {
public:
public:
using
super
=
abstract_event_based_actor
<
behavior
,
true
>
;
using
super
=
abstract_event_based_actor
<
behavior
,
true
>
;
event_based_actor
(
actor_config
&
cfg
);
e
xplicit
e
vent_based_actor
(
actor_config
&
cfg
);
~
event_based_actor
();
~
event_based_actor
();
...
...
libcaf_core/caf/forwarding_actor_proxy.hpp
View file @
fa6707df
...
@@ -32,7 +32,7 @@ class forwarding_actor_proxy : public actor_proxy {
...
@@ -32,7 +32,7 @@ class forwarding_actor_proxy : public actor_proxy {
public:
public:
using
forwarding_stack
=
std
::
vector
<
strong_actor_ptr
>
;
using
forwarding_stack
=
std
::
vector
<
strong_actor_ptr
>
;
forwarding_actor_proxy
(
actor
parent
);
forwarding_actor_proxy
(
actor
_config
&
cfg
,
actor
parent
);
~
forwarding_actor_proxy
();
~
forwarding_actor_proxy
();
...
...
libcaf_core/caf/local_actor.hpp
View file @
fa6707df
...
@@ -479,10 +479,6 @@ public:
...
@@ -479,10 +479,6 @@ public:
// handle `ptr` in an event-based actor, not suitable to be called in a loop
// handle `ptr` in an event-based actor, not suitable to be called in a loop
virtual
void
exec_single_event
(
execution_unit
*
ctx
,
mailbox_element_ptr
&
ptr
);
virtual
void
exec_single_event
(
execution_unit
*
ctx
,
mailbox_element_ptr
&
ptr
);
local_actor
();
local_actor
(
int
init_flags
);
local_actor
(
actor_config
&
sys
);
local_actor
(
actor_config
&
sys
);
void
intrusive_ptr_add_ref_impl
()
override
;
void
intrusive_ptr_add_ref_impl
()
override
;
...
...
libcaf_core/caf/monitorable_actor.hpp
View file @
fa6707df
...
@@ -78,9 +78,6 @@ protected:
...
@@ -78,9 +78,6 @@ protected:
/// Creates a new actor instance.
/// Creates a new actor instance.
explicit
monitorable_actor
(
actor_config
&
cfg
);
explicit
monitorable_actor
(
actor_config
&
cfg
);
/// Creates a new actor instance.
explicit
monitorable_actor
(
int
flags
);
/****************************************************************************
/****************************************************************************
* here be dragons: end of public interface *
* here be dragons: end of public interface *
****************************************************************************/
****************************************************************************/
...
...
libcaf_core/caf/stateful_actor.hpp
View file @
fa6707df
...
@@ -40,7 +40,7 @@ template <class State, class Base = event_based_actor>
...
@@ -40,7 +40,7 @@ template <class State, class Base = event_based_actor>
class
stateful_actor
:
public
Base
{
class
stateful_actor
:
public
Base
{
public:
public:
template
<
class
...
Ts
>
template
<
class
...
Ts
>
stateful_actor
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
explicit
stateful_actor
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
:
Base
(
cfg
,
std
::
forward
<
Ts
>
(
xs
)...),
:
Base
(
cfg
,
std
::
forward
<
Ts
>
(
xs
)...),
state
(
state_
)
{
state
(
state_
)
{
if
(
detail
::
is_serializable
<
State
>::
value
)
if
(
detail
::
is_serializable
<
State
>::
value
)
...
...
libcaf_core/caf/typed_event_based_actor.hpp
View file @
fa6707df
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,7 @@ public:
using
base_type
=
using
base_type
=
abstract_event_based_actor
<
typed_behavior
<
Sigs
...
>
,
true
>
;
abstract_event_based_actor
<
typed_behavior
<
Sigs
...
>
,
true
>
;
typed_event_based_actor
(
actor_config
&
cfg
)
:
base_type
(
cfg
)
{
explicit
typed_event_based_actor
(
actor_config
&
cfg
)
:
base_type
(
cfg
)
{
// nop
// nop
}
}
...
...
libcaf_core/src/abstract_actor.cpp
View file @
fa6707df
...
@@ -68,10 +68,6 @@ abstract_actor::abstract_actor(actor_config& cfg)
...
@@ -68,10 +68,6 @@ abstract_actor::abstract_actor(actor_config& cfg)
// nop
// nop
}
}
abstract_actor
::
abstract_actor
(
int
flags
)
:
abstract_channel
(
flags
)
{
// nop
}
actor_addr
abstract_actor
::
address
()
const
{
actor_addr
abstract_actor
::
address
()
const
{
return
actor_addr
{
actor_control_block
::
from
(
this
)};
return
actor_addr
{
actor_control_block
::
from
(
this
)};
}
}
...
...
libcaf_core/src/abstract_coordinator.cpp
View file @
fa6707df
...
@@ -74,7 +74,7 @@ inline void insert_dmsg(Map& storage, const duration& d, Ts&&... xs) {
...
@@ -74,7 +74,7 @@ inline void insert_dmsg(Map& storage, const duration& d, Ts&&... xs) {
class
timer_actor
:
public
blocking_actor
{
class
timer_actor
:
public
blocking_actor
{
public:
public:
timer_actor
(
actor_config
&
cfg
)
:
blocking_actor
(
cfg
)
{
explicit
timer_actor
(
actor_config
&
cfg
)
:
blocking_actor
(
cfg
)
{
// nop
// nop
}
}
...
...
libcaf_core/src/actor_proxy.cpp
View file @
fa6707df
...
@@ -28,8 +28,7 @@
...
@@ -28,8 +28,7 @@
namespace
caf
{
namespace
caf
{
actor_proxy
::
actor_proxy
()
actor_proxy
::
actor_proxy
(
actor_config
&
cfg
)
:
monitorable_actor
(
cfg
)
{
:
monitorable_actor
(
abstract_channel
::
is_abstract_actor
())
{
// nop
// nop
}
}
...
...
libcaf_core/src/adapter.cpp
View file @
fa6707df
...
@@ -34,7 +34,7 @@ namespace caf {
...
@@ -34,7 +34,7 @@ namespace caf {
namespace
decorator
{
namespace
decorator
{
adapter
::
adapter
(
strong_actor_ptr
decorated
,
message
msg
)
adapter
::
adapter
(
strong_actor_ptr
decorated
,
message
msg
)
:
monitorable_actor
(
is_abstract_actor_flag
|
is_actor_bind_decorator_flag
),
:
monitorable_actor
(
actor_config
{}.
add_flag
(
is_actor_bind_decorator_flag
)
),
decorated_
(
std
::
move
(
decorated
)),
decorated_
(
std
::
move
(
decorated
)),
merger_
(
std
::
move
(
msg
))
{
merger_
(
std
::
move
(
msg
))
{
// bound actor has dependency on the decorated actor by default;
// bound actor has dependency on the decorated actor by default;
...
...
libcaf_core/src/blocking_actor.cpp
View file @
fa6707df
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
namespace
caf
{
namespace
caf
{
blocking_actor
::
blocking_actor
(
actor_config
&
sys
)
:
super
(
sys
)
{
blocking_actor
::
blocking_actor
(
actor_config
&
sys
)
is_blocking
(
true
);
:
super
(
sys
.
add_flag
(
local_actor
::
is_blocking_flag
))
{
set_default_handler
(
skip
);
set_default_handler
(
skip
);
}
}
...
...
libcaf_core/src/forwarding_actor_proxy.cpp
View file @
fa6707df
...
@@ -26,7 +26,9 @@
...
@@ -26,7 +26,9 @@
namespace
caf
{
namespace
caf
{
forwarding_actor_proxy
::
forwarding_actor_proxy
(
actor
mgr
)
:
manager_
(
mgr
)
{
forwarding_actor_proxy
::
forwarding_actor_proxy
(
actor_config
&
cfg
,
actor
mgr
)
:
actor_proxy
(
cfg
),
manager_
(
mgr
)
{
CAF_ASSERT
(
mgr
!=
invalid_actor
);
CAF_ASSERT
(
mgr
!=
invalid_actor
);
}
}
...
...
libcaf_core/src/local_actor.cpp
View file @
fa6707df
...
@@ -75,22 +75,6 @@ local_actor::local_actor(actor_config& cfg)
...
@@ -75,22 +75,6 @@ local_actor::local_actor(actor_config& cfg)
join
(
grp
);
join
(
grp
);
}
}
local_actor
::
local_actor
()
:
monitorable_actor
(
abstract_channel
::
is_abstract_actor_flag
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
timeout_id_
(
0
),
unexpected_handler_
(
print_and_drop
)
{
// nop
}
local_actor
::
local_actor
(
int
init_flags
)
:
monitorable_actor
(
init_flags
),
planned_exit_reason_
(
exit_reason
::
not_exited
),
timeout_id_
(
0
),
unexpected_handler_
(
print_and_drop
)
{
// nop
}
local_actor
::~
local_actor
()
{
local_actor
::~
local_actor
()
{
// nop
// nop
}
}
...
...
libcaf_core/src/monitorable_actor.cpp
View file @
fa6707df
...
@@ -90,12 +90,6 @@ monitorable_actor::monitorable_actor(actor_config& cfg)
...
@@ -90,12 +90,6 @@ monitorable_actor::monitorable_actor(actor_config& cfg)
// nop
// nop
}
}
monitorable_actor
::
monitorable_actor
(
int
init_flags
)
:
abstract_actor
(
init_flags
),
exit_reason_
(
exit_reason
::
not_exited
)
{
// nop
}
optional
<
exit_reason
>
monitorable_actor
::
handle
(
const
std
::
exception_ptr
&
eptr
)
{
optional
<
exit_reason
>
monitorable_actor
::
handle
(
const
std
::
exception_ptr
&
eptr
)
{
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
mtx_
};
for
(
auto
i
=
attachables_head_
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
{
for
(
auto
i
=
attachables_head_
.
get
();
i
!=
nullptr
;
i
=
i
->
next
.
get
())
{
...
...
libcaf_core/src/sequencer.cpp
View file @
fa6707df
...
@@ -30,7 +30,7 @@ namespace decorator {
...
@@ -30,7 +30,7 @@ namespace decorator {
sequencer
::
sequencer
(
strong_actor_ptr
f
,
strong_actor_ptr
g
,
sequencer
::
sequencer
(
strong_actor_ptr
f
,
strong_actor_ptr
g
,
message_types_set
msg_types
)
message_types_set
msg_types
)
:
monitorable_actor
(
is_abstract_actor_flag
|
is_actor_dot_decorator_flag
),
:
monitorable_actor
(
actor_config
{}.
add_flag
(
is_actor_dot_decorator_flag
)
),
f_
(
std
::
move
(
f
)),
f_
(
std
::
move
(
f
)),
g_
(
std
::
move
(
g
)),
g_
(
std
::
move
(
g
)),
msg_types_
(
std
::
move
(
msg_types
))
{
msg_types_
(
std
::
move
(
msg_types
))
{
...
...
libcaf_core/src/splitter.cpp
View file @
fa6707df
...
@@ -115,7 +115,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
...
@@ -115,7 +115,7 @@ behavior fan_out_fan_in(stateful_actor<splitter_state>* self,
splitter
::
splitter
(
std
::
vector
<
strong_actor_ptr
>
workers
,
splitter
::
splitter
(
std
::
vector
<
strong_actor_ptr
>
workers
,
message_types_set
msg_types
)
message_types_set
msg_types
)
:
monitorable_actor
(
is_abstract_actor_flag
|
is_actor_dot_decorator_flag
),
:
monitorable_actor
(
actor_config
{}.
add_flag
(
is_actor_dot_decorator_flag
)
),
workers_
(
std
::
move
(
workers
)),
workers_
(
std
::
move
(
workers
)),
msg_types_
(
std
::
move
(
msg_types
))
{
msg_types_
(
std
::
move
(
msg_types
))
{
// composed actor has dependency on constituent actors by default;
// composed actor has dependency on constituent actors by default;
...
...
libcaf_io/caf/io/abstract_broker.hpp
View file @
fa6707df
...
@@ -209,7 +209,7 @@ public:
...
@@ -209,7 +209,7 @@ public:
protected:
protected:
void
init_broker
();
void
init_broker
();
abstract_broker
(
actor_config
&
cfg
);
explicit
abstract_broker
(
actor_config
&
cfg
);
using
doorman_map
=
std
::
unordered_map
<
accept_handle
,
intrusive_ptr
<
doorman
>>
;
using
doorman_map
=
std
::
unordered_map
<
accept_handle
,
intrusive_ptr
<
doorman
>>
;
...
...
libcaf_io/caf/io/basp_broker.hpp
View file @
fa6707df
...
@@ -138,7 +138,7 @@ class basp_broker : public stateful_actor<basp_broker_state, broker> {
...
@@ -138,7 +138,7 @@ class basp_broker : public stateful_actor<basp_broker_state, broker> {
public:
public:
using
super
=
stateful_actor
<
basp_broker_state
,
broker
>
;
using
super
=
stateful_actor
<
basp_broker_state
,
broker
>
;
basp_broker
(
actor_config
&
cfg
);
explicit
basp_broker
(
actor_config
&
cfg
);
behavior
make_behavior
()
override
;
behavior
make_behavior
()
override
;
resume_result
resume
(
execution_unit
*
,
size_t
)
override
;
resume_result
resume
(
execution_unit
*
,
size_t
)
override
;
void
exec_single_event
(
execution_unit
*
,
mailbox_element_ptr
&
)
override
;
void
exec_single_event
(
execution_unit
*
,
mailbox_element_ptr
&
)
override
;
...
...
libcaf_io/caf/io/broker.hpp
View file @
fa6707df
...
@@ -63,7 +63,7 @@ public:
...
@@ -63,7 +63,7 @@ public:
void
initialize
()
override
;
void
initialize
()
override
;
broker
(
actor_config
&
cfg
);
explicit
broker
(
actor_config
&
cfg
);
protected:
protected:
virtual
behavior
make_behavior
();
virtual
behavior
make_behavior
();
...
...
libcaf_io/caf/io/typed_broker.hpp
View file @
fa6707df
...
@@ -205,7 +205,7 @@ public:
...
@@ -205,7 +205,7 @@ public:
return
super
::
add_tcp_doorman
(
fd
);
return
super
::
add_tcp_doorman
(
fd
);
}
}
typed_broker
(
actor_config
&
cfg
)
:
super
(
cfg
)
{
explicit
typed_broker
(
actor_config
&
cfg
)
:
super
(
cfg
)
{
// nop
// nop
}
}
...
...
libcaf_io/src/basp_broker.cpp
View file @
fa6707df
...
@@ -86,8 +86,9 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
...
@@ -86,8 +86,9 @@ strong_actor_ptr basp_broker_state::make_proxy(node_id nid, actor_id aid) {
// create proxy and add functor that will be called if we
// create proxy and add functor that will be called if we
// receive a kill_proxy_instance message
// receive a kill_proxy_instance message
auto
mm
=
&
system
().
middleman
();
auto
mm
=
&
system
().
middleman
();
actor_config
cfg
;
auto
res
=
make_actor
<
forwarding_actor_proxy
,
strong_actor_ptr
>
(
auto
res
=
make_actor
<
forwarding_actor_proxy
,
strong_actor_ptr
>
(
aid
,
nid
,
&
(
self
->
home_system
())
,
self
);
aid
,
nid
,
&
(
self
->
home_system
()),
cfg
,
self
);
auto
selfptr
=
actor_cast
<
strong_actor_ptr
>
(
self
);
auto
selfptr
=
actor_cast
<
strong_actor_ptr
>
(
self
);
res
->
get
()
->
attach_functor
([
=
](
exit_reason
rsn
)
{
res
->
get
()
->
attach_functor
([
=
](
exit_reason
rsn
)
{
mm
->
backend
().
post
([
=
]
{
mm
->
backend
().
post
([
=
]
{
...
...
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