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
e6484fce
Commit
e6484fce
authored
Jan 20, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `assign` to `behavior` and `message_handler`
parent
6e4e80ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
libcaf_core/caf/behavior.hpp
libcaf_core/caf/behavior.hpp
+12
-5
libcaf_core/caf/message_handler.hpp
libcaf_core/caf/message_handler.hpp
+12
-5
No files found.
libcaf_core/caf/behavior.hpp
View file @
e6484fce
...
...
@@ -60,11 +60,8 @@ class behavior {
* and up to one timeout (if set, the timeout has to be the last argument).
*/
template
<
class
T
,
class
...
Ts
>
behavior
(
const
T
&
arg
,
Ts
&&
...
args
)
:
m_impl
(
detail
::
match_expr_concat
(
detail
::
lift_to_match_expr
(
arg
),
detail
::
lift_to_match_expr
(
std
::
forward
<
Ts
>
(
args
))...))
{
// nop
behavior
(
const
T
&
arg
,
Ts
&&
...
args
)
{
assign
(
arg
,
std
::
forward
<
Ts
>
(
args
)...);
}
/**
...
...
@@ -86,6 +83,16 @@ class behavior {
// nop
}
/**
* Assigns new handlers.
*/
template
<
class
T
,
class
...
Ts
>
void
assign
(
T
&&
v
,
Ts
&&
...
vs
)
{
m_impl
=
detail
::
match_expr_concat
(
detail
::
lift_to_match_expr
(
std
::
forward
<
T
>
(
v
)),
detail
::
lift_to_match_expr
(
std
::
forward
<
Ts
>
(
vs
))...);
}
/**
* Invokes the timeout callback if set.
*/
...
...
libcaf_core/caf/message_handler.hpp
View file @
e6484fce
...
...
@@ -81,11 +81,18 @@ class message_handler {
* functors, or other message handlers.
*/
template
<
class
T
,
class
...
Ts
>
message_handler
(
const
T
&
arg
,
Ts
&&
...
args
)
:
m_impl
(
detail
::
match_expr_concat
(
detail
::
lift_to_match_expr
(
arg
),
detail
::
lift_to_match_expr
(
std
::
forward
<
Ts
>
(
args
))...))
{
// nop
message_handler
(
const
T
&
v
,
Ts
&&
...
vs
)
{
assign
(
v
,
std
::
forward
<
Ts
>
(
vs
)...);
}
/**
* Assigns new message handlers.
*/
template
<
class
T
,
class
...
Ts
>
void
assign
(
T
&&
v
,
Ts
&&
...
vs
)
{
m_impl
=
detail
::
match_expr_concat
(
detail
::
lift_to_match_expr
(
std
::
forward
<
T
>
(
v
)),
detail
::
lift_to_match_expr
(
std
::
forward
<
Ts
>
(
vs
))...);
}
/**
...
...
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