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
bcacc6d8
Commit
bcacc6d8
authored
Mar 07, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove make_sink_result
parent
1b98e243
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
156 deletions
+56
-156
libcaf_core/caf/detail/invoke_result_visitor.hpp
libcaf_core/caf/detail/invoke_result_visitor.hpp
+4
-10
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+4
-1
libcaf_core/caf/make_sink_result.hpp
libcaf_core/caf/make_sink_result.hpp
+0
-96
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+5
-6
libcaf_core/caf/stream_result.hpp
libcaf_core/caf/stream_result.hpp
+27
-23
libcaf_core/caf/stream_sink.hpp
libcaf_core/caf/stream_sink.hpp
+7
-13
libcaf_core/caf/stream_sink_driver.hpp
libcaf_core/caf/stream_sink_driver.hpp
+2
-4
libcaf_core/caf/stream_sink_trait.hpp
libcaf_core/caf/stream_sink_trait.hpp
+7
-3
No files found.
libcaf_core/caf/detail/invoke_result_visitor.hpp
View file @
bcacc6d8
...
...
@@ -152,13 +152,6 @@ public:
(
*
this
)(
x
.
in
(),
x
.
out
(),
ptr
);
}
/// Calls `(*this)(x.in(), x.out(), x.ptr())`.
template
<
class
In
,
class
Result
>
void
operator
()(
make_sink_result
<
In
,
Result
>&
x
)
{
stream_manager_ptr
ptr
{
std
::
move
(
x
.
ptr
())};
(
*
this
)(
x
.
in
(),
0
,
ptr
);
}
/// Calls `(*this)(x.in(), x.out(), x.ptr())`.
template
<
class
T
,
class
S
,
class
...
Ts
>
void
operator
()(
make_source_result
<
T
,
S
,
Ts
...
>&
x
)
{
...
...
@@ -174,9 +167,10 @@ public:
}
/// Calls `(*this)(x.ptr)`.
template
<
class
T
>
void
operator
()(
stream_result
<
T
>&
x
)
{
(
*
this
)(
x
.
in
(),
0
,
x
.
ptr
());
template
<
class
T
,
class
P
>
void
operator
()(
stream_result
<
T
,
P
>&
x
)
{
stream_manager_ptr
ptr
{
std
::
move
(
x
.
ptr
())};
(
*
this
)(
x
.
in
(),
0
,
ptr
);
}
// -- visit API: return true if T was visited, false if T was skipped --------
...
...
libcaf_core/caf/fwd.hpp
View file @
bcacc6d8
...
...
@@ -33,7 +33,6 @@ template <class> class intrusive_ptr;
template
<
class
>
class
optional
;
template
<
class
>
class
param
;
template
<
class
>
class
stream
;
template
<
class
>
class
stream_result
;
template
<
class
>
class
trivial_match_case
;
template
<
class
>
class
weak_intrusive_ptr
;
...
...
@@ -229,6 +228,10 @@ using stream_manager_ptr = intrusive_ptr<stream_manager>;
using
type_erased_value_ptr
=
std
::
unique_ptr
<
type_erased_value
>
;
using
mailbox_element_ptr
=
std
::
unique_ptr
<
mailbox_element
,
detail
::
disposer
>
;
// -- templates that depend on others ------------------------------------------
template
<
class
,
class
=
stream_manager_ptr
>
class
stream_result
;
}
// namespace caf
#endif // CAF_FWD_HPP
libcaf_core/caf/make_sink_result.hpp
deleted
100644 → 0
View file @
1b98e243
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensink.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_MAKE_SINK_RESULT_HPP
#define CAF_MAKE_SINK_RESULT_HPP
#include "caf/fwd.hpp"
#include "caf/stream_slot.hpp"
#include "caf/stream_sink.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
/// Wraps the result of a `make_sink` or `add_output_path` function call.
template
<
class
In
,
class
Result
>
class
make_sink_result
{
public:
// -- member types -----------------------------------------------------------
/// A single element.
using
value_type
=
In
;
/// Fully typed stream manager as returned by `make_sink`.
using
type
=
stream_sink
<
In
,
Result
>
;
/// Pointer to a fully typed stream manager.
using
ptr_type
=
intrusive_ptr
<
type
>
;
/// Type of the final result message.
using
result_type
=
stream_result
<
Result
>
;
// -- constructors, destructors, and assignment operators --------------------
make_sink_result
(
make_sink_result
&&
)
=
default
;
make_sink_result
(
const
make_sink_result
&
)
=
default
;
make_sink_result
(
stream_slot
in_slot
,
ptr_type
ptr
)
:
in_
(
in_slot
),
ptr_
(
std
::
move
(
ptr
))
{
// nop
}
// -- properties -------------------------------------------------------------
/// Returns the output slot.
inline
stream_slot
in
()
const
{
return
in_
;
}
/// 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_sink_result
&
x
)
{
return
f
(
meta
::
type_name
(
"make_sink_result"
),
x
.
in_
);
}
private:
// -- member variables -------------------------------------------------------
stream_slot
in_
;
ptr_type
ptr_
;
};
}
// namespace caf
#endif // CAF_MAKE_SINK_RESULT_HPP
libcaf_core/caf/scheduled_actor.hpp
View file @
bcacc6d8
...
...
@@ -39,7 +39,6 @@
#include "caf/invoke_message_result.hpp"
#include "caf/local_actor.hpp"
#include "caf/logger.hpp"
#include "caf/make_sink_result.hpp"
#include "caf/make_source_result.hpp"
#include "caf/make_stage_result.hpp"
#include "caf/no_stages.hpp"
...
...
@@ -526,19 +525,19 @@ public:
scatterer_arg
);
}
template
<
class
Driver
,
class
Input
,
class
...
Ts
>
stream_result
<
typename
Driver
::
result_type
>
make_sink
(
const
stream
<
Input
>&
src
,
Ts
&&
...
xs
)
{
template
<
class
Driver
,
class
...
Ts
>
stream_result
<
typename
Driver
::
result_type
,
typename
Driver
::
sink_ptr_type
>
make_sink
(
const
stream
<
typename
Driver
::
input_type
>&
src
,
Ts
&&
...
xs
)
{
auto
mgr
=
detail
::
make_stream_sink
<
Driver
>
(
this
,
std
::
forward
<
Ts
>
(
xs
)...);
return
mgr
->
add_inbound_path
(
src
);
}
template
<
class
Input
,
class
Init
,
class
Fun
,
class
Finalize
,
class
Trait
=
stream_sink_trait_t
<
Fun
,
Finalize
>
>
stream_result
<
typename
Trait
::
output
>
stream_result
<
typename
Trait
::
result
,
typename
Trait
::
pointer
>
make_sink
(
const
stream
<
Input
>&
in
,
Init
init
,
Fun
fun
,
Finalize
fin
)
{
using
driver
=
detail
::
stream_sink_driver_impl
<
typename
Trait
::
input
,
typename
Trait
::
outpu
t
,
typename
Trait
::
resul
t
,
Fun
,
Finalize
>
;
return
make_sink
<
driver
>
(
in
,
std
::
move
(
init
),
std
::
move
(
fun
),
std
::
move
(
fin
));
...
...
libcaf_core/caf/stream_result.hpp
View file @
bcacc6d8
...
...
@@ -20,7 +20,6 @@
#define CAF_STREAM_RESULT_HPP
#include "caf/fwd.hpp"
#include "caf/make_sink_result.hpp"
#include "caf/none.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_slot.hpp"
...
...
@@ -30,9 +29,15 @@
namespace
caf
{
/// Terminates a stream by reducing it to a single value.
template
<
class
T
>
template
<
class
T
,
class
Pointer
/* = stream_manager_ptr */
>
class
stream_result
{
public:
// -- member types -----------------------------------------------------------
using
pointer_type
=
Pointer
;
// -- constructors, destructors, and assignment operators --------------------
stream_result
(
stream_result
&&
)
=
default
;
stream_result
(
const
stream_result
&
)
=
default
;
stream_result
&
operator
=
(
stream_result
&&
)
=
default
;
...
...
@@ -42,32 +47,27 @@ public:
// nop
}
stream_result
(
stream_slot
id
)
:
in_
(
id
)
{
stream_result
(
stream_slot
id
,
Pointer
mgr
=
nullptr
)
:
in_
(
id
),
ptr_
(
std
::
move
(
mgr
))
{
// nop
}
/// Convenience constructor for returning the result of `self->new_stream_result`
/// and similar functions.
stream_result
(
stream_slot
id
,
stream_manager_ptr
sptr
)
:
in_
(
id
),
ptr_
(
std
::
move
(
sptr
))
{
template
<
class
CompatiblePointer
>
stream_result
(
stream_result
<
T
,
CompatiblePointer
>
other
)
:
in_
(
other
.
in
()),
ptr_
(
std
::
move
(
other
.
ptr
()))
{
// nop
}
/// Convenience constructor for returning the result of `self->new_stream_result`
/// and similar functions.
stream_result
(
stream_result
other
,
stream_manager_ptr
sptr
)
:
in_
(
other
.
in_
),
ptr_
(
std
::
move
(
sptr
))
{
// nop
template
<
class
CompatiblePointer
>
stream_result
&
operator
=
(
stream_result
<
T
,
CompatiblePointer
>
other
)
{
in_
=
other
.
in
();
ptr_
=
std
::
move
(
other
.
ptr
());
return
*
this
;
}
template
<
class
In
>
stream_result
(
make_sink_result
<
In
,
T
>
other
)
:
in_
(
other
.
in
()),
ptr_
(
other
.
ptr
())
{
// nop
}
// -- properties -------------------------------------------------------------
/// Returns the unique identifier for this stream_result.
inline
stream_slot
in
()
const
noexcept
{
...
...
@@ -75,15 +75,17 @@ public:
}
/// Returns the handler assigned to this stream on this actor.
inline
stream_manager_ptr
&
ptr
()
noexcept
{
inline
pointer_type
&
ptr
()
noexcept
{
return
ptr_
;
}
/// Returns the handler assigned to this stream on this actor.
inline
const
stream_manager_ptr
&
ptr
()
const
noexcept
{
inline
const
pointer_type
&
ptr
()
const
noexcept
{
return
ptr_
;
}
// -- serialization support --------------------------------------------------
template
<
class
Inspector
>
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
stream_result
&
x
)
{
...
...
@@ -91,8 +93,10 @@ public:
}
private:
// -- member variables -------------------------------------------------------
stream_slot
in_
;
stream_manager_ptr
ptr_
;
pointer_type
ptr_
;
};
}
// namespace caf
...
...
libcaf_core/caf/stream_sink.hpp
View file @
bcacc6d8
...
...
@@ -23,6 +23,7 @@
#include "caf/intrusive_ptr.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_result.hpp"
#include "caf/detail/type_traits.hpp"
...
...
@@ -35,6 +36,8 @@ public:
using
input_type
=
In
;
using
result_type
=
Result
;
// -- constructors, destructors, and assignment operators --------------------
stream_sink
(
scheduled_actor
*
self
)
:
stream_manager
(
self
)
{
...
...
@@ -44,7 +47,10 @@ public:
// -- properties -------------------------------------------------------------
/// Creates a new input path to the current sender.
make_sink_result
<
In
,
Result
>
add_inbound_path
(
const
stream
<
In
>&
in
);
stream_result
<
result_type
,
intrusive_ptr
<
stream_sink
>>
add_inbound_path
(
const
stream
<
input_type
>&
)
{
return
{
this
->
assign_next_slot
(),
this
};
}
};
template
<
class
In
,
class
Result
>
...
...
@@ -52,16 +58,4 @@ using stream_sink_ptr = intrusive_ptr<stream_sink<In, Result>>;
}
// namespace caf
#include "caf/make_sink_result.hpp"
namespace
caf
{
template
<
class
In
,
class
Result
>
make_sink_result
<
In
,
Result
>
stream_sink
<
In
,
Result
>::
add_inbound_path
(
const
stream
<
In
>&
)
{
return
{
this
->
assign_next_slot
(),
this
};
}
}
// namespace caf
#endif // CAF_DETAIL_STREAM_SINK_HPP
libcaf_core/caf/stream_sink_driver.hpp
View file @
bcacc6d8
...
...
@@ -24,8 +24,9 @@
#include <vector>
#include "caf/fwd.hpp"
#include "caf/message.hpp"
#include "caf/make_message.hpp"
#include "caf/message.hpp"
#include "caf/stream_sink.hpp"
namespace
caf
{
...
...
@@ -45,9 +46,6 @@ public:
/// Smart pointer to the interface type.
using
sink_ptr_type
=
intrusive_ptr
<
sink_type
>
;
/// Wrapper type holding a pointer to `sink_type`.
using
make_sink_result_type
=
make_sink_result
<
input_type
,
result_type
>
;
// -- constructors, destructors, and assignment operators --------------------
virtual
~
stream_sink_driver
()
{
...
...
libcaf_core/caf/stream_sink_trait.hpp
View file @
bcacc6d8
...
...
@@ -19,8 +19,9 @@
#ifndef CAF_STREAM_SINK_TRAIT_HPP
#define CAF_STREAM_SINK_TRAIT_HPP
#include "caf/message.hpp"
#include "caf/make_message.hpp"
#include "caf/message.hpp"
#include "caf/stream_sink.hpp"
#include "caf/detail/type_traits.hpp"
...
...
@@ -67,7 +68,7 @@ struct stream_sink_trait_void_finalize {
// -- trait implementation -----------------------------------------------------
/// Base type for all sink traits.
template
<
class
State
,
class
In
,
class
Ou
t
>
template
<
class
State
,
class
In
,
class
Resul
t
>
struct
stream_sink_trait_base
{
/// Defines the state element for the function objects.
using
state
=
State
;
...
...
@@ -76,7 +77,10 @@ struct stream_sink_trait_base {
using
input
=
In
;
/// Defines the result type of the sink.
using
output
=
Out
;
using
result
=
Result
;
/// Defines a pointer to a sink.
using
pointer
=
stream_sink_ptr
<
input
,
result
>
;
};
/// Defines required type aliases for stream sinks.
...
...
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