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
9f381d60
Commit
9f381d60
authored
May 31, 2020
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement missing api in middleman
parent
03fc9cb1
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 @
9f381d60
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
#pragma once
#pragma once
#include <set>
#include <string>
#include <thread>
#include <thread>
#include "caf/actor_system.hpp"
#include "caf/actor_system.hpp"
...
@@ -25,6 +27,8 @@
...
@@ -25,6 +27,8 @@
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/middleman_backend.hpp"
#include "caf/scoped_actor.hpp"
namespace
caf
::
net
{
namespace
caf
::
net
{
...
@@ -72,9 +76,38 @@ public:
...
@@ -72,9 +76,38 @@ public:
// -- remoting ---------------------------------------------------------------
// -- 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.
/// Resolves a path to a remote actor.
void
resolve
(
const
uri
&
locator
,
const
actor
&
listener
);
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 -------------------------------------------------------------
// -- properties -------------------------------------------------------------
actor_system
&
system
()
{
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