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
441d6a0f
Commit
441d6a0f
authored
Feb 28, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `emit_batches` function to `outbound_path`
parent
cfb49df3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
libcaf_core/caf/outbound_path.hpp
libcaf_core/caf/outbound_path.hpp
+26
-0
No files found.
libcaf_core/caf/outbound_path.hpp
View file @
441d6a0f
...
@@ -83,6 +83,32 @@ public:
...
@@ -83,6 +83,32 @@ public:
/// `xs_size` and increments `next_batch_id` by 1.
/// `xs_size` and increments `next_batch_id` by 1.
void
emit_batch
(
local_actor
*
self
,
long
xs_size
,
message
xs
);
void
emit_batch
(
local_actor
*
self
,
long
xs_size
,
message
xs
);
/// Calls `emit_batch` for each
template
<
class
T
>
void
emit_batches
(
local_actor
*
self
,
std
::
vector
<
T
>&
cache
,
bool
force_underfull
)
{
CAF_ASSERT
(
desired_batch_size
>
0
);
if
(
cache
.
size
()
==
desired_batch_size
)
{
emit_batch
(
self
,
desired_batch_size
,
make_message
(
std
::
move
(
cache
)));
return
;
}
auto
i
=
cache
.
begin
();
auto
e
=
cache
.
end
();
while
(
std
::
distance
(
i
,
e
)
>=
static_cast
<
ptrdiff_t
>
(
desired_batch_size
))
{
std
::
vector
<
T
>
tmp
{
std
::
make_move_iterator
(
i
),
std
::
make_move_iterator
(
i
+
desired_batch_size
)};
emit_batch
(
self
,
desired_batch_size
,
make_message
(
std
::
move
(
tmp
)));
i
+=
desired_batch_size
;
}
if
(
i
==
e
)
{
cache
.
clear
();
return
;
}
cache
.
erase
(
cache
.
begin
(),
i
);
if
(
force_underfull
)
emit_batch
(
self
,
cache
.
size
(),
make_message
(
std
::
move
(
cache
)));
}
/// Sends a `stream_msg::drop` on this path.
/// Sends a `stream_msg::drop` on this path.
void
emit_regular_shutdown
(
local_actor
*
self
);
void
emit_regular_shutdown
(
local_actor
*
self
);
...
...
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