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
1607fc4a
Commit
1607fc4a
authored
May 21, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
T const& => const T&
parent
ac81fea9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
benchmarks/distributed.cpp
benchmarks/distributed.cpp
+8
-8
No files found.
benchmarks/distributed.cpp
View file @
1607fc4a
...
...
@@ -66,7 +66,7 @@ option<int> c_2i(char const* cstr) {
return
result
;
}
inline
option
<
int
>
_2i
(
std
::
string
const
&
str
)
{
inline
option
<
int
>
_2i
(
const
std
::
string
&
str
)
{
return
c_2i
(
str
.
c_str
());
}
...
...
@@ -109,7 +109,7 @@ class actor_template {
actor_ptr
spawn
()
const
{
struct
impl
:
fsm_actor
<
impl
>
{
behavior
init_state
;
impl
(
MatchExpr
const
&
mx
)
:
init_state
(
mx
.
as_partial_function
())
{
impl
(
const
MatchExpr
&
mx
)
:
init_state
(
mx
.
as_partial_function
())
{
}
};
return
cppa
::
spawn
(
new
impl
{
m_expr
});
...
...
@@ -118,7 +118,7 @@ class actor_template {
};
template
<
typename
...
Args
>
auto
actor_prototype
(
Args
const
&
...
args
)
->
actor_template
<
decltype
(
mexpr_concat
(
args
...))
>
{
auto
actor_prototype
(
const
Args
&
...
args
)
->
actor_template
<
decltype
(
mexpr_concat
(
args
...))
>
{
return
{
mexpr_concat
(
args
...)};
}
...
...
@@ -169,7 +169,7 @@ struct server_actor : fsm_actor<server_actor> {
on
(
atom
(
"ping"
),
arg_match
)
>>
[
=
](
uint32_t
value
)
{
reply
(
atom
(
"pong"
),
value
);
},
on
(
atom
(
"add_pong"
),
arg_match
)
>>
[
=
](
string
const
&
host
,
uint16_t
port
)
{
on
(
atom
(
"add_pong"
),
arg_match
)
>>
[
=
](
const
string
&
host
,
uint16_t
port
)
{
auto
key
=
std
::
make_pair
(
host
,
port
);
auto
i
=
m_pongs
.
find
(
key
);
if
(
i
==
m_pongs
.
end
())
{
...
...
@@ -199,7 +199,7 @@ struct server_actor : fsm_actor<server_actor> {
on
<
atom
(
"EXIT"
),
uint32_t
>
()
>>
[
=
]()
{
actor_ptr
who
=
last_sender
();
auto
i
=
std
::
find_if
(
m_pongs
.
begin
(),
m_pongs
.
end
(),
[
&
](
pong_map
::
value_type
const
&
kvp
)
{
[
&
](
const
pong_map
::
value_type
&
kvp
)
{
return
kvp
.
second
==
who
;
});
if
(
i
!=
m_pongs
.
end
())
m_pongs
.
erase
(
i
);
...
...
@@ -233,7 +233,7 @@ template<typename Iterator>
void
server_mode
(
Iterator
first
,
Iterator
last
)
{
string
port_prefix
=
"--port="
;
// extracts port from a key-value pair
auto
kvp_port
=
[
&
](
string
const
&
str
)
->
option
<
int
>
{
auto
kvp_port
=
[
&
](
const
string
&
str
)
->
option
<
int
>
{
if
(
std
::
equal
(
port_prefix
.
begin
(),
port_prefix
.
end
(),
str
.
begin
()))
{
return
c_2i
(
str
.
c_str
()
+
port_prefix
.
size
());
}
...
...
@@ -261,7 +261,7 @@ void client_mode(Iterator first, Iterator last) {
std
::
uint32_t
init_value
=
0
;
std
::
vector
<
std
::
pair
<
string
,
uint16_t
>
>
remotes
;
string
pings_prefix
=
"--num_pings="
;
auto
num_msgs
=
[
&
](
string
const
&
str
)
->
option
<
int
>
{
auto
num_msgs
=
[
&
](
const
string
&
str
)
->
option
<
int
>
{
if
(
std
::
equal
(
pings_prefix
.
begin
(),
pings_prefix
.
end
(),
str
.
begin
()))
{
return
c_2i
(
str
.
c_str
()
+
pings_prefix
.
size
());
}
...
...
@@ -301,7 +301,7 @@ void client_mode(Iterator first, Iterator last) {
receive
(
on
(
atom
(
"ok"
))
>>
[]()
{
},
on
(
atom
(
"error"
),
arg_match
)
>>
[
&
](
string
const
&
str
)
{
on
(
atom
(
"error"
),
arg_match
)
>>
[
&
](
const
string
&
str
)
{
cout
<<
"error on node "
<<
i
<<
": "
<<
str
<<
endl
;
for
(
auto
&
x
:
remote_actors
)
{
send
(
x
,
atom
(
"purge"
));
...
...
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