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
ca6df069
Commit
ca6df069
authored
Sep 25, 2014
by
neverlord
Committed by
Dominik Charousset
Sep 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `discard_behavior`
parent
0f088db7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
27 deletions
+10
-27
libcaf_core/caf/behavior_policy.hpp
libcaf_core/caf/behavior_policy.hpp
+4
-20
libcaf_core/caf/mixin/behavior_stack_based.hpp
libcaf_core/caf/mixin/behavior_stack_based.hpp
+6
-7
No files found.
libcaf_core/caf/behavior_policy.hpp
View file @
ca6df069
...
...
@@ -22,28 +22,12 @@
namespace
caf
{
template
<
bool
DiscardBehavior
>
struct
behavior_policy
{
static
constexpr
bool
discard_old
=
DiscardBehavior
;
struct
keep_behavior_t
{
constexpr
keep_behavior_t
()
{
// nop
}
};
template
<
class
T
>
struct
is_behavior_policy
:
std
::
false_type
{};
template
<
bool
DiscardBehavior
>
struct
is_behavior_policy
<
behavior_policy
<
DiscardBehavior
>>
:
std
::
true_type
{};
using
keep_behavior_t
=
behavior_policy
<
false
>
;
using
discard_behavior_t
=
behavior_policy
<
true
>
;
/**
* Policy tag that causes {@link event_based_actor::become} to
* discard the current behavior.
* @relates local_actor
*/
constexpr
discard_behavior_t
discard_behavior
=
discard_behavior_t
{};
/**
* Policy tag that causes {@link event_based_actor::become} to
* keep the current behavior available.
...
...
libcaf_core/caf/mixin/behavior_stack_based.hpp
View file @
ca6df069
...
...
@@ -59,14 +59,13 @@ class behavior_stack_based_impl : public single_timeout<Base, Subtype> {
void
become
(
behavior_type
bhvr
)
{
do_become
(
std
::
move
(
bhvr
),
true
);
}
template
<
bool
Discard
>
void
become
(
behavior_policy
<
Discard
>
,
behavior_type
bhvr
)
{
do_become
(
std
::
move
(
bhvr
),
Discard
);
inline
void
become
(
const
keep_behavior_t
&
,
behavior_type
bhvr
)
{
do_become
(
std
::
move
(
bhvr
),
false
);
}
template
<
class
T
,
class
...
Ts
>
inline
typename
std
::
enable_if
<
!
is_behavior_policy
<
typename
std
::
decay
<
T
>::
type
>::
value
,
!
std
::
is_same
<
keep_behavior_t
,
typename
std
::
decay
<
T
>::
type
>::
value
,
void
>::
type
become
(
T
&&
arg
,
Ts
&&
...
args
)
{
do_become
(
...
...
@@ -74,9 +73,9 @@ class behavior_stack_based_impl : public single_timeout<Base, Subtype> {
true
);
}
template
<
bool
Discard
,
class
...
Ts
>
void
become
(
behavior_policy
<
Discard
>
,
Ts
&&
...
args
)
{
do_become
(
behavior_type
{
std
::
forward
<
Ts
>
(
args
)...},
Discard
);
template
<
class
...
Ts
>
void
become
(
const
keep_behavior_t
&
,
Ts
&&
...
args
)
{
do_become
(
behavior_type
{
std
::
forward
<
Ts
>
(
args
)...},
false
);
}
inline
void
unbecome
()
{
m_bhvr_stack
.
pop_async_back
();
}
...
...
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