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
0c4ebcfe
Commit
0c4ebcfe
authored
Feb 17, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on GCC 4.7
parent
edbc7b37
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
51 deletions
+78
-51
libcaf_core/caf/check_typed_input.hpp
libcaf_core/caf/check_typed_input.hpp
+7
-5
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+7
-4
libcaf_core/caf/mixin/sync_sender.hpp
libcaf_core/caf/mixin/sync_sender.hpp
+12
-1
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+52
-41
No files found.
libcaf_core/caf/check_typed_input.hpp
View file @
0c4ebcfe
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef CAF_CHECK_TYPED_INPUT_HPP
#ifndef CAF_CHECK_TYPED_INPUT_HPP
#define CAF_CHECK_TYPED_INPUT_HPP
#define CAF_CHECK_TYPED_INPUT_HPP
#include "caf/typed_actor.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/detail/typed_actor_util.hpp"
...
@@ -29,9 +31,9 @@ namespace caf {
...
@@ -29,9 +31,9 @@ namespace caf {
* Checks whether `R` does support an input of type `{Ls...}` via a
* Checks whether `R` does support an input of type `{Ls...}` via a
* static assertion (always returns 0).
* static assertion (always returns 0).
*/
*/
template
<
template
<
class
...
>
class
R
,
class
...
Rs
,
template
<
class
...
Rs
,
class
...
Ls
>
template
<
class
...
>
class
L
,
class
...
Ls
>
void
check_typed_input
(
const
typed_actor
<
Rs
...
>&
,
constexpr
int
check_typed_input
(
const
R
<
Rs
...
>&
,
const
L
<
Ls
...
>&
)
{
const
detail
::
type_list
<
Ls
...
>&
)
{
static_assert
(
detail
::
tl_find
<
static_assert
(
detail
::
tl_find
<
detail
::
type_list
<
Ls
...
>
,
detail
::
type_list
<
Ls
...
>
,
atom_value
atom_value
...
@@ -41,8 +43,8 @@ constexpr int check_typed_input(const R<Rs...>&, const L<Ls...>&) {
...
@@ -41,8 +43,8 @@ constexpr int check_typed_input(const R<Rs...>&, const L<Ls...>&) {
static_assert
(
detail
::
tl_find_if
<
static_assert
(
detail
::
tl_find_if
<
detail
::
type_list
<
Rs
...
>
,
detail
::
type_list
<
Rs
...
>
,
detail
::
input_is
<
detail
::
type_list
<
Ls
...
>>::
template
eval
detail
::
input_is
<
detail
::
type_list
<
Ls
...
>>::
template
eval
>
::
value
>=
0
,
"typed actor does not support given input"
);
>
::
value
>=
0
,
return
0
;
"typed actor does not support given input"
)
;
}
}
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/caf/local_actor.hpp
View file @
0c4ebcfe
...
@@ -164,10 +164,13 @@ class local_actor : public abstract_actor {
...
@@ -164,10 +164,13 @@ class local_actor : public abstract_actor {
*/
*/
template
<
class
...
Rs
,
class
...
Vs
>
template
<
class
...
Rs
,
class
...
Vs
>
void
send
(
const
typed_actor
<
Rs
...
>&
whom
,
Vs
&&
...
vs
)
{
void
send
(
const
typed_actor
<
Rs
...
>&
whom
,
Vs
&&
...
vs
)
{
check_typed_input
(
whom
,
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
std
::
decay
<
Vs
>::
type
typename
detail
::
implicit_conversions
<
>::
type
...
>
{});
typename
std
::
decay
<
Vs
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
whom
,
tk
);
fast_send
(
message_priority
::
normal
,
whom
,
std
::
forward
<
Vs
>
(
vs
)...);
fast_send
(
message_priority
::
normal
,
whom
,
std
::
forward
<
Vs
>
(
vs
)...);
}
}
...
...
libcaf_core/caf/mixin/sync_sender.hpp
View file @
0c4ebcfe
...
@@ -119,7 +119,18 @@ class sync_sender_impl : public Base {
...
@@ -119,7 +119,18 @@ class sync_sender_impl : public Base {
>::
type
,
>::
type
,
HandleTag
>
HandleTag
>
sync_send
(
const
typed_actor
<
Rs
...
>&
dest
,
Vs
&&
...
vs
)
{
sync_send
(
const
typed_actor
<
Rs
...
>&
dest
,
Vs
&&
...
vs
)
{
return
sync_send
(
message_priority
::
normal
,
dest
,
std
::
forward
<
Vs
>
(
vs
)...);
static_assert
(
sizeof
...(
Vs
)
>
0
,
"no message to send"
);
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Vs
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
dest
,
tk
);
return
{
dptr
()
->
sync_send_impl
(
message_priority
::
normal
,
actor_cast
<
actor
>
(
dest
),
make_message
(
std
::
forward
<
Vs
>
(
vs
)...)),
dptr
()};
}
}
/****************************************************************************
/****************************************************************************
...
...
libcaf_core/caf/send.hpp
View file @
0c4ebcfe
...
@@ -36,92 +36,104 @@ namespace caf {
...
@@ -36,92 +36,104 @@ namespace caf {
/**
/**
* Sends `to` a message under the identity of `from` with priority `prio`.
* Sends `to` a message under the identity of `from` with priority `prio`.
*/
*/
template
<
class
...
T
s
>
template
<
class
...
V
s
>
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
channel
&
to
,
T
s
&&
...
vs
)
{
const
channel
&
to
,
V
s
&&
...
vs
)
{
if
(
!
to
)
{
if
(
!
to
)
{
return
;
return
;
}
}
message_id
mid
;
message_id
mid
;
to
->
enqueue
(
from
.
address
(),
to
->
enqueue
(
from
.
address
(),
prio
==
message_priority
::
high
?
mid
.
with_high_priority
()
:
mid
,
prio
==
message_priority
::
high
?
mid
.
with_high_priority
()
:
mid
,
make_message
(
std
::
forward
<
T
s
>
(
vs
)...),
nullptr
);
make_message
(
std
::
forward
<
V
s
>
(
vs
)...),
nullptr
);
}
}
/**
/**
* Sends `to` a message under the identity of `from`.
* Sends `to` a message under the identity of `from`.
*/
*/
template
<
class
...
T
s
>
template
<
class
...
V
s
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
T
s
&&
...
vs
)
{
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
V
s
&&
...
vs
)
{
send_as
(
from
,
message_priority
::
normal
,
to
,
std
::
forward
<
T
s
>
(
vs
)...);
send_as
(
from
,
message_priority
::
normal
,
to
,
std
::
forward
<
V
s
>
(
vs
)...);
}
}
/**
/**
* Sends `to` a message under the identity of `from` with priority `prio`.
* Sends `to` a message under the identity of `from` with priority `prio`.
*/
*/
template
<
class
...
Rs
,
class
...
T
s
>
template
<
class
...
Rs
,
class
...
V
s
>
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
vs
)
{
check_typed_input
(
to
,
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
std
::
decay
<
Ts
>::
type
typename
detail
::
implicit_conversions
<
>::
type
...
>
{});
typename
std
::
decay
<
Vs
>::
type
send_as
(
from
,
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
vs
)...);
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
send_as
(
from
,
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
vs
)...);
}
}
/**
/**
* Sends `to` a message under the identity of `from`.
* Sends `to` a message under the identity of `from`.
*/
*/
template
<
class
...
Rs
,
class
...
Ts
>
template
<
class
...
Rs
,
class
...
Vs
>
void
send_as
(
const
actor
&
from
,
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
void
send_as
(
const
actor
&
from
,
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
vs
)
{
check_typed_input
(
to
,
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
std
::
decay
<
Ts
>::
type
typename
detail
::
implicit_conversions
<
>::
type
...
>
{});
typename
std
::
decay
<
Vs
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
send_as
(
from
,
message_priority
::
normal
,
send_as
(
from
,
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
T
s
>
(
vs
)...);
actor_cast
<
channel
>
(
to
),
std
::
forward
<
V
s
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `to` a message with priority `prio`.
* Anonymously sends `to` a message with priority `prio`.
*/
*/
template
<
class
...
T
s
>
template
<
class
...
V
s
>
void
anon_send
(
message_priority
prio
,
const
channel
&
to
,
T
s
&&
...
vs
)
{
void
anon_send
(
message_priority
prio
,
const
channel
&
to
,
V
s
&&
...
vs
)
{
send_as
(
invalid_actor
,
prio
,
to
,
std
::
forward
<
T
s
>
(
vs
)...);
send_as
(
invalid_actor
,
prio
,
to
,
std
::
forward
<
V
s
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `to` a message.
* Anonymously sends `to` a message.
*/
*/
template
<
class
...
T
s
>
template
<
class
...
V
s
>
void
anon_send
(
const
channel
&
to
,
T
s
&&
...
vs
)
{
void
anon_send
(
const
channel
&
to
,
V
s
&&
...
vs
)
{
send_as
(
invalid_actor
,
message_priority
::
normal
,
to
,
std
::
forward
<
T
s
>
(
vs
)...);
send_as
(
invalid_actor
,
message_priority
::
normal
,
to
,
std
::
forward
<
V
s
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `to` a message with priority `prio`.
* Anonymously sends `to` a message with priority `prio`.
*/
*/
template
<
class
...
Rs
,
class
...
T
s
>
template
<
class
...
Rs
,
class
...
V
s
>
void
anon_send
(
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
void
anon_send
(
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
Vs
&&
...
vs
)
{
check_typed_input
(
to
,
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
std
::
decay
<
Ts
>::
type
typename
detail
::
implicit_conversions
<
>::
type
...
>
{});
typename
std
::
decay
<
Vs
>::
type
anon_send
(
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
vs
)...);
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
anon_send
(
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Vs
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `to` a message.
* Anonymously sends `to` a message.
*/
*/
template
<
class
...
Rs
,
class
...
Ts
>
template
<
class
...
Rs
,
class
...
Vs
>
void
anon_send
(
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
void
anon_send
(
const
typed_actor
<
Rs
...
>&
to
,
Vs
&&
...
vs
)
{
check_typed_input
(
to
,
using
token
=
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
std
::
decay
<
Ts
>::
type
typename
detail
::
implicit_conversions
<
>::
type
...
>
{});
typename
std
::
decay
<
Vs
>::
type
>::
type
...
>
;
token
tk
;
check_typed_input
(
to
,
tk
);
anon_send
(
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
anon_send
(
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
T
s
>
(
vs
)...);
std
::
forward
<
V
s
>
(
vs
)...);
}
}
/**
/**
...
@@ -173,7 +185,6 @@ inline void anon_send_tuple(const channel& to, message_priority prio,
...
@@ -173,7 +185,6 @@ inline void anon_send_tuple(const channel& to, message_priority prio,
message
msg
)
{
message
msg
)
{
send_as
(
invalid_actor
,
prio
,
to
,
std
::
move
(
msg
));
send_as
(
invalid_actor
,
prio
,
to
,
std
::
move
(
msg
));
}
}
// </backward_compatibility>
// </backward_compatibility>
}
// namespace caf
}
// namespace caf
...
...
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