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
3abbb933
Commit
3abbb933
authored
Jan 27, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix send_as, annotate deprecated versions
parent
98c77c17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
63 deletions
+84
-63
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+84
-63
No files found.
libcaf_core/caf/send.hpp
View file @
3abbb933
...
@@ -33,128 +33,149 @@
...
@@ -33,128 +33,149 @@
namespace
caf
{
namespace
caf
{
// mark outdated functions as deprecated
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
/**
* Sends `to` a message under the identity of `from`.
*/
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message
msg
)
{
if
(
to
)
{
to
->
enqueue
(
from
.
address
(),
invalid_message_id
,
std
::
move
(
msg
),
nullptr
);
}
}
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
message
msg
)
{
if
(
to
)
{
message_id
id
;
if
(
prio
==
message_priority
::
high
)
{
id
=
id
.
with_high_priority
();
}
to
->
enqueue
(
from
.
address
(),
id
,
std
::
move
(
msg
),
nullptr
);
}
}
/**
/**
* 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
...
Ts
>
template
<
class
...
Ts
>
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
channel
&
to
,
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
Ts
&&
...
arg
s
)
{
const
channel
&
to
,
Ts
&&
...
v
s
)
{
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
<
Ts
>
(
arg
s
)...),
nullptr
);
make_message
(
std
::
forward
<
Ts
>
(
v
s
)...),
nullptr
);
}
}
/**
/**
* Sends `to` a message under the identity of `from`.
* Sends `to` a message under the identity of `from`.
*/
*/
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Ts
&&
...
arg
s
)
{
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Ts
&&
...
v
s
)
{
send_as
(
from
,
to
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...)
);
send_as
(
from
,
message_priority
::
normal
,
to
,
std
::
forward
<
Ts
>
(
vs
)...
);
}
}
/**
/**
*
Anonymously sends `to` a message
.
*
Sends `to` a message under the identity of `from` with priority `prio`
.
*/
*/
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
{
template
<
class
...
Rs
,
class
...
Ts
>
send_as
(
invalid_actor
,
to
,
std
::
move
(
msg
));
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
check_typed_input
(
to
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
{});
send_as
(
from
,
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
vs
)...);
}
}
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
/**
message
msg
)
{
* Sends `to` a message under the identity of `from`.
send_as
(
invalid_actor
,
to
,
prio
,
std
::
move
(
msg
));
*/
template
<
class
...
Rs
,
class
...
Ts
>
void
send_as
(
const
actor
&
from
,
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
check_typed_input
(
to
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
{});
send_as
(
from
,
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `
whom` a message
.
* Anonymously sends `
to` a message with priority `prio`
.
*/
*/
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
anon_send
(
const
channel
&
to
,
Ts
&&
...
arg
s
)
{
void
anon_send
(
message_priority
prio
,
const
channel
&
to
,
Ts
&&
...
v
s
)
{
send_as
(
invalid_actor
,
to
,
std
::
forward
<
Ts
>
(
arg
s
)...);
send_as
(
invalid_actor
,
prio
,
to
,
std
::
forward
<
Ts
>
(
v
s
)...);
}
}
/**
* Anonymously sends `to` a message.
*/
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
anon_send
(
const
channel
&
to
,
message_priority
prio
,
Ts
&&
...
arg
s
)
{
void
anon_send
(
const
channel
&
to
,
Ts
&&
...
v
s
)
{
send_as
(
invalid_actor
,
to
,
prio
,
std
::
forward
<
Ts
>
(
arg
s
)...);
send_as
(
invalid_actor
,
message_priority
::
normal
,
to
,
std
::
forward
<
Ts
>
(
v
s
)...);
}
}
/**
/**
* Anonymously sends `
whom` a message
.
* Anonymously sends `
to` a message with priority `prio`
.
*/
*/
template
<
class
...
Rs
,
class
...
Ts
>
template
<
class
...
Rs
,
class
...
Ts
>
void
anon_send
(
const
typed_actor
<
Rs
...
>&
whom
,
Ts
&&
...
args
)
{
void
anon_send
(
message_priority
prio
,
const
typed_actor
<
Rs
...
>&
to
,
check_typed_input
(
whom
,
Ts
&&
...
vs
)
{
check_typed_input
(
to
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
{});
>::
type
...
>
{});
anon_send
(
actor_cast
<
channel
>
(
whom
),
std
::
forward
<
Ts
>
(
arg
s
)...);
anon_send
(
prio
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
v
s
)...);
}
}
/**
* Anonymously sends `to` a message.
*/
template
<
class
...
Rs
,
class
...
Ts
>
template
<
class
...
Rs
,
class
...
Ts
>
void
anon_send
(
const
typed_actor
<
Rs
...
>&
whom
,
message_priority
prio
,
void
anon_send
(
const
typed_actor
<
Rs
...
>&
to
,
Ts
&&
...
vs
)
{
Ts
&&
...
args
)
{
check_typed_input
(
to
,
check_typed_input
(
whom
,
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
{});
>::
type
...
>
{});
anon_send
(
actor_cast
<
channel
>
(
whom
),
prio
,
std
::
forward
<
Ts
>
(
args
)...);
anon_send
(
message_priority
::
normal
,
actor_cast
<
channel
>
(
to
),
std
::
forward
<
Ts
>
(
vs
)...);
}
}
/**
/**
* Anonymously sends `
whom
` an exit message.
* Anonymously sends `
to
` an exit message.
*/
*/
inline
void
anon_send_exit
(
const
actor_addr
&
whom
,
uint32_t
reason
)
{
inline
void
anon_send_exit
(
const
actor_addr
&
to
,
uint32_t
reason
)
{
if
(
!
whom
){
if
(
!
to
){
return
;
return
;
}
}
auto
ptr
=
actor_cast
<
actor
>
(
whom
);
auto
ptr
=
actor_cast
<
actor
>
(
to
);
ptr
->
enqueue
(
invalid_actor_addr
,
message_id
{}.
with_high_priority
(),
ptr
->
enqueue
(
invalid_actor_addr
,
message_id
{}.
with_high_priority
(),
make_message
(
exit_msg
{
invalid_actor_addr
,
reason
}),
nullptr
);
make_message
(
exit_msg
{
invalid_actor_addr
,
reason
}),
nullptr
);
}
}
/**
/**
* Anonymously sends `
whom
` an exit message.
* Anonymously sends `
to
` an exit message.
*/
*/
template
<
class
ActorHandle
>
template
<
class
ActorHandle
>
void
anon_send_exit
(
const
ActorHandle
&
whom
,
uint32_t
reason
)
{
void
anon_send_exit
(
const
ActorHandle
&
to
,
uint32_t
reason
)
{
anon_send_exit
(
whom
.
address
(),
reason
);
anon_send_exit
(
to
.
address
(),
reason
);
}
// <backward_compatibility version="0.9">
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message
msg
)
{
send_as
(
from
,
to
,
std
::
move
(
msg
));
}
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
message
msg
)
{
send_as
(
from
,
prio
,
to
,
std
::
move
(
msg
));
}
}
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
{
send_as
(
invalid_actor
,
to
,
std
::
move
(
msg
));
}
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
message
msg
)
{
send_as
(
invalid_actor
,
prio
,
to
,
std
::
move
(
msg
));
}
// </backward_compatibility>
}
// namespace caf
}
// namespace caf
#endif // CAF_SEND_HPP
#endif // CAF_SEND_HPP
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