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
bee96d84
Unverified
Commit
bee96d84
authored
Feb 15, 2020
by
Joseph Noir
Committed by
GitHub
Feb 15, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1050
Various fixes, mostly related to typed_actor_view
parents
b1dacd03
6bb0690c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
4 deletions
+51
-4
libcaf_core/caf/composed_behavior.hpp
libcaf_core/caf/composed_behavior.hpp
+1
-2
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+1
-0
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+4
-0
libcaf_core/caf/typed_actor_pointer.hpp
libcaf_core/caf/typed_actor_pointer.hpp
+6
-2
libcaf_core/caf/typed_actor_view.hpp
libcaf_core/caf/typed_actor_view.hpp
+37
-0
libcaf_io/caf/io/middleman.hpp
libcaf_io/caf/io/middleman.hpp
+2
-0
No files found.
libcaf_core/caf/composed_behavior.hpp
View file @
bee96d84
...
@@ -38,8 +38,7 @@ public:
...
@@ -38,8 +38,7 @@ public:
using
broker_base
=
typename
handle_type
::
broker_base
;
using
broker_base
=
typename
handle_type
::
broker_base
;
using
self_pointer
=
using
self_pointer
=
typename
handle_type
::
pointer_view
;
typename
detail
::
tl_apply
<
signatures
,
typed_actor_pointer
>::
type
;
composed_behavior
()
:
self
(
nullptr
)
{
composed_behavior
()
:
self
(
nullptr
)
{
// nop
// nop
...
...
libcaf_core/caf/fwd.hpp
View file @
bee96d84
...
@@ -71,6 +71,7 @@ template <class...> class delegated;
...
@@ -71,6 +71,7 @@ template <class...> class delegated;
template
<
class
...
>
class
result
;
template
<
class
...
>
class
result
;
template
<
class
...
>
class
typed_actor
;
template
<
class
...
>
class
typed_actor
;
template
<
class
...
>
class
typed_actor_pointer
;
template
<
class
...
>
class
typed_actor_pointer
;
template
<
class
...
>
class
typed_actor_view
;
template
<
class
...
>
class
typed_event_based_actor
;
template
<
class
...
>
class
typed_event_based_actor
;
template
<
class
...
>
class
typed_response_promise
;
template
<
class
...
>
class
typed_response_promise
;
template
<
class
...
>
class
variant
;
template
<
class
...
>
class
variant
;
...
...
libcaf_core/caf/typed_actor.hpp
View file @
bee96d84
...
@@ -93,6 +93,10 @@ public:
...
@@ -93,6 +93,10 @@ public:
/// Identifies pointers to instances of this kind of actor.
/// Identifies pointers to instances of this kind of actor.
using
pointer
=
typed_event_based_actor
<
Sigs
...
>*
;
using
pointer
=
typed_event_based_actor
<
Sigs
...
>*
;
/// Allows a view to an actor implementing this messaging interface without
/// knowledge of the actual type..
using
pointer_view
=
typed_actor_pointer
<
Sigs
...
>
;
/// Identifies the base class for this kind of actor.
/// Identifies the base class for this kind of actor.
using
base
=
typed_event_based_actor
<
Sigs
...
>
;
using
base
=
typed_event_based_actor
<
Sigs
...
>
;
...
...
libcaf_core/caf/typed_actor_pointer.hpp
View file @
bee96d84
...
@@ -29,15 +29,19 @@ public:
...
@@ -29,15 +29,19 @@ public:
/// Stores the template parameter pack.
/// Stores the template parameter pack.
using
signatures
=
detail
::
type_list
<
Sigs
...
>
;
using
signatures
=
detail
::
type_list
<
Sigs
...
>
;
typed_actor_pointer
()
:
view_
(
nullptr
)
{
// nop
}
template
<
class
Supertype
>
template
<
class
Supertype
>
typed_actor_pointer
(
Supertype
*
selfptr
)
:
view_
(
selfptr
)
{
explicit
typed_actor_pointer
(
Supertype
*
selfptr
)
:
view_
(
selfptr
)
{
using
namespace
caf
::
detail
;
using
namespace
caf
::
detail
;
static_assert
(
static_assert
(
tl_subset_of
<
type_list
<
Sigs
...
>
,
typename
Supertype
::
signatures
>::
value
,
tl_subset_of
<
type_list
<
Sigs
...
>
,
typename
Supertype
::
signatures
>::
value
,
"cannot create a pointer view to an unrelated actor type"
);
"cannot create a pointer view to an unrelated actor type"
);
}
}
typed_actor_pointer
(
std
::
nullptr_t
)
:
view_
(
nullptr
)
{
explicit
typed_actor_pointer
(
std
::
nullptr_t
)
:
view_
(
nullptr
)
{
// nop
// nop
}
}
...
...
libcaf_core/caf/typed_actor_view.hpp
View file @
bee96d84
...
@@ -18,9 +18,11 @@
...
@@ -18,9 +18,11 @@
#pragma once
#pragma once
#include "caf/actor_traits.hpp"
#include "caf/mixin/requester.hpp"
#include "caf/mixin/requester.hpp"
#include "caf/mixin/sender.hpp"
#include "caf/mixin/sender.hpp"
#include "caf/scheduled_actor.hpp"
#include "caf/scheduled_actor.hpp"
#include "caf/timespan.hpp"
#include "caf/typed_actor_view_base.hpp"
#include "caf/typed_actor_view_base.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -101,6 +103,14 @@ public:
...
@@ -101,6 +103,14 @@ public:
self_
->
demonitor
(
x
);
self_
->
demonitor
(
x
);
}
}
message_id
new_request_id
(
message_priority
mp
)
{
return
self_
->
new_request_id
(
mp
);
}
void
request_response_timeout
(
timespan
d
,
message_id
mid
)
{
return
self_
->
request_response_timeout
(
d
,
mid
);
}
response_promise
make_response_promise
()
{
response_promise
make_response_promise
()
{
return
self_
->
make_response_promise
();
return
self_
->
make_response_promise
();
}
}
...
@@ -114,6 +124,20 @@ public:
...
@@ -114,6 +124,20 @@ public:
return
self_
->
response
(
std
::
forward
<
Ts
>
(
xs
)...);
return
self_
->
response
(
std
::
forward
<
Ts
>
(
xs
)...);
}
}
template
<
class
...
Ts
>
void
eq_impl
(
Ts
&&
...
xs
)
{
self_
->
eq_impl
(
std
::
forward
<
Ts
>
(
xs
)...);
}
void
add_awaited_response_handler
(
message_id
response_id
,
behavior
bhvr
)
{
return
self_
->
add_awaited_response_handler
(
response_id
,
std
::
move
(
bhvr
));
}
void
add_multiplexed_response_handler
(
message_id
response_id
,
behavior
bhvr
)
{
return
self_
->
add_multiplexed_response_handler
(
response_id
,
std
::
move
(
bhvr
));
}
/// Returns a pointer to the sender of the current message.
/// Returns a pointer to the sender of the current message.
/// @pre `current_mailbox_element() != nullptr`
/// @pre `current_mailbox_element() != nullptr`
strong_actor_ptr
&
current_sender
()
{
strong_actor_ptr
&
current_sender
()
{
...
@@ -144,4 +168,17 @@ private:
...
@@ -144,4 +168,17 @@ private:
scheduled_actor
*
self_
;
scheduled_actor
*
self_
;
};
};
template
<
class
...
Sigs
>
struct
actor_traits
<
typed_actor_view
<
Sigs
...
>>
{
static
constexpr
bool
is_dynamically_typed
=
false
;
static
constexpr
bool
is_statically_typed
=
true
;
static
constexpr
bool
is_blocking
=
false
;
static
constexpr
bool
is_non_blocking
=
true
;
static
constexpr
bool
is_incomplete
=
false
;
};
}
// namespace caf
}
// namespace caf
libcaf_io/caf/io/middleman.hpp
View file @
bee96d84
...
@@ -161,6 +161,8 @@ public:
...
@@ -161,6 +161,8 @@ public:
timespan
timeout
=
timespan
{
std
::
chrono
::
minutes
{
1
}})
{
timespan
timeout
=
timespan
{
std
::
chrono
::
minutes
{
1
}})
{
if
(
!
nid
||
name
.
empty
())
if
(
!
nid
||
name
.
empty
())
return
sec
::
invalid_argument
;
return
sec
::
invalid_argument
;
if
(
nid
==
system
().
node
())
return
system
().
spawn
<
Handle
>
(
std
::
move
(
name
),
std
::
move
(
args
));
auto
res
=
remote_spawn_impl
(
nid
,
name
,
args
,
auto
res
=
remote_spawn_impl
(
nid
,
name
,
args
,
system
().
message_types
<
Handle
>
(),
timeout
);
system
().
message_types
<
Handle
>
(),
timeout
);
if
(
!
res
)
if
(
!
res
)
...
...
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