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
858cd36d
Commit
858cd36d
authored
Mar 07, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make make_stage_result a utility trait
parent
c693c48d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
80 deletions
+19
-80
libcaf_core/caf/detail/invoke_result_visitor.hpp
libcaf_core/caf/detail/invoke_result_visitor.hpp
+0
-7
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+0
-1
libcaf_core/caf/make_source_result.hpp
libcaf_core/caf/make_source_result.hpp
+1
-1
libcaf_core/caf/make_stage_result.hpp
libcaf_core/caf/make_stage_result.hpp
+12
-60
libcaf_core/caf/output_stream.hpp
libcaf_core/caf/output_stream.hpp
+0
-2
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+2
-2
libcaf_core/caf/stream_stage_driver.hpp
libcaf_core/caf/stream_stage_driver.hpp
+4
-7
No files found.
libcaf_core/caf/detail/invoke_result_visitor.hpp
View file @
858cd36d
...
...
@@ -151,13 +151,6 @@ public:
(
*
this
)(
x
.
in
(),
x
.
out
(),
ptr
);
}
/// Calls `(*this)(x.in(), x.out(), x.ptr())`.
template
<
class
In
,
class
Result
,
class
Out
,
class
S
,
class
...
Ts
>
void
operator
()(
make_stage_result
<
In
,
Result
,
Out
,
S
,
Ts
...
>&
x
)
{
stream_manager_ptr
ptr
{
std
::
move
(
x
.
ptr
())};
(
*
this
)(
x
.
in
(),
x
.
out
(),
ptr
);
}
/// Calls `(*this)(x.in(), 0, x.ptr())`.
template
<
class
T
,
class
P
>
void
operator
()(
stream_result
<
T
,
P
>&
x
)
{
...
...
libcaf_core/caf/fwd.hpp
View file @
858cd36d
...
...
@@ -62,7 +62,6 @@ template <class...> class typed_event_based_actor;
// -- variadic templates with fixed arguments ----------------------------------
template
<
class
,
class
,
class
,
class
,
class
...
>
class
make_stage_result
;
template
<
class
,
class
,
class
,
class
,
class
...
>
class
stream_stage
;
template
<
class
,
class
,
class
...
>
class
stream_source
;
...
...
libcaf_core/caf/make_source_result.hpp
View file @
858cd36d
...
...
@@ -33,7 +33,7 @@ namespace caf {
/// `scheduled_actor::make_source`.
template
<
class
Scatterer
,
class
...
Ts
>
struct
make_source_result
{
///
Element type
.
///
Type of a single element
.
using
value_type
=
typename
Scatterer
::
value_type
;
/// Fully typed stream manager as returned by `make_source`.
...
...
libcaf_core/caf/make_stage_result.hpp
View file @
858cd36d
...
...
@@ -20,86 +20,38 @@
#define CAF_MAKE_STAGE_RESULT_HPP
#include "caf/fwd.hpp"
#include "caf/output_stream.hpp"
#include "caf/stream_slot.hpp"
#include "caf/stream_stage.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
///
Identifies an unbound sequence of elements annotated with the additional
///
handshake arguments emitted to the next stage
.
template
<
class
In
,
class
Result
,
class
Out
,
class
Scatterer
,
class
...
Ts
>
///
Helper trait for deducing an `output_stream` from the arguments to
///
`scheduled_actor::make_stage`
.
template
<
class
In
,
class
Result
,
class
Scatterer
,
class
...
Ts
>
class
make_stage_result
{
public:
// -- member types -----------------------------------------------------------
/// Type of a single element.
using
value_type
=
Out
;
using
value_type
=
typename
Scatterer
::
value_type
;
/// Fully typed stream manager as returned by `make_stage`.
using
ptr_type
=
stream_stage_ptr
<
In
,
Result
,
Out
,
Scatterer
,
Ts
...
>
;
// -- constructors, destructors, and assignment operators --------------------
make_stage_result
(
make_stage_result
&&
)
=
default
;
make_stage_result
(
const
make_stage_result
&
)
=
default
;
make_stage_result
(
stream_slot
in_slot
,
stream_slot
out_slot
,
ptr_type
ptr
)
:
in_
(
in_slot
),
out_
(
out_slot
),
ptr_
(
std
::
move
(
ptr
))
{
// nop
}
// -- properties -------------------------------------------------------------
/// Returns the slot of the origin stream if `ptr()` is a stage or 0 if
/// `ptr()` is a source.
inline
stream_slot
in
()
const
{
return
in_
;
}
/// Returns the output slot.
inline
stream_slot
out
()
const
{
return
out_
;
}
/// Returns the handler assigned to this stream on this actor.
inline
ptr_type
&
ptr
()
noexcept
{
return
ptr_
;
}
/// Returns the handler assigned to this stream on this actor.
inline
const
ptr_type
&
ptr
()
const
noexcept
{
return
ptr_
;
}
// -- serialization support --------------------------------------------------
template
<
class
Inspector
>
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
make_stage_result
&
x
)
{
return
f
(
meta
::
type_name
(
"make_stage_result"
),
x
.
in_
,
x
.
out_
);
}
using
stage_type
=
stream_stage
<
In
,
Result
,
value_type
,
Scatterer
,
Ts
...
>
;
private:
// -- member variables -------------------------------------------------------
/// Pointer to a fully typed stream manager.
using
stage_ptr_type
=
intrusive_ptr
<
stage_type
>
;
stream_slot
in_
;
stream_slot
out_
;
ptr_type
ptr_
;
/// The return type for `scheduled_actor::make_sink`.
using
type
=
output_stream
<
value_type
,
std
::
tuple
<
Ts
...
>
,
stage_ptr_type
>
;
};
/// Helper type for defining a `make_stage_result` from a `Scatterer` plus
/// additional handshake types. Hardwires `message` as result type.
template
<
class
In
,
class
Scatterer
,
class
...
Ts
>
using
make_stage_result_t
=
make_stage_result
<
In
,
message
,
typename
Scatterer
::
value_typ
e
,
Scatterer
,
detail
::
decay_t
<
Ts
>
...
>
;
typename
make_stage_result
<
In
,
messag
e
,
Scatterer
,
detail
::
decay_t
<
Ts
>
...
>::
type
;
}
// namespace caf
...
...
libcaf_core/caf/output_stream.hpp
View file @
858cd36d
...
...
@@ -23,8 +23,6 @@
#include "caf/invalid_stream.hpp"
#include "caf/stream_slot.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
/// Identifies an unbound sequence of elements annotated with the additional
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
858cd36d
...
...
@@ -544,7 +544,7 @@ public:
}
template
<
class
Driver
,
class
In
,
class
...
Ts
>
typename
Driver
::
make_stage_result
_type
make_stage
(
const
stream
<
In
>&
src
,
typename
Driver
::
output_stream
_type
make_stage
(
const
stream
<
In
>&
src
,
Ts
&&
...
xs
)
{
using
detail
::
make_stream_stage
;
auto
mgr
=
make_stream_stage
<
Driver
>
(
this
,
std
::
forward
<
Ts
>
(
xs
)...);
...
...
libcaf_core/caf/stream_stage_driver.hpp
View file @
858cd36d
...
...
@@ -50,9 +50,6 @@ public:
/// Type of the output stream.
using
stream_type
=
stream
<
output_type
>
;
/// Type of the output stream including handshake argument types.
using
output_stream_type
=
output_stream
<
output_type
,
Ts
...
>
;
/// Tuple for creating the `open_stream_msg` handshake.
using
handshake_tuple_type
=
std
::
tuple
<
stream_type
,
Ts
...
>
;
...
...
@@ -63,10 +60,10 @@ public:
/// Smart pointer to the interface type.
using
stage_ptr_type
=
intrusive_ptr
<
stage_type
>
;
///
Wrapper type holding a pointer to `stage_type`
.
using
make_stage_result_type
=
make_stage_result
<
input_type
,
result_type
,
output_type
,
scatterer_type
,
Ts
...
>
;
///
Type of the output stream including handshake argument types
.
using
output_stream_type
=
output_stream
<
output_type
,
std
::
tuple
<
Ts
...
>
,
stage_ptr_type
>
;
// -- constructors, destructors, and assignment operators --------------------
...
...
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