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
09da4942
Commit
09da4942
authored
Nov 14, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate review feedback
parent
50bedc96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
30 deletions
+15
-30
libcaf_core/caf/mixin/requester.hpp
libcaf_core/caf/mixin/requester.hpp
+4
-14
libcaf_core/caf/policy/fan_in_responses.hpp
libcaf_core/caf/policy/fan_in_responses.hpp
+2
-4
libcaf_core/caf/response_handle.hpp
libcaf_core/caf/response_handle.hpp
+6
-9
libcaf_core/test/mixin/requester.cpp
libcaf_core/test/mixin/requester.cpp
+3
-3
No files found.
libcaf_core/caf/mixin/requester.hpp
View file @
09da4942
...
@@ -116,13 +116,8 @@ public:
...
@@ -116,13 +116,8 @@ public:
template
<
template
<
class
>
class
MergePolicy
,
template
<
template
<
class
>
class
MergePolicy
,
message_priority
Prio
=
message_priority
::
normal
,
class
Container
,
message_priority
Prio
=
message_priority
::
normal
,
class
Container
,
class
...
Ts
>
class
...
Ts
>
// TODO: replace this monstrosity with 'auto' when switching to C++17
auto
fan_out_request
(
const
Container
&
destinations
,
const
duration
&
timeout
,
response_handle
<
Subtype
,
Ts
&&
...
xs
)
{
MergePolicy
<
response_type_t
<
typename
Container
::
value_type
::
signatures
,
detail
::
implicit_conversions_t
<
detail
::
decay_t
<
Ts
>>
...
>>>
fan_out_request
(
const
Container
&
destinations
,
const
duration
&
timeout
,
Ts
&&
...
xs
)
{
using
handle_type
=
typename
Container
::
value_type
;
using
handle_type
=
typename
Container
::
value_type
;
using
namespace
detail
;
using
namespace
detail
;
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
...
@@ -159,13 +154,8 @@ public:
...
@@ -159,13 +154,8 @@ public:
template
<
template
<
class
>
class
MergePolicy
,
template
<
template
<
class
>
class
MergePolicy
,
message_priority
Prio
=
message_priority
::
normal
,
class
Rep
,
message_priority
Prio
=
message_priority
::
normal
,
class
Rep
,
class
Period
,
class
Container
,
class
...
Ts
>
class
Period
,
class
Container
,
class
...
Ts
>
// TODO: replace this monstrosity with 'auto' when switching to C++17
auto
fan_out_request
(
const
Container
&
destinations
,
response_handle
<
Subtype
,
std
::
chrono
::
duration
<
Rep
,
Period
>
timeout
,
Ts
&&
...
xs
)
{
MergePolicy
<
response_type_t
<
typename
Container
::
value_type
::
signatures
,
detail
::
implicit_conversions_t
<
detail
::
decay_t
<
Ts
>>
...
>>>
fan_out_request
(
const
Container
&
destinations
,
std
::
chrono
::
duration
<
Rep
,
Period
>
timeout
,
Ts
&&
...
xs
)
{
return
request
<
MergePolicy
,
Prio
>
(
destinations
,
duration
{
timeout
},
return
request
<
MergePolicy
,
Prio
>
(
destinations
,
duration
{
timeout
},
std
::
forward
<
Ts
>
(
xs
)...);
std
::
forward
<
Ts
>
(
xs
)...);
}
}
...
...
libcaf_core/caf/policy/fan_in_responses.hpp
View file @
09da4942
...
@@ -57,8 +57,7 @@ struct fan_in_responses_helper {
...
@@ -57,8 +57,7 @@ struct fan_in_responses_helper {
results
.
reserve
(
pending
);
results
.
reserve
(
pending
);
}
}
// TODO: return 'auto' from this function when switching to C++17
auto
wrap
()
{
std
::
function
<
void
(
T
&
)
>
wrap
()
{
return
[
this
](
T
&
x
)
{
(
*
this
)(
x
);
};
return
[
this
](
T
&
x
)
{
(
*
this
)(
x
);
};
}
}
};
};
...
@@ -85,8 +84,7 @@ struct fan_in_responses_tuple_helper {
...
@@ -85,8 +84,7 @@ struct fan_in_responses_tuple_helper {
results
.
reserve
(
pending
);
results
.
reserve
(
pending
);
}
}
// TODO: return 'auto' from this function when switching to C++17
auto
wrap
()
{
std
::
function
<
void
(
Ts
&
...)
>
wrap
()
{
return
[
this
](
Ts
&
...
xs
)
{
(
*
this
)(
xs
...);
};
return
[
this
](
Ts
&
...
xs
)
{
(
*
this
)(
xs
...);
};
}
}
};
};
...
...
libcaf_core/caf/response_handle.hpp
View file @
09da4942
...
@@ -73,9 +73,8 @@ public:
...
@@ -73,9 +73,8 @@ public:
void
await
(
F
f
,
OnError
g
)
const
{
void
await
(
F
f
,
OnError
g
)
const
{
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
"non-template operator()"
);
"non-template operator()"
);
static_assert
(
detail
::
is_callable
<
F
>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide a single, non-template operator() "
"OnError must provide an operator() that takes a caf::error"
);
"that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
...
@@ -96,9 +95,8 @@ public:
...
@@ -96,9 +95,8 @@ public:
void
then
(
F
f
,
OnError
g
)
const
{
void
then
(
F
f
,
OnError
g
)
const
{
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
"non-template operator()"
);
"non-template operator()"
);
static_assert
(
detail
::
is_callable
<
F
>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide a single, non-template operator() "
"OnError must provide an operator() that takes a caf::error"
);
"that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
...
@@ -121,9 +119,8 @@ public:
...
@@ -121,9 +119,8 @@ public:
detail
::
is_handler_for_ef
<
OnError
,
error
>
receive
(
F
f
,
OnError
g
)
{
detail
::
is_handler_for_ef
<
OnError
,
error
>
receive
(
F
f
,
OnError
g
)
{
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
static_assert
(
detail
::
is_callable
<
F
>::
value
,
"F must provide a single, "
"non-template operator()"
);
"non-template operator()"
);
static_assert
(
detail
::
is_callable
<
F
>::
value
,
static_assert
(
detail
::
is_callable_with
<
OnError
,
error
&>::
value
,
"OnError must provide a single, non-template operator() "
"OnError must provide an operator() that takes a caf::error"
);
"that takes a caf::error"
);
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
using
result_type
=
typename
detail
::
get_callable_trait
<
F
>::
result_type
;
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
static_assert
(
std
::
is_same
<
void
,
result_type
>::
value
,
"response handlers are not allowed to have a return "
"response handlers are not allowed to have a return "
...
...
libcaf_core/test/mixin/requester.cpp
View file @
09da4942
...
@@ -154,9 +154,9 @@ CAF_TEST(delegated request with integer result) {
...
@@ -154,9 +154,9 @@ CAF_TEST(delegated request with integer result) {
CAF_TEST
(
requesters
support
fan_out_request
)
{
CAF_TEST
(
requesters
support
fan_out_request
)
{
using
policy
::
fan_in_responses
;
using
policy
::
fan_in_responses
;
std
::
vector
<
adding_server_type
>
workers
{
std
::
vector
<
adding_server_type
>
workers
{
adding_server
=
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
adding_server
=
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
adding_server
=
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
make_server
([](
int
x
,
int
y
)
{
return
x
+
y
;
}),
};
};
run
();
run
();
auto
sum
=
std
::
make_shared
<
int
>
(
0
);
auto
sum
=
std
::
make_shared
<
int
>
(
0
);
...
...
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