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
7d70f1db
Commit
7d70f1db
authored
Jul 03, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored behavior policy types
parent
2ab19718
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
39 deletions
+28
-39
cppa/local_actor.hpp
cppa/local_actor.hpp
+28
-39
No files found.
cppa/local_actor.hpp
View file @
7d70f1db
...
...
@@ -49,7 +49,7 @@ class local_scheduler;
template
<
bool
DiscardOld
>
struct
behavior_policy
{
static
const
bool
discard_old
=
DiscardOld
;
};
typedef
behavior_policy
<
false
>
keep_behavior
;
typedef
behavior_policy
<
false
>
keep_behavior
_t
;
typedef
behavior_policy
<
true
>
discard_behavior_t
;
// doxygen doesn't parse anonymous namespaces correctly
...
...
@@ -203,75 +203,64 @@ class local_actor : public actor {
/**
* @brief Sets the actor's behavior to @p bhvr and discards the
* previous behavior.
* previous behavior
if the policy is {@link discard_behavior}
.
* @note The recommended way of using this member function is to pass
* a pointer to a member variable.
* @warning @p bhvr is owned by the caller and must remain valid until
* the actor terminates.
*/
inline
void
become
(
discard_behavior_t
,
behavior
*
bhvr
)
{
do_become
(
*
bhvr
,
true
);
template
<
bool
DiscardOld
>
inline
void
become
(
behavior_policy
<
DiscardOld
>
,
behavior
*
bhvr
)
{
do_become
(
*
bhvr
,
DiscardOld
);
}
/**
* @brief Sets the actor's behavior.
* @brief Sets the actor's behavior to @p bhvr and discards the
* previous behavior if the policy is {@link discard_behavior}.
*/
inline
void
become
(
discard_behavior_t
,
behavior
bhvr
)
{
template
<
bool
DiscardOld
>
inline
void
become
(
behavior_policy
<
DiscardOld
>
,
behavior
bhvr
)
{
do_become
(
std
::
move
(
bhvr
),
true
);
}
/**
* @brief Sets the actor's behavior to @p bhvr and keeps the
* previous behavior, so that it can be restored by calling
* {@link unbecome()}.
* @note The recommended way of using this member function is to pass
* a pointer to a member variable.
* @warning @p bhvr is owned by the caller and must remain valid until
* the actor terminates.
*/
inline
void
become
(
keep_behavior_t
,
behavior
*
bhvr
)
{
do_become
(
*
bhvr
,
false
);
}
/**
* @brief Sets the actor's behavior.
* @brief Sets the actor's behavior and discards the
* previous behavior if the policy is {@link discard_behavior}.
*/
inline
void
become
(
keep_behavior_t
,
behavior
bhvr
)
{
do_become
(
std
::
move
(
bhvr
),
false
);
template
<
bool
DiscardOld
,
typename
Arg0
,
typename
Arg1
,
typename
...
Args
>
inline
void
become
(
behavior_policy
<
DiscardOld
>
,
Arg0
&&
arg0
,
Arg1
&&
arg1
,
Args
&&
...
args
)
{
do_become
(
match_expr_convert
(
std
::
forward
<
Arg0
>
(
arg0
),
std
::
forward
<
Arg1
>
(
arg1
),
std
::
forward
<
Args
>
(
args
)...),
DiscardOld
);
}
/**
* @brief Sets the actor's behavior.
* @brief Sets the actor's behavior;
* equal to <tt>become(discard_old, bhvr</tt>.
*/
inline
void
become
(
behavior
bhvr
)
{
become
(
discard_behavior
,
std
::
move
(
bhvr
));
}
/**
* @brief Equal to <tt>become(discard_old, bhvr)</tt>.
* @brief Sets the actor's behavior;
* equal to <tt>become(discard_old, bhvr</tt>.
*/
inline
void
become
(
behavior
*
bhvr
)
{
become
(
discard_behavior
,
*
bhvr
);
}
/**
* @brief Sets the actor's behavior.
*/
template
<
bool
DiscardOld
,
typename
Arg0
,
typename
Arg1
,
typename
...
Args
>
void
become
(
behavior_policy
<
DiscardOld
>
,
Arg0
&&
arg0
,
Arg1
&&
arg1
,
Args
&&
...
args
)
{
do_become
(
match_expr_convert
(
std
::
forward
<
Arg0
>
(
arg0
),
std
::
forward
<
Arg1
>
(
arg1
),
std
::
forward
<
Args
>
(
args
)...),
DiscardOld
);
become
(
discard_behavior
,
bhvr
);
}
/**
* @brief Sets the actor's behavior.
* @brief Sets the actor's behavior;
* equal to <tt>become(discard_old, bhvr</tt>.
*/
template
<
typename
...
Cases
,
typename
...
Args
>
inline
void
become
(
match_expr
<
Cases
...
>
arg0
,
Args
&&
...
args
)
{
become
(
discard_behavior
,
match_expr_convert
(
std
::
move
(
arg0
),
std
::
forward
<
Args
>
(
args
)...));
do_become
(
match_expr_convert
(
std
::
move
(
arg0
),
std
::
forward
<
Args
>
(
args
)...),
true
);
}
/**
...
...
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