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
bddecb9c
Commit
bddecb9c
authored
Mar 09, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style nitpicks
parent
b950901e
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
353 additions
and
383 deletions
+353
-383
libcaf_core/caf/behavior.hpp
libcaf_core/caf/behavior.hpp
+7
-7
libcaf_core/caf/blocking_actor.hpp
libcaf_core/caf/blocking_actor.hpp
+6
-6
libcaf_core/caf/check_typed_input.hpp
libcaf_core/caf/check_typed_input.hpp
+7
-7
libcaf_core/caf/detail/apply_args.hpp
libcaf_core/caf/detail/apply_args.hpp
+14
-14
libcaf_core/caf/detail/behavior_impl.hpp
libcaf_core/caf/detail/behavior_impl.hpp
+18
-18
libcaf_core/caf/detail/default_uniform_type_info.hpp
libcaf_core/caf/detail/default_uniform_type_info.hpp
+5
-5
libcaf_core/caf/detail/embedded.hpp
libcaf_core/caf/detail/embedded.hpp
+3
-3
libcaf_core/caf/detail/intrusive_partitioned_list.hpp
libcaf_core/caf/detail/intrusive_partitioned_list.hpp
+4
-4
libcaf_core/caf/detail/memory.hpp
libcaf_core/caf/detail/memory.hpp
+6
-6
libcaf_core/caf/detail/optional_message_visitor.hpp
libcaf_core/caf/detail/optional_message_visitor.hpp
+2
-2
libcaf_core/caf/detail/pair_storage.hpp
libcaf_core/caf/detail/pair_storage.hpp
+11
-11
libcaf_core/caf/detail/type_traits.hpp
libcaf_core/caf/detail/type_traits.hpp
+9
-14
libcaf_core/caf/event_based_actor.hpp
libcaf_core/caf/event_based_actor.hpp
+1
-1
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+47
-47
libcaf_core/caf/mailbox_element.hpp
libcaf_core/caf/mailbox_element.hpp
+4
-4
libcaf_core/caf/match_case.hpp
libcaf_core/caf/match_case.hpp
+12
-12
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+8
-8
libcaf_core/caf/message_builder.hpp
libcaf_core/caf/message_builder.hpp
+3
-3
libcaf_core/caf/message_handler.hpp
libcaf_core/caf/message_handler.hpp
+6
-6
libcaf_core/caf/mixin/behavior_stack_based.hpp
libcaf_core/caf/mixin/behavior_stack_based.hpp
+2
-2
libcaf_core/caf/mixin/functor_based.hpp
libcaf_core/caf/mixin/functor_based.hpp
+4
-4
libcaf_core/caf/mixin/sync_sender.hpp
libcaf_core/caf/mixin/sync_sender.hpp
+62
-62
libcaf_core/caf/policy/not_prioritizing.hpp
libcaf_core/caf/policy/not_prioritizing.hpp
+2
-2
libcaf_core/caf/response_handle.hpp
libcaf_core/caf/response_handle.hpp
+6
-6
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+29
-29
libcaf_core/caf/spawn.hpp
libcaf_core/caf/spawn.hpp
+9
-9
libcaf_core/caf/spawn_fwd.hpp
libcaf_core/caf/spawn_fwd.hpp
+9
-9
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+20
-19
libcaf_core/caf/typed_behavior.hpp
libcaf_core/caf/typed_behavior.hpp
+8
-20
libcaf_core/caf/typed_event_based_actor.hpp
libcaf_core/caf/typed_event_based_actor.hpp
+6
-6
libcaf_core/src/abstract_coordinator.cpp
libcaf_core/src/abstract_coordinator.cpp
+2
-2
libcaf_io/caf/io/broker.hpp
libcaf_io/caf/io/broker.hpp
+4
-4
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+2
-2
libcaf_io/caf/io/publish.hpp
libcaf_io/caf/io/publish.hpp
+2
-2
libcaf_io/caf/io/remote_actor.hpp
libcaf_io/caf/io/remote_actor.hpp
+5
-19
libcaf_io/caf/io/spawn_io.hpp
libcaf_io/caf/io/spawn_io.hpp
+2
-2
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+1
-1
libcaf_io/src/middleman.cpp
libcaf_io/src/middleman.cpp
+3
-3
unit_testing/test_match.cpp
unit_testing/test_match.cpp
+2
-2
No files found.
libcaf_core/caf/behavior.hpp
View file @
bddecb9c
...
...
@@ -59,9 +59,9 @@ class behavior {
* The list of arguments can contain match expressions, message handlers,
* and up to one timeout (if set, the timeout has to be the last argument).
*/
template
<
class
V
,
class
...
V
s
>
behavior
(
V
v
,
Vs
...
v
s
)
{
assign
(
std
::
move
(
v
),
std
::
move
(
v
s
)...);
template
<
class
T
,
class
...
T
s
>
behavior
(
T
x
,
Ts
...
x
s
)
{
assign
(
std
::
move
(
x
),
std
::
move
(
x
s
)...);
}
/**
...
...
@@ -75,10 +75,10 @@ class behavior {
/**
* Assigns new handlers.
*/
template
<
class
...
V
s
>
void
assign
(
Vs
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"assign() called without arguments"
);
m_impl
=
detail
::
make_behavior
(
v
s
...);
template
<
class
...
T
s
>
void
assign
(
Ts
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"assign() called without arguments"
);
m_impl
=
detail
::
make_behavior
(
x
s
...);
}
void
assign
(
intrusive_ptr
<
detail
::
behavior_impl
>
ptr
)
{
...
...
libcaf_core/caf/blocking_actor.hpp
View file @
bddecb9c
...
...
@@ -237,12 +237,12 @@ class blocking_actor::functor_based : public blocking_actor {
using
act_fun
=
std
::
function
<
void
(
blocking_actor
*
)
>
;
template
<
class
F
,
class
...
Ts
>
functor_based
(
F
f
,
Ts
&&
...
v
s
)
{
functor_based
(
F
f
,
Ts
&&
...
x
s
)
{
using
trait
=
typename
detail
::
get_callable_trait
<
F
>::
type
;
using
arg0
=
typename
detail
::
tl_head
<
typename
trait
::
arg_types
>::
type
;
blocking_actor
*
dummy
=
nullptr
;
std
::
integral_constant
<
bool
,
std
::
is_same
<
arg0
,
blocking_actor
*>::
value
>
tk
;
create
(
dummy
,
tk
,
f
,
std
::
forward
<
Ts
>
(
v
s
)...);
create
(
dummy
,
tk
,
f
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
void
cleanup
(
uint32_t
reason
);
...
...
@@ -254,13 +254,13 @@ class blocking_actor::functor_based : public blocking_actor {
void
create
(
blocking_actor
*
,
act_fun
);
template
<
class
Actor
,
typename
F
,
class
...
Ts
>
void
create
(
Actor
*
dummy
,
std
::
true_type
,
F
f
,
Ts
&&
...
v
s
)
{
create
(
dummy
,
std
::
bind
(
f
,
std
::
placeholders
::
_1
,
std
::
forward
<
Ts
>
(
v
s
)...));
void
create
(
Actor
*
dummy
,
std
::
true_type
,
F
f
,
Ts
&&
...
x
s
)
{
create
(
dummy
,
std
::
bind
(
f
,
std
::
placeholders
::
_1
,
std
::
forward
<
Ts
>
(
x
s
)...));
}
template
<
class
Actor
,
typename
F
,
class
...
Ts
>
void
create
(
Actor
*
dummy
,
std
::
false_type
,
F
f
,
Ts
&&
...
v
s
)
{
std
::
function
<
void
()
>
fun
=
std
::
bind
(
f
,
std
::
forward
<
Ts
>
(
v
s
)...);
void
create
(
Actor
*
dummy
,
std
::
false_type
,
F
f
,
Ts
&&
...
x
s
)
{
std
::
function
<
void
()
>
fun
=
std
::
bind
(
f
,
std
::
forward
<
Ts
>
(
x
s
)...);
create
(
dummy
,
[
fun
](
Actor
*
)
{
fun
();
});
}
...
...
libcaf_core/caf/check_typed_input.hpp
View file @
bddecb9c
...
...
@@ -28,21 +28,21 @@
namespace
caf
{
/**
* Checks whether `R` does support an input of type `{
L
s...}` via a
* Checks whether `R` does support an input of type `{
T
s...}` via a
* static assertion (always returns 0).
*/
template
<
class
...
Rs
,
class
...
L
s
>
void
check_typed_input
(
const
typed_actor
<
R
s
...
>&
,
const
detail
::
type_list
<
L
s
...
>&
)
{
template
<
class
...
Sigs
,
class
...
T
s
>
void
check_typed_input
(
const
typed_actor
<
Sig
s
...
>&
,
const
detail
::
type_list
<
T
s
...
>&
)
{
static_assert
(
detail
::
tl_find
<
detail
::
type_list
<
L
s
...
>
,
detail
::
type_list
<
T
s
...
>
,
atom_value
>::
value
==
-
1
,
"atom(...) notation is not sufficient for static type "
"checking, please use atom_constant instead in this context"
);
static_assert
(
detail
::
tl_find_if
<
detail
::
type_list
<
R
s
...
>
,
detail
::
input_is
<
detail
::
type_list
<
L
s
...
>>::
template
eval
detail
::
type_list
<
Sig
s
...
>
,
detail
::
input_is
<
detail
::
type_list
<
T
s
...
>>::
template
eval
>
::
value
>=
0
,
"typed actor does not support given input"
);
}
...
...
libcaf_core/caf/detail/apply_args.hpp
View file @
bddecb9c
...
...
@@ -31,8 +31,8 @@ namespace detail {
// this utterly useless function works around a bug in Clang that causes
// the compiler to reject the trailing return type of apply_args because
// "get" is not defined (it's found during ADL)
template
<
long
Pos
,
class
...
V
s
>
typename
tl_at
<
type_list
<
Vs
...
>
,
Pos
>::
type
get
(
const
type_list
<
V
s
...
>&
);
template
<
long
Pos
,
class
...
T
s
>
typename
tl_at
<
type_list
<
Ts
...
>
,
Pos
>::
type
get
(
const
type_list
<
T
s
...
>&
);
template
<
class
F
,
long
...
Is
,
class
Tuple
>
auto
apply_args
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tuple
&&
tup
)
...
...
@@ -40,22 +40,22 @@ auto apply_args(F& f, detail::int_list<Is...>, Tuple&& tup)
return
f
(
get
<
Is
>
(
tup
)...);
}
template
<
class
F
,
class
Tuple
,
class
...
V
s
>
auto
apply_args_prefixed
(
F
&
f
,
detail
::
int_list
<>
,
Tuple
&
,
Vs
&&
...
v
s
)
->
decltype
(
f
(
std
::
forward
<
Vs
>
(
v
s
)...))
{
return
f
(
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
F
,
class
Tuple
,
class
...
T
s
>
auto
apply_args_prefixed
(
F
&
f
,
detail
::
int_list
<>
,
Tuple
&
,
Ts
&&
...
x
s
)
->
decltype
(
f
(
std
::
forward
<
Ts
>
(
x
s
)...))
{
return
f
(
std
::
forward
<
Ts
>
(
x
s
)...);
}
template
<
class
F
,
long
...
Is
,
class
Tuple
,
class
...
V
s
>
auto
apply_args_prefixed
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tuple
&
tup
,
Vs
&&
...
v
s
)
->
decltype
(
f
(
std
::
forward
<
Vs
>
(
v
s
)...,
get
<
Is
>
(
tup
)...))
{
return
f
(
std
::
forward
<
Vs
>
(
v
s
)...,
get
<
Is
>
(
tup
)...);
template
<
class
F
,
long
...
Is
,
class
Tuple
,
class
...
T
s
>
auto
apply_args_prefixed
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tuple
&
tup
,
Ts
&&
...
x
s
)
->
decltype
(
f
(
std
::
forward
<
Ts
>
(
x
s
)...,
get
<
Is
>
(
tup
)...))
{
return
f
(
std
::
forward
<
Ts
>
(
x
s
)...,
get
<
Is
>
(
tup
)...);
}
template
<
class
F
,
long
...
Is
,
class
Tuple
,
class
...
V
s
>
auto
apply_args_suffxied
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tuple
&
tup
,
Vs
&&
...
v
s
)
->
decltype
(
f
(
get
<
Is
>
(
tup
)...,
std
::
forward
<
Vs
>
(
v
s
)...))
{
return
f
(
get
<
Is
>
(
tup
)...,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
F
,
long
...
Is
,
class
Tuple
,
class
...
T
s
>
auto
apply_args_suffxied
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tuple
&
tup
,
Ts
&&
...
x
s
)
->
decltype
(
f
(
get
<
Is
>
(
tup
)...,
std
::
forward
<
Ts
>
(
x
s
)...))
{
return
f
(
get
<
Is
>
(
tup
)...,
std
::
forward
<
Ts
>
(
x
s
)...);
}
}
// namespace detail
...
...
libcaf_core/caf/detail/behavior_impl.hpp
View file @
bddecb9c
...
...
@@ -194,53 +194,53 @@ struct join_std_tuples<T> {
using
type
=
T
;
};
template
<
class
...
Ts
,
class
...
Us
,
class
...
Rs
>
struct
join_std_tuples
<
std
::
tuple
<
Ts
...
>
,
std
::
tuple
<
Us
...
>
,
Rs
...
>
:
join_std_tuples
<
std
::
tuple
<
Ts
...,
Us
...
>
,
Rs
...
>
{
template
<
class
...
Prefix
,
class
...
Infix
,
class
...
Suffix
>
struct
join_std_tuples
<
std
::
tuple
<
Prefix
...
>
,
std
::
tuple
<
Infix
...
>
,
Suffix
...
>
:
join_std_tuples
<
std
::
tuple
<
Prefix
...,
Infix
...
>
,
Suffix
...
>
{
// nop
};
// this function reorganizes its arguments to shift the timeout definition
// to the front (receives it at the tail)
template
<
class
R
,
class
F
,
class
...
V
s
>
intrusive_ptr
<
R
>
make_behavior_ra
(
timeout_definition
<
F
>&
td
ef
,
tail_argument_token
&
,
Vs
...
v
s
)
{
return
make_behavior_eor
<
R
>
(
std
::
tuple_cat
(
to_match_case_tuple
(
vs
)...),
tdef
);
template
<
class
R
,
class
F
,
class
...
T
s
>
intrusive_ptr
<
R
>
make_behavior_ra
(
timeout_definition
<
F
>&
td
,
tail_argument_token
&
,
Ts
...
x
s
)
{
return
make_behavior_eor
<
R
>
(
std
::
tuple_cat
(
to_match_case_tuple
(
xs
)...),
td
);
}
template
<
class
R
,
class
...
V
s
>
intrusive_ptr
<
R
>
make_behavior_ra
(
tail_argument_token
&
,
Vs
...
v
s
)
{
return
make_behavior_eor
<
R
>
(
std
::
tuple_cat
(
to_match_case_tuple
(
v
s
)...));
template
<
class
R
,
class
...
T
s
>
intrusive_ptr
<
R
>
make_behavior_ra
(
tail_argument_token
&
,
Ts
...
x
s
)
{
return
make_behavior_eor
<
R
>
(
std
::
tuple_cat
(
to_match_case_tuple
(
x
s
)...));
}
// for some reason, this call is ambigious on GCC without enable_if
template
<
class
R
,
class
V
,
class
...
V
s
>
template
<
class
R
,
class
V
,
class
...
T
s
>
typename
std
::
enable_if
<
!
std
::
is_same
<
V
,
tail_argument_token
>::
value
,
intrusive_ptr
<
R
>
>::
type
make_behavior_ra
(
V
&
v
,
Vs
&
...
v
s
)
{
return
make_behavior_ra
<
R
>
(
v
s
...,
v
);
make_behavior_ra
(
V
&
v
,
Ts
&
...
x
s
)
{
return
make_behavior_ra
<
R
>
(
x
s
...,
v
);
}
// this function reorganizes its arguments to shift the timeout definition
// to the front (receives it at the tail)
template
<
class
...
V
s
>
template
<
class
...
T
s
>
intrusive_ptr
<
default_behavior_impl
<
typename
join_std_tuples
<
typename
lift_to_mctuple
<
V
s
>::
type
...
typename
lift_to_mctuple
<
T
s
>::
type
...
>::
type
>>
make_behavior
(
Vs
&
...
v
s
)
{
make_behavior
(
Ts
&
...
x
s
)
{
using
result_type
=
default_behavior_impl
<
typename
join_std_tuples
<
typename
lift_to_mctuple
<
V
s
>::
type
...
typename
lift_to_mctuple
<
T
s
>::
type
...
>::
type
>
;
tail_argument_token
eoa
;
return
make_behavior_ra
<
result_type
>
(
v
s
...,
eoa
);
return
make_behavior_ra
<
result_type
>
(
x
s
...,
eoa
);
}
using
behavior_impl_ptr
=
intrusive_ptr
<
behavior_impl
>
;
...
...
libcaf_core/caf/detail/default_uniform_type_info.hpp
View file @
bddecb9c
...
...
@@ -570,12 +570,12 @@ class default_uniform_type_info : public detail::abstract_uniform_type_info<T> {
std
::
vector
<
uniform_type_info_ptr
>
m_members
;
};
template
<
class
...
R
s
>
class
default_uniform_type_info
<
typed_actor
<
R
s
...
>>
:
public
detail
::
abstract_uniform_type_info
<
typed_actor
<
R
s
...
>>
{
template
<
class
...
Sig
s
>
class
default_uniform_type_info
<
typed_actor
<
Sig
s
...
>>
:
public
detail
::
abstract_uniform_type_info
<
typed_actor
<
Sig
s
...
>>
{
public:
using
super
=
detail
::
abstract_uniform_type_info
<
typed_actor
<
R
s
...
>>
;
using
handle_type
=
typed_actor
<
R
s
...
>
;
using
super
=
detail
::
abstract_uniform_type_info
<
typed_actor
<
Sig
s
...
>>
;
using
handle_type
=
typed_actor
<
Sig
s
...
>
;
default_uniform_type_info
(
std
::
string
tname
)
:
super
(
std
::
move
(
tname
))
{
sub_uti
=
uniform_typeid
<
actor
>
();
...
...
libcaf_core/caf/detail/embedded.hpp
View file @
bddecb9c
...
...
@@ -29,9 +29,9 @@ namespace detail {
template
<
class
Base
>
class
embedded
final
:
public
Base
{
public:
template
<
class
...
V
s
>
embedded
(
intrusive_ptr
<
ref_counted
>
storage
,
Vs
&&
...
v
s
)
:
Base
(
std
::
forward
<
Vs
>
(
v
s
)...),
template
<
class
...
T
s
>
embedded
(
intrusive_ptr
<
ref_counted
>
storage
,
Ts
&&
...
x
s
)
:
Base
(
std
::
forward
<
Ts
>
(
x
s
)...),
m_storage
(
std
::
move
(
storage
))
{
// nop
}
...
...
libcaf_core/caf/detail/intrusive_partitioned_list.hpp
View file @
bddecb9c
...
...
@@ -200,8 +200,8 @@ class intrusive_partitioned_list {
insert
(
second_end
(),
val
);
}
template
<
class
Actor
,
class
...
V
s
>
bool
invoke
(
Actor
*
self
,
iterator
first
,
iterator
last
,
Vs
&
...
v
s
)
{
template
<
class
Actor
,
class
...
T
s
>
bool
invoke
(
Actor
*
self
,
iterator
first
,
iterator
last
,
Ts
&
...
x
s
)
{
pointer
prev
=
first
->
prev
;
pointer
next
=
first
->
next
;
auto
move_on
=
[
&
](
bool
first_valid
)
{
...
...
@@ -214,12 +214,12 @@ class intrusive_partitioned_list {
while
(
first
!=
last
)
{
std
::
unique_ptr
<
value_type
,
deleter_type
>
tmp
{
first
.
ptr
};
// since this function can be called recursively during
// self->invoke_message(tmp,
v
s...), we have to remove the
// self->invoke_message(tmp,
x
s...), we have to remove the
// element from the list proactively and put it back in if
// it's safe, i.e., if invoke_message returned im_skipped
prev
->
next
=
next
;
next
->
prev
=
prev
;
switch
(
self
->
invoke_message
(
tmp
,
v
s
...))
{
switch
(
self
->
invoke_message
(
tmp
,
x
s
...))
{
case
policy
:
:
im_dropped
:
move_on
(
false
);
break
;
...
...
libcaf_core/caf/detail/memory.hpp
View file @
bddecb9c
...
...
@@ -64,10 +64,10 @@ class basic_memory_cache;
template
<
class
T
>
struct
rc_storage
:
public
ref_counted
{
T
instance
;
template
<
class
...
V
s
>
rc_storage
(
Vs
&&
...
v
s
)
template
<
class
...
T
s
>
rc_storage
(
Ts
&&
...
x
s
)
:
instance
(
intrusive_ptr
<
ref_counted
>
(
this
,
false
),
std
::
forward
<
Vs
>
(
v
s
)...)
{
std
::
forward
<
Ts
>
(
x
s
)...)
{
CAF_REQUIRE
(
get_reference_count
()
>=
1
);
}
};
...
...
@@ -190,8 +190,8 @@ class memory {
public:
// Allocates storage, initializes a new object, and returns the new instance.
template
<
class
T
,
class
...
V
s
>
static
T
*
create
(
Vs
&&
...
v
s
)
{
template
<
class
T
,
class
...
T
s
>
static
T
*
create
(
Ts
&&
...
x
s
)
{
using
embedded_t
=
typename
std
::
conditional
<
T
::
memory_cache_flag
==
needs_embedding
,
...
...
@@ -201,7 +201,7 @@ class memory {
auto
mc
=
get_or_set_cache_map_entry
<
T
>
();
auto
es
=
mc
->
new_embedded_storage
();
auto
ptr
=
reinterpret_cast
<
embedded_t
*>
(
es
.
second
);
new
(
ptr
)
embedded_t
(
std
::
move
(
es
.
first
),
std
::
forward
<
Vs
>
(
v
s
)...);
new
(
ptr
)
embedded_t
(
std
::
move
(
es
.
first
),
std
::
forward
<
Ts
>
(
x
s
)...);
return
ptr
;
}
...
...
libcaf_core/caf/detail/optional_message_visitor.hpp
View file @
bddecb9c
...
...
@@ -105,8 +105,8 @@ class optional_message_visitor : public static_visitor<optional<message>> {
optional_message_visitor_enable_tpl
<
T
>::
value
,
opt_msg
>::
type
operator
()(
T
&
v
,
Ts
&
...
v
s
)
const
{
return
make_message
(
std
::
move
(
v
),
std
::
move
(
v
s
)...);
operator
()(
T
&
x
,
Ts
&
...
x
s
)
const
{
return
make_message
(
std
::
move
(
x
),
std
::
move
(
x
s
)...);
}
template
<
class
T
>
...
...
libcaf_core/caf/detail/pair_storage.hpp
View file @
bddecb9c
...
...
@@ -57,27 +57,27 @@ class pair_storage {
union
{
embedded
<
FirstType
>
first
;
};
union
{
embedded
<
SecondType
>
second
;
};
template
<
class
...
V
s
>
template
<
class
...
T
s
>
pair_storage
(
intrusive_ptr
<
ref_counted
>
storage
,
std
::
integral_constant
<
size_t
,
0
>
,
Vs
&&
...
v
s
)
std
::
integral_constant
<
size_t
,
0
>
,
Ts
&&
...
x
s
)
:
first
(
storage
),
second
(
std
::
move
(
storage
),
std
::
forward
<
Vs
>
(
v
s
)...)
{
second
(
std
::
move
(
storage
),
std
::
forward
<
Ts
>
(
x
s
)...)
{
// nop
}
template
<
class
V0
,
class
...
V
s
>
template
<
class
T
,
class
...
T
s
>
pair_storage
(
intrusive_ptr
<
ref_counted
>
storage
,
std
::
integral_constant
<
size_t
,
1
>
,
V0
&&
v0
,
Vs
&&
...
v
s
)
:
first
(
storage
,
std
::
forward
<
V0
>
(
v0
)),
second
(
std
::
move
(
storage
),
std
::
forward
<
Vs
>
(
v
s
)...)
{
std
::
integral_constant
<
size_t
,
1
>
,
T
&&
x
,
Ts
&&
...
x
s
)
:
first
(
storage
,
std
::
forward
<
T
>
(
x
)),
second
(
std
::
move
(
storage
),
std
::
forward
<
Ts
>
(
x
s
)...)
{
// nop
}
template
<
class
V0
,
class
V1
,
class
...
V
s
>
template
<
class
T0
,
class
T1
,
class
...
T
s
>
pair_storage
(
intrusive_ptr
<
ref_counted
>
storage
,
std
::
integral_constant
<
size_t
,
2
>
,
V0
&&
v0
,
V1
&&
v1
,
Vs
&&
...
v
s
)
:
first
(
storage
,
std
::
forward
<
V0
>
(
v0
),
std
::
forward
<
V1
>
(
v
1
)),
second
(
std
::
move
(
storage
),
std
::
forward
<
Vs
>
(
v
s
)...)
{
std
::
integral_constant
<
size_t
,
2
>
,
T0
&&
x0
,
T1
&&
x1
,
Ts
&&
...
x
s
)
:
first
(
storage
,
std
::
forward
<
T0
>
(
x0
),
std
::
forward
<
T1
>
(
x
1
)),
second
(
std
::
move
(
storage
),
std
::
forward
<
Ts
>
(
x
s
)...)
{
// nop
}
...
...
libcaf_core/caf/detail/type_traits.hpp
View file @
bddecb9c
...
...
@@ -41,17 +41,12 @@ struct conjunction;
template
<
>
struct
conjunction
<>
{
static
constexpr
bool
value
=
false
;
};
template
<
bool
V0
>
struct
conjunction
<
V0
>
{
static
constexpr
bool
value
=
V0
;
static
constexpr
bool
value
=
true
;
};
template
<
bool
V0
,
bool
V1
,
bool
...
V
s
>
struct
conjunction
<
V0
,
V1
,
V
s
...
>
{
static
constexpr
bool
value
=
V0
&&
conjunction
<
V1
,
V
s
...
>::
value
;
template
<
bool
X
,
bool
...
X
s
>
struct
conjunction
<
X
,
X
s
...
>
{
static
constexpr
bool
value
=
X
&&
conjunction
<
X
s
...
>::
value
;
};
/**
...
...
@@ -60,16 +55,16 @@ struct conjunction<V0, V1, Vs...> {
template
<
bool
...
BoolConstants
>
struct
disjunction
;
template
<
bool
V0
,
bool
...
Vs
>
struct
disjunction
<
V0
,
Vs
...
>
{
static
constexpr
bool
value
=
V0
||
disjunction
<
Vs
...
>::
value
;
};
template
<
>
struct
disjunction
<>
{
static
constexpr
bool
value
=
false
;
};
template
<
bool
X
,
bool
...
Xs
>
struct
disjunction
<
X
,
Xs
...
>
{
static
constexpr
bool
value
=
X
||
disjunction
<
Xs
...
>::
value
;
};
/**
* Equal to std::is_same<T, anything>.
*/
...
...
libcaf_core/caf/event_based_actor.hpp
View file @
bddecb9c
...
...
@@ -70,7 +70,7 @@ class event_based_actor::functor_based : public extend<event_based_actor>::
with
<
mixin
::
functor_based
>
{
public:
template
<
class
...
Ts
>
functor_based
(
Ts
&&
...
vs
)
:
combined_type
(
std
::
forward
<
Ts
>
(
v
s
)...)
{
functor_based
(
Ts
&&
...
xs
)
:
combined_type
(
std
::
forward
<
Ts
>
(
x
s
)...)
{
// nop
}
behavior
make_behavior
()
override
;
...
...
libcaf_core/caf/local_actor.hpp
View file @
bddecb9c
...
...
@@ -70,35 +70,35 @@ class local_actor : public abstract_actor {
* spawn untyped actors *
****************************************************************************/
template
<
class
T
,
spawn_options
Os
=
no_spawn_options
,
class
...
V
s
>
actor
spawn
(
Vs
&&
...
v
s
)
{
template
<
class
T
,
spawn_options
Os
=
no_spawn_options
,
class
...
T
s
>
actor
spawn
(
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
spawn_class
<
T
,
os
>
(
host
(),
empty_before_launch_callback
{},
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
template
<
spawn_options
Os
=
no_spawn_options
,
class
...
V
s
>
actor
spawn
(
Vs
&&
...
v
s
)
{
template
<
spawn_options
Os
=
no_spawn_options
,
class
...
T
s
>
actor
spawn
(
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
spawn_functor
<
os
>
(
host
(),
empty_before_launch_callback
{},
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
template
<
class
T
,
spawn_options
Os
,
class
...
V
s
>
actor
spawn_in_group
(
const
group
&
grp
,
Vs
&&
...
v
s
)
{
template
<
class
T
,
spawn_options
Os
,
class
...
T
s
>
actor
spawn_in_group
(
const
group
&
grp
,
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
spawn_class
<
T
,
os
>
(
host
(),
group_subscriber
{
grp
},
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
template
<
spawn_options
Os
=
no_spawn_options
,
class
...
V
s
>
actor
spawn_in_group
(
const
group
&
grp
,
Vs
&&
...
v
s
)
{
template
<
spawn_options
Os
=
no_spawn_options
,
class
...
T
s
>
actor
spawn_in_group
(
const
group
&
grp
,
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
spawn_functor
<
os
>
(
host
(),
group_subscriber
{
grp
},
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
...
...
@@ -106,30 +106,30 @@ class local_actor : public abstract_actor {
* spawn typed actors *
****************************************************************************/
template
<
class
T
,
spawn_options
Os
=
no_spawn_options
,
class
...
V
s
>
template
<
class
T
,
spawn_options
Os
=
no_spawn_options
,
class
...
T
s
>
typename
actor_handle_from_signature_list
<
typename
T
::
signatures
>::
type
spawn_typed
(
Vs
&&
...
v
s
)
{
spawn_typed
(
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
spawn_class
<
T
,
os
>
(
host
(),
empty_before_launch_callback
{},
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
template
<
spawn_options
Os
=
no_spawn_options
,
typename
F
,
class
...
V
s
>
template
<
spawn_options
Os
=
no_spawn_options
,
typename
F
,
class
...
T
s
>
typename
infer_typed_actor_handle
<
typename
detail
::
get_callable_trait
<
F
>::
result_type
,
typename
detail
::
tl_head
<
typename
detail
::
get_callable_trait
<
F
>::
arg_types
>::
type
>::
type
spawn_typed
(
F
fun
,
Vs
&&
...
v
s
)
{
spawn_typed
(
F
fun
,
Ts
&&
...
x
s
)
{
constexpr
auto
os
=
make_unbound
(
Os
);
auto
res
=
caf
::
spawn_typed_functor
<
os
>
(
host
(),
empty_before_launch_callback
{},
std
::
move
(
fun
),
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
return
eval_opts
(
Os
,
std
::
move
(
res
));
}
...
...
@@ -138,43 +138,43 @@ class local_actor : public abstract_actor {
****************************************************************************/
/**
* Sends `{
v
s...} to `dest` using the priority `mp`.
* Sends `{
x
s...} to `dest` using the priority `mp`.
*/
template
<
class
...
V
s
>
void
send
(
message_priority
mp
,
const
channel
&
dest
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
Vs
)
>
0
,
"sizeof...(V
s) == 0"
);
send_impl
(
mp
,
actor_cast
<
abstract_channel
*>
(
dest
),
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
void
send
(
message_priority
mp
,
const
channel
&
dest
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"sizeof...(T
s) == 0"
);
send_impl
(
mp
,
actor_cast
<
abstract_channel
*>
(
dest
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `{
v
s...} to `dest` using normal priority.
* Sends `{
x
s...} to `dest` using normal priority.
*/
template
<
class
...
V
s
>
void
send
(
const
channel
&
dest
,
Vs
&&
...
v
s
)
{
send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
void
send
(
const
channel
&
dest
,
Ts
&&
...
x
s
)
{
send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `{
v
s...} to `dest` using the priority `mp`.
* Sends `{
x
s...} to `dest` using the priority `mp`.
*/
template
<
class
...
Ts
,
class
...
V
s
>
void
send
(
message_priority
mp
,
const
typed_actor
<
Ts
...
>&
dest
,
Vs
&&
...
v
s
)
{
template
<
class
...
Sigs
,
class
...
T
s
>
void
send
(
message_priority
mp
,
const
typed_actor
<
Sigs
...
>&
dest
,
Ts
&&
...
x
s
)
{
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
dest
,
tk
);
send_impl
(
mp
,
actor_cast
<
abstract_channel
*>
(
dest
),
std
::
forward
<
Vs
>
(
v
s
)...);
send_impl
(
mp
,
actor_cast
<
abstract_channel
*>
(
dest
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `{
v
s...} to `dest` using normal priority.
* Sends `{
x
s...} to `dest` using normal priority.
*/
template
<
class
...
Ts
,
class
...
V
s
>
void
send
(
const
typed_actor
<
Ts
...
>&
dest
,
Vs
&&
...
v
s
)
{
send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
Sigs
,
class
...
T
s
>
void
send
(
const
typed_actor
<
Sigs
...
>&
dest
,
Ts
&&
...
x
s
)
{
send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
...
...
@@ -194,19 +194,19 @@ class local_actor : public abstract_actor {
* Sends a message to `dest` that is delayed by `rel_time`
* using the priority `mp`.
*/
template
<
class
...
V
s
>
template
<
class
...
T
s
>
void
delayed_send
(
message_priority
mp
,
const
channel
&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
delayed_send_impl
(
mp
,
dest
,
rtime
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...));
const
duration
&
rtime
,
Ts
&&
...
x
s
)
{
delayed_send_impl
(
mp
,
dest
,
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...));
}
/**
* Sends a message to `dest` that is delayed by `rel_time`.
*/
template
<
class
...
V
s
>
void
delayed_send
(
const
channel
&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
template
<
class
...
T
s
>
void
delayed_send
(
const
channel
&
dest
,
const
duration
&
rtime
,
Ts
&&
...
x
s
)
{
delayed_send_impl
(
message_priority
::
normal
,
dest
,
rtime
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...));
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...));
}
/****************************************************************************
...
...
@@ -501,17 +501,17 @@ class local_actor : public abstract_actor {
/** @endcond */
private:
template
<
class
V
,
class
...
V
s
>
template
<
class
T
,
class
...
T
s
>
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
V
>::
type
,
message
>::
value
!
std
::
is_same
<
typename
std
::
decay
<
T
>::
type
,
message
>::
value
>::
type
send_impl
(
message_priority
mp
,
abstract_channel
*
dest
,
V
&&
v
,
Vs
&&
...
v
s
)
{
send_impl
(
message_priority
mp
,
abstract_channel
*
dest
,
T
&&
x
,
Ts
&&
...
x
s
)
{
if
(
!
dest
)
{
return
;
}
dest
->
enqueue
(
mailbox_element
::
make_joint
(
address
(),
message_id
::
make
(
mp
),
std
::
forward
<
V
>
(
v
),
std
::
forward
<
Vs
>
(
v
s
)...),
std
::
forward
<
T
>
(
x
),
std
::
forward
<
Ts
>
(
x
s
)...),
host
());
}
...
...
libcaf_core/caf/mailbox_element.hpp
View file @
bddecb9c
...
...
@@ -64,18 +64,18 @@ class mailbox_element : public memory_managed {
static
unique_ptr
make
(
actor_addr
sender
,
message_id
id
,
message
msg
);
template
<
class
...
V
s
>
static
unique_ptr
make_joint
(
actor_addr
sender
,
message_id
id
,
Vs
&&
...
v
s
)
{
template
<
class
...
T
s
>
static
unique_ptr
make_joint
(
actor_addr
sender
,
message_id
id
,
Ts
&&
...
x
s
)
{
using
value_storage
=
detail
::
tuple_vals
<
typename
unbox_message_element
<
typename
detail
::
strip_and_convert
<
V
s
>::
type
typename
detail
::
strip_and_convert
<
T
s
>::
type
>::
type
...
>
;
std
::
integral_constant
<
size_t
,
2
>
tk
;
using
storage
=
detail
::
pair_storage
<
mailbox_element
,
value_storage
>
;
auto
ptr
=
detail
::
memory
::
create
<
storage
>
(
tk
,
std
::
move
(
sender
),
id
,
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
ptr
->
first
.
msg
.
reset
(
&
(
ptr
->
second
),
false
);
return
unique_ptr
{
&
(
ptr
->
first
)};
}
...
...
libcaf_core/caf/match_case.hpp
View file @
bddecb9c
...
...
@@ -95,14 +95,14 @@ struct has_none {
return
false
;
}
template
<
class
V
,
class
...
V
s
>
bool
operator
()(
const
V
&
,
const
Vs
&
...
v
s
)
const
{
return
(
*
this
)(
v
s
...);
template
<
class
T
,
class
...
T
s
>
bool
operator
()(
const
T
&
,
const
Ts
&
...
x
s
)
const
{
return
(
*
this
)(
x
s
...);
}
template
<
class
V
,
class
...
V
s
>
bool
operator
()(
const
optional
<
V
>&
v
,
const
Vs
&
...
v
s
)
const
{
return
!
v
||
(
*
this
)(
v
s
...);
template
<
class
T
,
class
...
T
s
>
bool
operator
()(
const
optional
<
T
>&
x
,
const
Ts
&
...
x
s
)
const
{
return
!
x
||
(
*
this
)(
x
s
...);
}
};
...
...
@@ -113,9 +113,9 @@ class lfinvoker {
// nop
}
template
<
class
...
V
s
>
typename
detail
::
get_callable_trait
<
F
>::
result_type
operator
()(
Vs
&&
...
v
s
)
{
return
m_fun
(
unopt
(
std
::
forward
<
Vs
>
(
v
s
))...);
template
<
class
...
T
s
>
typename
detail
::
get_callable_trait
<
F
>::
result_type
operator
()(
Ts
&&
...
x
s
)
{
return
m_fun
(
unopt
(
std
::
forward
<
Ts
>
(
x
s
))...);
}
private:
...
...
@@ -129,9 +129,9 @@ class lfinvoker<true, F> {
// nop
}
template
<
class
...
V
s
>
unit_t
operator
()(
Vs
&&
...
v
s
)
{
m_fun
(
unopt
(
std
::
forward
<
Vs
>
(
v
s
))...);
template
<
class
...
T
s
>
unit_t
operator
()(
Ts
&&
...
x
s
)
{
m_fun
(
unopt
(
std
::
forward
<
Ts
>
(
x
s
))...);
return
unit
;
}
...
...
libcaf_core/caf/message.hpp
View file @
bddecb9c
...
...
@@ -343,8 +343,8 @@ class message {
struct
move_from_tuple_helper
{
template
<
class
...
Ts
>
inline
message
operator
()(
Ts
&
...
v
s
)
{
return
make_message
(
std
::
move
(
v
s
)...);
inline
message
operator
()(
Ts
&
...
x
s
)
{
return
make_message
(
std
::
move
(
x
s
)...);
}
};
...
...
@@ -442,24 +442,24 @@ struct unbox_message_element<atom_constant<V>> {
};
/**
* Returns a new `message` containing the values `(
v, v
s...)`.
* Returns a new `message` containing the values `(
x, x
s...)`.
* @relates message
*/
template
<
class
V
,
class
...
V
s
>
template
<
class
V
,
class
...
T
s
>
typename
std
::
enable_if
<
!
std
::
is_same
<
message
,
typename
std
::
decay
<
V
>::
type
>::
value
||
(
sizeof
...(
V
s
)
>
0
),
||
(
sizeof
...(
T
s
)
>
0
),
message
>::
type
make_message
(
V
&&
v
,
Vs
&&
...
v
s
)
{
make_message
(
V
&&
x
,
Ts
&&
...
x
s
)
{
using
storage
=
detail
::
tuple_vals
<
typename
unbox_message_element
<
typename
detail
::
strip_and_convert
<
V
>::
type
>::
type
,
typename
unbox_message_element
<
typename
detail
::
strip_and_convert
<
V
s
>::
type
typename
detail
::
strip_and_convert
<
T
s
>::
type
>::
type
...
>
;
auto
ptr
=
make_counted
<
storage
>
(
std
::
forward
<
V
>
(
v
),
std
::
forward
<
Vs
>
(
v
s
)...);
auto
ptr
=
make_counted
<
storage
>
(
std
::
forward
<
V
>
(
x
),
std
::
forward
<
Ts
>
(
x
s
)...);
return
message
{
detail
::
message_data
::
cow_ptr
{
std
::
move
(
ptr
)}};
}
...
...
libcaf_core/caf/message_builder.hpp
View file @
bddecb9c
...
...
@@ -71,11 +71,11 @@ class message_builder {
}
/**
* Adds `
what
` to the elements of the buffer.
* Adds `
x
` to the elements of the buffer.
*/
template
<
class
T
>
message_builder
&
append
(
T
what
)
{
return
append_impl
<
T
>
(
std
::
move
(
what
));
message_builder
&
append
(
T
x
)
{
return
append_impl
<
T
>
(
std
::
move
(
x
));
}
/**
...
...
libcaf_core/caf/message_handler.hpp
View file @
bddecb9c
...
...
@@ -84,17 +84,17 @@ class message_handler {
* functors, or other message handlers.
*/
template
<
class
T
,
class
...
Ts
>
message_handler
(
const
T
&
v
,
Ts
&&
...
v
s
)
{
assign
(
v
,
std
::
forward
<
Ts
>
(
v
s
)...);
message_handler
(
const
T
&
v
,
Ts
&&
...
x
s
)
{
assign
(
v
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Assigns new message handlers.
*/
template
<
class
...
V
s
>
void
assign
(
Vs
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"assign without arguments called"
);
m_impl
=
detail
::
make_behavior
(
v
s
...);
template
<
class
...
T
s
>
void
assign
(
Ts
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"assign without arguments called"
);
m_impl
=
detail
::
make_behavior
(
x
s
...);
}
/**
...
...
libcaf_core/caf/mixin/behavior_stack_based.hpp
View file @
bddecb9c
...
...
@@ -41,8 +41,8 @@ class behavior_stack_based_impl : public Base {
nonblocking_response_handle_tag
>
;
template
<
class
...
Ts
>
behavior_stack_based_impl
(
Ts
&&
...
v
s
)
:
Base
(
std
::
forward
<
Ts
>
(
v
s
)...),
behavior_stack_based_impl
(
Ts
&&
...
x
s
)
:
Base
(
std
::
forward
<
Ts
>
(
x
s
)...),
m_timeout_id
(
0
)
{
// nop
}
...
...
libcaf_core/caf/mixin/functor_based.hpp
View file @
bddecb9c
...
...
@@ -39,12 +39,12 @@ class functor_based : public Base {
}
template
<
class
F
,
class
...
Ts
>
functor_based
(
F
f
,
Ts
&&
...
v
s
)
{
init
(
std
::
move
(
f
),
std
::
forward
<
Ts
>
(
v
s
)...);
functor_based
(
F
f
,
Ts
&&
...
x
s
)
{
init
(
std
::
move
(
f
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
template
<
class
F
,
class
...
Ts
>
void
init
(
F
f
,
Ts
&&
...
v
s
)
{
void
init
(
F
f
,
Ts
&&
...
x
s
)
{
using
trait
=
typename
detail
::
get_callable_trait
<
F
>::
type
;
using
arg_types
=
typename
trait
::
arg_types
;
using
result_type
=
typename
trait
::
result_type
;
...
...
@@ -54,7 +54,7 @@ class functor_based : public Base {
typename
detail
::
tl_head
<
arg_types
>::
type
,
pointer
>::
value
;
std
::
integral_constant
<
bool
,
returns_behavior
>
token1
;
std
::
integral_constant
<
bool
,
uses_first_arg
>
token2
;
set
(
token1
,
token2
,
std
::
move
(
f
),
std
::
forward
<
Ts
>
(
v
s
)...);
set
(
token1
,
token2
,
std
::
move
(
f
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
protected:
...
...
libcaf_core/caf/mixin/sync_sender.hpp
View file @
bddecb9c
...
...
@@ -43,93 +43,93 @@ class sync_sender_impl : public Base {
****************************************************************************/
/**
* Sends `{
vs...}` as a synchronous message to `dest` with priority `prio
`.
* Sends `{
xs...}` as a synchronous message to `dest` with priority `mp
`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
V
s
>
response_handle_type
sync_send
(
message_priority
prio
,
const
actor
&
dest
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"no message to send"
);
return
{
dptr
()
->
sync_send_impl
(
prio
,
dest
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...)),
template
<
class
...
T
s
>
response_handle_type
sync_send
(
message_priority
mp
,
const
actor
&
dest
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"no message to send"
);
return
{
dptr
()
->
sync_send_impl
(
mp
,
dest
,
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...)),
dptr
()};
}
/**
* Sends `{
v
s...}` as a synchronous message to `dest`.
* Sends `{
x
s...}` as a synchronous message to `dest`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
V
s
>
response_handle_type
sync_send
(
const
actor
&
dest
,
Vs
&&
...
v
s
)
{
return
sync_send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
response_handle_type
sync_send
(
const
actor
&
dest
,
Ts
&&
...
x
s
)
{
return
sync_send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `{
vs...}` as a synchronous message to `dest` with priority `prio
`.
* Sends `{
xs...}` as a synchronous message to `dest` with priority `mp
`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
Rs
,
class
...
V
s
>
template
<
class
...
Sigs
,
class
...
T
s
>
response_handle
<
Subtype
,
typename
detail
::
deduce_output_type
<
detail
::
type_list
<
R
s
...
>
,
detail
::
type_list
<
Sig
s
...
>
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
>::
type
,
HandleTag
>
sync_send
(
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
dest
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"no message to send"
);
sync_send
(
message_priority
mp
,
const
typed_actor
<
Sigs
...
>&
dest
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"no message to send"
);
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
dest
,
tk
);
return
{
dptr
()
->
sync_send_impl
(
prio
,
actor_cast
<
actor
>
(
dest
),
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...)),
return
{
dptr
()
->
sync_send_impl
(
mp
,
actor_cast
<
actor
>
(
dest
),
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...)),
dptr
()};
}
/**
* Sends `{
v
s...}` as a synchronous message to `dest`.
* Sends `{
x
s...}` as a synchronous message to `dest`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
Rs
,
class
...
V
s
>
template
<
class
...
Sigs
,
class
...
T
s
>
response_handle
<
Subtype
,
typename
detail
::
deduce_output_type
<
detail
::
type_list
<
R
s
...
>
,
detail
::
type_list
<
Sig
s
...
>
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
>::
type
,
HandleTag
>
sync_send
(
const
typed_actor
<
Rs
...
>&
dest
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"no message to send"
);
sync_send
(
const
typed_actor
<
Sigs
...
>&
dest
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"no message to send"
);
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
dest
,
tk
);
return
{
dptr
()
->
sync_send_impl
(
message_priority
::
normal
,
actor_cast
<
actor
>
(
dest
),
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...)),
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...)),
dptr
()};
}
...
...
@@ -138,90 +138,90 @@ class sync_sender_impl : public Base {
****************************************************************************/
/**
* Sends `{
vs...}` as a synchronous message to `dest` with priority `prio
`
* Sends `{
xs...}` as a synchronous message to `dest` with priority `mp
`
* and relative timeout `rtime`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
V
s
>
response_handle_type
timed_sync_send
(
message_priority
prio
,
const
actor
&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"no message to send"
);
return
{
dptr
()
->
timed_sync_send_impl
(
prio
,
dest
,
rtime
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...)),
template
<
class
...
T
s
>
response_handle_type
timed_sync_send
(
message_priority
mp
,
const
actor
&
dest
,
const
duration
&
rtime
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"no message to send"
);
return
{
dptr
()
->
timed_sync_send_impl
(
mp
,
dest
,
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...)),
dptr
()};
}
/**
* Sends `{
v
s...}` as a synchronous message to `dest` with
* Sends `{
x
s...}` as a synchronous message to `dest` with
* relative timeout `rtime`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
V
s
>
template
<
class
...
T
s
>
response_handle_type
timed_sync_send
(
const
actor
&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
Ts
&&
...
x
s
)
{
return
timed_sync_send
(
message_priority
::
normal
,
dest
,
rtime
,
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `{
vs...}` as a synchronous message to `dest` with priority `prio
`
* Sends `{
xs...}` as a synchronous message to `dest` with priority `mp
`
* and relative timeout `rtime`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
Rs
,
class
...
V
s
>
template
<
class
...
Sigs
,
class
...
T
s
>
response_handle
<
Subtype
,
typename
detail
::
deduce_output_type
<
detail
::
type_list
<
R
s
...
>
,
detail
::
type_list
<
Sig
s
...
>
,
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>::
type
,
HandleTag
>
timed_sync_send
(
message_priority
prio
,
const
typed_actor
<
R
s
...
>&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
static_assert
(
sizeof
...(
V
s
)
>
0
,
"no message to send"
);
timed_sync_send
(
message_priority
mp
,
const
typed_actor
<
Sig
s
...
>&
dest
,
const
duration
&
rtime
,
Ts
&&
...
x
s
)
{
static_assert
(
sizeof
...(
T
s
)
>
0
,
"no message to send"
);
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
dest
,
tk
);
return
{
dptr
()
->
timed_sync_send_impl
(
prio
,
actor_cast
<
actor
>
(
dest
),
rtime
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...)),
return
{
dptr
()
->
timed_sync_send_impl
(
mp
,
actor_cast
<
actor
>
(
dest
),
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...)),
dptr
()};
}
/**
* Sends `{
v
s...}` as a synchronous message to `dest` with
* Sends `{
x
s...}` as a synchronous message to `dest` with
* relative timeout `rtime`.
* @returns A handle identifying a future-like handle to the response.
* @warning The returned handle is actor specific and the response to the
* sent message cannot be received by another actor.
* @throws std::invalid_argument if `dest == invalid_actor`
*/
template
<
class
...
Rs
,
class
...
V
s
>
template
<
class
...
Sigs
,
class
...
T
s
>
response_handle
<
Subtype
,
typename
detail
::
deduce_output_type
<
detail
::
type_list
<
R
s
...
>
,
detail
::
type_list
<
Sig
s
...
>
,
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>::
type
,
HandleTag
>
timed_sync_send
(
const
typed_actor
<
R
s
...
>&
dest
,
const
duration
&
rtime
,
Vs
&&
...
v
s
)
{
timed_sync_send
(
const
typed_actor
<
Sig
s
...
>&
dest
,
const
duration
&
rtime
,
Ts
&&
...
x
s
)
{
return
timed_sync_send
(
message_priority
::
normal
,
dest
,
rtime
,
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
}
/****************************************************************************
...
...
@@ -229,13 +229,13 @@ class sync_sender_impl : public Base {
****************************************************************************/
// <backward_compatibility version="0.9">
response_handle_type
sync_send_tuple
(
message_priority
prio
,
const
actor
&
dest
,
response_handle_type
sync_send_tuple
(
message_priority
mp
,
const
actor
&
dest
,
message
what
)
CAF_DEPRECATED
;
response_handle_type
sync_send_tuple
(
const
actor
&
dest
,
message
what
)
CAF_DEPRECATED
;
response_handle_type
timed_sync_send_tuple
(
message_priority
prio
,
response_handle_type
timed_sync_send_tuple
(
message_priority
mp
,
const
actor
&
dest
,
const
duration
&
rtime
,
message
what
)
CAF_DEPRECATED
;
...
...
@@ -261,9 +261,9 @@ class sync_sender {
// <backward_compatibility version="0.9">
template
<
class
B
,
class
S
,
class
H
>
typename
sync_sender_impl
<
B
,
S
,
H
>::
response_handle_type
sync_sender_impl
<
B
,
S
,
H
>::
sync_send_tuple
(
message_priority
prio
,
sync_sender_impl
<
B
,
S
,
H
>::
sync_send_tuple
(
message_priority
mp
,
const
actor
&
dest
,
message
what
)
{
return
sync_send
(
prio
,
dest
,
std
::
move
(
what
));
return
sync_send
(
mp
,
dest
,
std
::
move
(
what
));
}
template
<
class
B
,
class
S
,
class
H
>
...
...
@@ -274,11 +274,11 @@ sync_sender_impl<B, S, H>::sync_send_tuple(const actor& dest, message what) {
template
<
class
B
,
class
S
,
class
H
>
typename
sync_sender_impl
<
B
,
S
,
H
>::
response_handle_type
sync_sender_impl
<
B
,
S
,
H
>::
timed_sync_send_tuple
(
message_priority
prio
,
sync_sender_impl
<
B
,
S
,
H
>::
timed_sync_send_tuple
(
message_priority
mp
,
const
actor
&
dest
,
const
duration
&
rtime
,
message
msg
)
{
return
timed_sync_send
(
prio
,
dest
,
rtime
,
std
::
move
(
msg
));
return
timed_sync_send
(
mp
,
dest
,
rtime
,
std
::
move
(
msg
));
}
template
<
class
B
,
class
S
,
class
H
>
...
...
libcaf_core/caf/policy/not_prioritizing.hpp
View file @
bddecb9c
...
...
@@ -51,8 +51,8 @@ class not_prioritizing {
self
->
mailbox
().
cache
().
push_second_back
(
ptr
.
release
());
}
template
<
class
Actor
,
class
...
V
s
>
bool
invoke_from_cache
(
Actor
*
self
,
V
s
&
...
args
)
{
template
<
class
Actor
,
class
...
T
s
>
bool
invoke_from_cache
(
Actor
*
self
,
T
s
&
...
args
)
{
auto
&
cache
=
self
->
mailbox
().
cache
();
auto
i
=
cache
.
second_begin
();
auto
e
=
cache
.
second_end
();
...
...
libcaf_core/caf/response_handle.hpp
View file @
bddecb9c
...
...
@@ -68,9 +68,9 @@ class response_handle<Self, message, nonblocking_response_handle_tag> {
// nop
}
template
<
class
...
V
s
>
continue_helper
then
(
Vs
&&
...
v
s
)
const
{
behavior
bhvr
{
std
::
forward
<
Vs
>
(
v
s
)...};
template
<
class
...
T
s
>
continue_helper
then
(
Ts
&&
...
x
s
)
const
{
behavior
bhvr
{
std
::
forward
<
Ts
>
(
x
s
)...};
m_self
->
bhvr_stack
().
push_back
(
std
::
move
(
bhvr
),
m_mid
);
return
{
m_mid
};
}
...
...
@@ -138,9 +138,9 @@ class response_handle<Self, message, blocking_response_handle_tag> {
m_self
->
dequeue_response
(
bhvr
,
m_mid
);
}
template
<
class
...
V
s
>
void
await
(
Vs
&&
...
v
s
)
const
{
behavior
bhvr
{
std
::
forward
<
Vs
>
(
v
s
)...};
template
<
class
...
T
s
>
void
await
(
Ts
&&
...
x
s
)
const
{
behavior
bhvr
{
std
::
forward
<
Ts
>
(
x
s
)...};
m_self
->
dequeue_response
(
bhvr
,
m_mid
);
}
...
...
libcaf_core/caf/send.hpp
View file @
bddecb9c
...
...
@@ -36,104 +36,104 @@ namespace caf {
/**
* Sends `to` a message under the identity of `from` with priority `prio`.
*/
template
<
class
...
V
s
>
template
<
class
...
T
s
>
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
channel
&
to
,
Vs
&&
...
v
s
)
{
const
channel
&
to
,
Ts
&&
...
x
s
)
{
if
(
!
to
)
{
return
;
}
message_id
mid
;
to
->
enqueue
(
from
.
address
(),
prio
==
message_priority
::
high
?
mid
.
with_high_priority
()
:
mid
,
make_message
(
std
::
forward
<
Vs
>
(
v
s
)...),
nullptr
);
make_message
(
std
::
forward
<
Ts
>
(
x
s
)...),
nullptr
);
}
/**
* Sends `to` a message under the identity of `from`.
*/
template
<
class
...
V
s
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Vs
&&
...
v
s
)
{
send_as
(
from
,
message_priority
::
normal
,
to
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Ts
&&
...
x
s
)
{
send_as
(
from
,
message_priority
::
normal
,
to
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `to` a message under the identity of `from` with priority `prio`.
*/
template
<
class
...
Rs
,
class
...
V
s
>
template
<
class
...
Sigs
,
class
...
T
s
>
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
v
s
)
{
const
typed_actor
<
Sigs
...
>&
to
,
Ts
&&
...
x
s
)
{
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
send_as
(
from
,
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
v
s
)...);
send_as
(
from
,
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Sends `to` a message under the identity of `from`.
*/
template
<
class
...
Rs
,
class
...
V
s
>
void
send_as
(
const
actor
&
from
,
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
v
s
)
{
template
<
class
...
Sigs
,
class
...
T
s
>
void
send_as
(
const
actor
&
from
,
const
typed_actor
<
Sigs
...
>&
to
,
Ts
&&
...
x
s
)
{
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
send_as
(
from
,
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
v
s
)...);
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Anonymously sends `to` a message with priority `prio`.
*/
template
<
class
...
V
s
>
void
anon_send
(
message_priority
prio
,
const
channel
&
to
,
Vs
&&
...
v
s
)
{
send_as
(
invalid_actor
,
prio
,
to
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
void
anon_send
(
message_priority
prio
,
const
channel
&
to
,
Ts
&&
...
x
s
)
{
send_as
(
invalid_actor
,
prio
,
to
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Anonymously sends `to` a message.
*/
template
<
class
...
V
s
>
void
anon_send
(
const
channel
&
to
,
Vs
&&
...
v
s
)
{
send_as
(
invalid_actor
,
message_priority
::
normal
,
to
,
std
::
forward
<
Vs
>
(
v
s
)...);
template
<
class
...
T
s
>
void
anon_send
(
const
channel
&
to
,
Ts
&&
...
x
s
)
{
send_as
(
invalid_actor
,
message_priority
::
normal
,
to
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Anonymously sends `to` a message with priority `prio`.
*/
template
<
class
...
Rs
,
class
...
V
s
>
void
anon_send
(
message_priority
prio
,
const
typed_actor
<
R
s
...
>&
to
,
Vs
&&
...
v
s
)
{
template
<
class
...
Sigs
,
class
...
T
s
>
void
anon_send
(
message_priority
prio
,
const
typed_actor
<
Sig
s
...
>&
to
,
Ts
&&
...
x
s
)
{
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
anon_send
(
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
v
s
)...);
anon_send
(
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
* Anonymously sends `to` a message.
*/
template
<
class
...
Rs
,
class
...
V
s
>
void
anon_send
(
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
v
s
)
{
template
<
class
...
Sigs
,
class
...
T
s
>
void
anon_send
(
const
typed_actor
<
Sigs
...
>&
to
,
Ts
&&
...
x
s
)
{
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
V
s
>::
type
typename
std
::
decay
<
T
s
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
anon_send
(
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
v
s
)...);
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
...
...
libcaf_core/caf/spawn.hpp
View file @
bddecb9c
...
...
@@ -234,13 +234,13 @@ actor spawn_in_group(const group& grp, Ts&&... args) {
/**
* Base class for strongly typed actors using a functor-based implementation.
*/
template
<
class
...
R
s
>
class
functor_based_typed_actor
:
public
typed_event_based_actor
<
R
s
...
>
{
template
<
class
...
Sig
s
>
class
functor_based_typed_actor
:
public
typed_event_based_actor
<
Sig
s
...
>
{
public:
/**
* Base class for actors using given interface.
*/
using
base
=
typed_event_based_actor
<
R
s
...
>
;
using
base
=
typed_event_based_actor
<
Sig
s
...
>
;
/**
* Pointer to the base class.
...
...
@@ -339,14 +339,14 @@ class functor_based_typed_actor : public typed_event_based_actor<Rs...> {
template
<
class
Result
,
class
FirstArg
>
struct
infer_typed_actor_base
;
template
<
class
...
R
s
,
class
FirstArg
>
struct
infer_typed_actor_base
<
typed_behavior
<
R
s
...
>
,
FirstArg
>
{
using
type
=
functor_based_typed_actor
<
R
s
...
>
;
template
<
class
...
Sig
s
,
class
FirstArg
>
struct
infer_typed_actor_base
<
typed_behavior
<
Sig
s
...
>
,
FirstArg
>
{
using
type
=
functor_based_typed_actor
<
Sig
s
...
>
;
};
template
<
class
...
R
s
>
struct
infer_typed_actor_base
<
void
,
typed_event_based_actor
<
R
s
...
>*>
{
using
type
=
functor_based_typed_actor
<
R
s
...
>
;
template
<
class
...
Sig
s
>
struct
infer_typed_actor_base
<
void
,
typed_event_based_actor
<
Sig
s
...
>*>
{
using
type
=
functor_based_typed_actor
<
Sig
s
...
>
;
};
/**
...
...
libcaf_core/caf/spawn_fwd.hpp
View file @
bddecb9c
...
...
@@ -76,23 +76,23 @@ template <class TypedBehavior, class FirstArg>
struct
infer_typed_actor_handle
;
// infer actor type from result type if possible
template
<
class
...
R
s
,
class
FirstArg
>
struct
infer_typed_actor_handle
<
typed_behavior
<
R
s
...
>
,
FirstArg
>
{
using
type
=
typed_actor
<
R
s
...
>
;
template
<
class
...
Sig
s
,
class
FirstArg
>
struct
infer_typed_actor_handle
<
typed_behavior
<
Sig
s
...
>
,
FirstArg
>
{
using
type
=
typed_actor
<
Sig
s
...
>
;
};
// infer actor type from first argument if result type is void
template
<
class
...
R
s
>
struct
infer_typed_actor_handle
<
void
,
typed_event_based_actor
<
R
s
...
>*>
{
using
type
=
typed_actor
<
R
s
...
>
;
template
<
class
...
Sig
s
>
struct
infer_typed_actor_handle
<
void
,
typed_event_based_actor
<
Sig
s
...
>*>
{
using
type
=
typed_actor
<
Sig
s
...
>
;
};
template
<
class
SignatureList
>
struct
actor_handle_from_signature_list
;
template
<
class
...
R
s
>
struct
actor_handle_from_signature_list
<
detail
::
type_list
<
R
s
...
>>
{
using
type
=
typed_actor
<
R
s
...
>
;
template
<
class
...
Sig
s
>
struct
actor_handle_from_signature_list
<
detail
::
type_list
<
Sig
s
...
>>
{
using
type
=
typed_actor
<
Sig
s
...
>
;
};
template
<
spawn_options
Os
,
typename
BeforeLaunch
,
typename
F
,
class
...
Ts
>
...
...
libcaf_core/caf/typed_actor.hpp
View file @
bddecb9c
...
...
@@ -36,18 +36,19 @@ class local_actor;
struct
invalid_actor_addr_t
;
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
typed_event_based_actor
;
/**
* Identifies a strongly typed actor.
* @tparam Rs Interface as `replies_to<...>::with<...>` parameter pack.
* @tparam Sigs Signature of this actor as `replies_to<...>::with<...>`
* parameter pack.
*/
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
typed_actor
:
detail
::
comparable
<
typed_actor
<
R
s
...
>>
,
detail
::
comparable
<
typed_actor
<
R
s
...
>
,
actor_addr
>
,
detail
::
comparable
<
typed_actor
<
R
s
...
>
,
invalid_actor_addr_t
>
{
:
detail
::
comparable
<
typed_actor
<
Sig
s
...
>>
,
detail
::
comparable
<
typed_actor
<
Sig
s
...
>
,
actor_addr
>
,
detail
::
comparable
<
typed_actor
<
Sig
s
...
>
,
invalid_actor_addr_t
>
{
friend
class
local_actor
;
...
...
@@ -63,24 +64,24 @@ class typed_actor
template
<
class
...
Es
>
struct
extend
{
using
type
=
typed_actor
<
R
s
...,
Es
...
>
;
using
type
=
typed_actor
<
Sig
s
...,
Es
...
>
;
};
/**
* Identifies the behavior type actors of this kind use
* for their behavior stack.
*/
using
behavior_type
=
typed_behavior
<
R
s
...
>
;
using
behavior_type
=
typed_behavior
<
Sig
s
...
>
;
/**
* Identifies pointers to instances of this kind of actor.
*/
using
pointer
=
typed_event_based_actor
<
R
s
...
>*
;
using
pointer
=
typed_event_based_actor
<
Sig
s
...
>*
;
/**
* Identifies the base class for this kind of actor.
*/
using
base
=
typed_event_based_actor
<
R
s
...
>
;
using
base
=
typed_event_based_actor
<
Sig
s
...
>
;
typed_actor
()
=
default
;
typed_actor
(
typed_actor
&&
)
=
default
;
...
...
@@ -88,13 +89,13 @@ class typed_actor
typed_actor
&
operator
=
(
typed_actor
&&
)
=
default
;
typed_actor
&
operator
=
(
const
typed_actor
&
)
=
default
;
template
<
class
...
Other
R
s
>
typed_actor
(
const
typed_actor
<
Other
R
s
...
>&
other
)
{
template
<
class
...
Other
Sig
s
>
typed_actor
(
const
typed_actor
<
Other
Sig
s
...
>&
other
)
{
set
(
std
::
move
(
other
));
}
template
<
class
...
Other
R
s
>
typed_actor
&
operator
=
(
const
typed_actor
<
Other
R
s
...
>&
other
)
{
template
<
class
...
Other
Sig
s
>
typed_actor
&
operator
=
(
const
typed_actor
<
Other
Sig
s
...
>&
other
)
{
set
(
std
::
move
(
other
));
return
*
this
;
}
...
...
@@ -132,7 +133,7 @@ class typed_actor
}
static
std
::
set
<
std
::
string
>
message_types
()
{
return
{
R
s
::
static_type_name
()...};
return
{
Sig
s
::
static_type_name
()...};
}
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
m_ptr
);
}
...
...
@@ -151,15 +152,15 @@ class typed_actor
"'this' must be a strict subset of 'other'"
);
}
template
<
class
...
Other
R
s
>
inline
void
set
(
const
typed_actor
<
Other
R
s
...
>&
other
)
{
check_signatures
<
detail
::
type_list
<
Rs
...
>
,
detail
::
type_list
<
OtherR
s
...
>>
();
template
<
class
...
Other
Sig
s
>
inline
void
set
(
const
typed_actor
<
Other
Sig
s
...
>&
other
)
{
check_signatures
<
detail
::
type_list
<
Sigs
...
>
,
detail
::
type_list
<
OtherSig
s
...
>>
();
m_ptr
=
other
.
m_ptr
;
}
template
<
class
Impl
>
inline
void
set
(
intrusive_ptr
<
Impl
>&
other
)
{
check_signatures
<
detail
::
type_list
<
R
s
...
>
,
typename
Impl
::
signatures
>
();
check_signatures
<
detail
::
type_list
<
Sig
s
...
>
,
typename
Impl
::
signatures
>
();
m_ptr
=
std
::
move
(
other
);
}
...
...
libcaf_core/caf/typed_behavior.hpp
View file @
bddecb9c
...
...
@@ -30,7 +30,7 @@
namespace
caf
{
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
functor_based_typed_actor
;
namespace
detail
{
...
...
@@ -57,18 +57,6 @@ struct collapse_replies_to_statement<List, none_t> {
using
type
=
List
;
};
/*
template <class List>
struct unbox_typed_continue_helper {
using type = List;
};
template <class List>
struct unbox_typed_continue_helper<typed_continue_helper<List>> {
using type = List;
};
*/
template
<
class
Input
,
class
RepliesToWith
>
struct
same_input
:
std
::
is_same
<
Input
,
typename
RepliesToWith
::
input_types
>
{};
...
...
@@ -168,7 +156,7 @@ void static_check_typed_behavior_input() {
}
// namespace detail
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
typed_actor
;
namespace
mixin
{
...
...
@@ -176,10 +164,10 @@ template <class, class, class>
class
behavior_stack_based_impl
;
}
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
typed_behavior
{
public:
template
<
class
...
Other
R
s
>
template
<
class
...
Other
Sig
s
>
friend
class
typed_actor
;
template
<
class
,
class
,
class
>
...
...
@@ -193,11 +181,11 @@ class typed_behavior {
typed_behavior
&
operator
=
(
typed_behavior
&&
)
=
default
;
typed_behavior
&
operator
=
(
const
typed_behavior
&
)
=
default
;
using
signatures
=
detail
::
type_list
<
R
s
...
>
;
using
signatures
=
detail
::
type_list
<
Sig
s
...
>
;
template
<
class
...
V
s
>
typed_behavior
(
Vs
...
v
s
)
{
set
(
detail
::
make_behavior
(
v
s
...));
template
<
class
...
T
s
>
typed_behavior
(
Ts
...
x
s
)
{
set
(
detail
::
make_behavior
(
x
s
...));
}
explicit
operator
bool
()
const
{
...
...
libcaf_core/caf/typed_event_based_actor.hpp
View file @
bddecb9c
...
...
@@ -37,18 +37,18 @@ namespace caf {
* `blocking_api` flag.
* @extends mailbox_based_actor
*/
template
<
class
...
R
s
>
template
<
class
...
Sig
s
>
class
typed_event_based_actor
:
public
extend
<
mailbox_based_actor
,
typed_event_based_actor
<
R
s
...
>>::
template
with
<
mixin
::
behavior_stack_based
<
typed_behavior
<
R
s
...>
>::
template
impl
,
extend
<
mailbox_based_actor
,
typed_event_based_actor
<
Sig
s
...
>>::
template
with
<
mixin
::
behavior_stack_based
<
typed_behavior
<
Sig
s
...>
>::
template
impl
,
mixin
::
sync_sender
<
nonblocking_response_handle_tag
>
::
template
impl
>
{
public:
using
signatures
=
detail
::
type_list
<
R
s
...
>
;
using
signatures
=
detail
::
type_list
<
Sig
s
...
>
;
using
behavior_type
=
typed_behavior
<
R
s
...
>
;
using
behavior_type
=
typed_behavior
<
Sig
s
...
>
;
std
::
set
<
std
::
string
>
message_types
()
const
override
{
return
{
R
s
::
static_type_name
()...};
return
{
Sig
s
::
static_type_name
()...};
}
protected:
...
...
libcaf_core/src/abstract_coordinator.cpp
View file @
bddecb9c
...
...
@@ -68,10 +68,10 @@ inline void deliver(delayed_msg& dm) {
}
template
<
class
Map
,
class
...
Ts
>
inline
void
insert_dmsg
(
Map
&
storage
,
const
duration
&
d
,
Ts
&&
...
v
s
)
{
inline
void
insert_dmsg
(
Map
&
storage
,
const
duration
&
d
,
Ts
&&
...
x
s
)
{
auto
tout
=
hrc
::
now
();
tout
+=
d
;
delayed_msg
dmsg
{
std
::
forward
<
Ts
>
(
v
s
)...};
delayed_msg
dmsg
{
std
::
forward
<
Ts
>
(
x
s
)...};
storage
.
insert
(
std
::
make_pair
(
std
::
move
(
tout
),
std
::
move
(
dmsg
)));
}
...
...
libcaf_io/caf/io/broker.hpp
View file @
bddecb9c
...
...
@@ -226,9 +226,9 @@ class broker : public extend<local_actor>::
/** @cond PRIVATE */
template
<
class
F
,
class
...
Ts
>
actor
fork
(
F
fun
,
connection_handle
hdl
,
Ts
&&
...
v
s
)
{
actor
fork
(
F
fun
,
connection_handle
hdl
,
Ts
&&
...
x
s
)
{
// provoke compile-time errors early
using
fun_res
=
decltype
(
fun
(
this
,
hdl
,
std
::
forward
<
Ts
>
(
v
s
)...));
using
fun_res
=
decltype
(
fun
(
this
,
hdl
,
std
::
forward
<
Ts
>
(
x
s
)...));
// prevent warning about unused local type
static_assert
(
std
::
is_same
<
fun_res
,
fun_res
>::
value
,
"your compiler is lying to you"
);
...
...
@@ -245,7 +245,7 @@ class broker : public extend<local_actor>::
forked
->
m_scribes
.
insert
(
std
::
make_pair
(
sptr
->
hdl
(),
sptr
));
},
fun
,
hdl
,
std
::
forward
<
Ts
>
(
v
s
)...);
fun
,
hdl
,
std
::
forward
<
Ts
>
(
x
s
)...);
}
inline
void
add_scribe
(
const
scribe_pointer
&
ptr
)
{
...
...
@@ -393,7 +393,7 @@ class broker::functor_based : public extend<broker>::
using
super
=
combined_type
;
template
<
class
...
Ts
>
functor_based
(
Ts
&&
...
vs
)
:
super
(
std
::
forward
<
Ts
>
(
v
s
)...)
{
functor_based
(
Ts
&&
...
xs
)
:
super
(
std
::
forward
<
Ts
>
(
x
s
)...)
{
// nop
}
...
...
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
bddecb9c
...
...
@@ -59,7 +59,7 @@
# include <sys/socket.h>
#endif
// poll
v
s epoll backend
// poll
x
s epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# define CAF_POLL_MULTIPLEXER
# ifndef CAF_WINDOWS
...
...
@@ -105,7 +105,7 @@ namespace network {
constexpr
int
ec_interrupted_syscall
=
EINTR
;
#endif
// poll
v
s epoll backend
// poll
x
s epoll backend
#if !defined(CAF_LINUX) || defined(CAF_POLL_IMPL) // poll() multiplexer
# ifdef CAF_WINDOWS
// From the MSDN: If the POLLPRI flag is set on a socket for the Microsoft
...
...
libcaf_io/caf/io/publish.hpp
View file @
bddecb9c
...
...
@@ -53,8 +53,8 @@ inline uint16_t publish(caf::actor whom, uint16_t port,
/**
* @copydoc publish(actor,uint16_t,const char*)
*/
template
<
class
...
R
s
>
uint16_t
typed_publish
(
typed_actor
<
R
s
...
>
whom
,
uint16_t
port
,
template
<
class
...
Sig
s
>
uint16_t
typed_publish
(
typed_actor
<
Sig
s
...
>
whom
,
uint16_t
port
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
{
if
(
!
whom
)
{
return
0
;
...
...
libcaf_io/caf/io/remote_actor.hpp
View file @
bddecb9c
...
...
@@ -34,20 +34,6 @@ namespace io {
abstract_actor_ptr
remote_actor_impl
(
std
::
set
<
std
::
string
>
ifs
,
const
std
::
string
&
host
,
uint16_t
port
);
template
<
class
List
>
struct
typed_remote_actor_helper
;
template
<
template
<
class
...
>
class
List
,
class
...
Ts
>
struct
typed_remote_actor_helper
<
List
<
Ts
...
>>
{
using
return_type
=
typed_actor
<
Ts
...
>
;
template
<
class
...
Vs
>
return_type
operator
()(
Vs
&&
...
vs
)
{
auto
iface
=
return_type
::
message_types
();
auto
tmp
=
remote_actor_impl
(
std
::
move
(
iface
),
std
::
forward
<
Vs
>
(
vs
)...);
return
actor_cast
<
return_type
>
(
tmp
);
}
};
/**
* Establish a new connection to the actor at `host` on given `port`.
* @param host Valid hostname or IP address.
...
...
@@ -71,11 +57,11 @@ inline actor remote_actor(const std::string& host, uint16_t port) {
* @throws network_error Thrown on connection error or when connecting
* to an untyped otherwise unexpected actor.
*/
template
<
class
List
>
typename
typed_remote_actor_helper
<
List
>::
return_type
typed_remote_actor
(
const
std
::
string
&
host
,
uint16_t
port
)
{
typed_remote_actor_helper
<
List
>
f
;
return
f
(
host
,
port
);
template
<
class
ActorHandle
>
ActorHandle
typed_remote_actor
(
const
std
::
string
&
host
,
uint16_t
port
)
{
auto
iface
=
ActorHandle
::
message_types
();
return
actor_cast
<
ActorHandle
>
(
remote_actor_impl
(
std
::
move
(
iface
),
host
,
port
)
);
}
}
// namespace io
...
...
libcaf_io/caf/io/spawn_io.hpp
View file @
bddecb9c
...
...
@@ -38,8 +38,8 @@ namespace io {
*/
template
<
spawn_options
Os
=
no_spawn_options
,
typename
F
=
std
::
function
<
void
(
broker
*
)>,
class
...
Ts
>
actor
spawn_io
(
F
fun
,
Ts
&&
...
v
s
)
{
return
spawn
<
broker
::
functor_based
>
(
std
::
move
(
fun
),
std
::
forward
<
Ts
>
(
v
s
)...);
actor
spawn_io
(
F
fun
,
Ts
&&
...
x
s
)
{
return
spawn
<
broker
::
functor_based
>
(
std
::
move
(
fun
),
std
::
forward
<
Ts
>
(
x
s
)...);
}
/**
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
bddecb9c
...
...
@@ -247,7 +247,7 @@ namespace network {
#endif
/******************************************************************************
* epoll()
v
s. poll() *
* epoll()
x
s. poll() *
******************************************************************************/
#ifdef CAF_EPOLL_MULTIPLEXER
...
...
libcaf_io/src/middleman.cpp
View file @
bddecb9c
...
...
@@ -276,15 +276,15 @@ class middleman_actor_impl : public middleman_actor_base::base {
return
result
;
}
template
<
class
T
,
class
...
V
s
>
void
handle_ok
(
map_type
&
storage
,
int64_t
request_id
,
Vs
&&
...
v
s
)
{
template
<
class
T
,
class
...
T
s
>
void
handle_ok
(
map_type
&
storage
,
int64_t
request_id
,
Ts
&&
...
x
s
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
request_id
));
auto
i
=
storage
.
find
(
request_id
);
if
(
i
==
storage
.
end
())
{
CAF_LOG_ERROR
(
"request id not found: "
<<
request_id
);
return
;
}
i
->
second
.
deliver
(
T
{
ok_atom
::
value
,
std
::
forward
<
Vs
>
(
v
s
)...}.
value
);
i
->
second
.
deliver
(
T
{
ok_atom
::
value
,
std
::
forward
<
Ts
>
(
x
s
)...}.
value
);
storage
.
erase
(
i
);
}
...
...
unit_testing/test_match.cpp
View file @
bddecb9c
...
...
@@ -45,8 +45,8 @@ void fill_mb(message_builder&) {
}
template
<
class
T
,
class
...
Ts
>
void
fill_mb
(
message_builder
&
mb
,
const
T
&
v
,
const
Ts
&
...
v
s
)
{
fill_mb
(
mb
.
append
(
v
),
v
s
...);
void
fill_mb
(
message_builder
&
mb
,
const
T
&
x
,
const
Ts
&
...
x
s
)
{
fill_mb
(
mb
.
append
(
x
),
x
s
...);
}
template
<
class
...
Ts
>
...
...
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