Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
1d1cfef7
Commit
1d1cfef7
authored
May 31, 2020
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement missing api in middleman
parent
98280d5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
libcaf_net/caf/net/middleman.hpp
libcaf_net/caf/net/middleman.hpp
+33
-0
No files found.
libcaf_net/caf/net/middleman.hpp
View file @
1d1cfef7
...
...
@@ -18,6 +18,8 @@
#pragma once
#include <set>
#include <string>
#include <thread>
#include "caf/actor_system.hpp"
...
...
@@ -25,6 +27,8 @@
#include "caf/detail/type_list.hpp"
#include "caf/fwd.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/middleman_backend.hpp"
#include "caf/scoped_actor.hpp"
namespace
caf
::
net
{
...
...
@@ -72,9 +76,38 @@ public:
// -- remoting ---------------------------------------------------------------
// Publishes an actor.
template
<
class
Handle
=
actor
>
error
publish
(
Handle
whom
,
const
uri
&
locator
)
{
auto
be
=
backend
(
locator
.
scheme
());
be
->
publish
(
whom
,
locator
);
}
/// Resolves a path to a remote actor.
void
resolve
(
const
uri
&
locator
,
const
actor
&
listener
);
template
<
class
Handle
>
expected
<
Handle
>
remote_actor
(
const
uri
&
locator
)
{
// TODO: Use function view?
scoped_actor
self
{
sys_
};
resolve
(
locator
,
self
);
strong_actor_ptr
actor_ptr
;
error
err
=
none
;
self
->
receive
(
[
&
actor_ptr
](
strong_actor_ptr
&
ptr
,
const
std
::
set
<
std
::
string
>&
)
{
actor_ptr
=
ptr
;
},
[
&
err
](
const
error
&
e
)
{
err
=
e
;
});
if
(
err
)
return
err
;
auto
res
=
actor_cast
<
Handle
>
(
actor_ptr
);
if
(
res
)
return
res
;
else
return
make_error
(
sec
::
runtime_error
,
"cannot cast actor to specified type"
);
}
// -- properties -------------------------------------------------------------
actor_system
&
system
()
{
...
...
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