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
cedc10b3
Commit
cedc10b3
authored
May 17, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make CAF types streamable
parent
aec90867
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+14
-12
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+9
-0
No files found.
libcaf_core/caf/actor_system_config.hpp
View file @
cedc10b3
...
@@ -164,21 +164,15 @@ public:
...
@@ -164,21 +164,15 @@ public:
||
(
std
::
is_default_constructible
<
T
>::
value
||
(
std
::
is_default_constructible
<
T
>::
value
&&
std
::
is_copy_constructible
<
T
>::
value
),
&&
std
::
is_copy_constructible
<
T
>::
value
),
"T must provide default and copy constructors"
);
"T must provide default and copy constructors"
);
using
stream_type
=
stream
<
T
>
;
std
::
string
stream_name
=
"stream<"
;
std
::
string
stream_name
=
"stream<"
;
stream_name
+=
name
;
stream_name
+=
name
;
stream_name
+=
">"
;
stream_name
+=
">"
;
static_assert
(
detail
::
is_serializable
<
T
>::
value
,
"T must be serializable"
);
add_message_type_impl
<
stream
<
T
>>
(
std
::
move
(
stream_name
));
type_names_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
T
)),
name
);
std
::
string
vec_name
=
"std::vector<"
;
value_factories_by_name
.
emplace
(
std
::
move
(
name
),
&
make_type_erased_value
<
T
>
);
vec_name
+=
name
;
value_factories_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
T
)),
vec_name
+=
">"
;
&
make_type_erased_value
<
T
>
);
add_message_type_impl
<
std
::
vector
<
T
>>
(
std
::
move
(
vec_name
));
type_names_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
stream_type
)),
add_message_type_impl
<
T
>
(
std
::
move
(
name
));
stream_name
);
value_factories_by_name
.
emplace
(
std
::
move
(
stream_name
),
&
make_type_erased_value
<
stream_type
>
);
value_factories_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
stream_type
)),
&
make_type_erased_value
<
stream_type
>
);
return
*
this
;
return
*
this
;
}
}
...
@@ -320,6 +314,14 @@ protected:
...
@@ -320,6 +314,14 @@ protected:
option_vector
custom_options_
;
option_vector
custom_options_
;
private:
private:
template
<
class
T
>
void
add_message_type_impl
(
std
::
string
name
)
{
type_names_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
T
)),
name
);
value_factories_by_name
.
emplace
(
std
::
move
(
name
),
&
make_type_erased_value
<
T
>
);
value_factories_by_rtti
.
emplace
(
std
::
type_index
(
typeid
(
T
)),
&
make_type_erased_value
<
T
>
);
}
static
std
::
string
render_sec
(
uint8_t
,
atom_value
,
const
message
&
);
static
std
::
string
render_sec
(
uint8_t
,
atom_value
,
const
message
&
);
static
std
::
string
render_exit_reason
(
uint8_t
,
atom_value
,
const
message
&
);
static
std
::
string
render_exit_reason
(
uint8_t
,
atom_value
,
const
message
&
);
...
...
libcaf_core/src/actor_system_config.cpp
View file @
cedc10b3
...
@@ -100,6 +100,15 @@ actor_system_config::actor_system_config()
...
@@ -100,6 +100,15 @@ actor_system_config::actor_system_config()
:
cli_helptext_printed
(
false
),
:
cli_helptext_printed
(
false
),
slave_mode
(
false
),
slave_mode
(
false
),
slave_mode_fun
(
nullptr
)
{
slave_mode_fun
(
nullptr
)
{
// add `vector<T>` and `stream<T>` for each statically known type
add_message_type_impl
<
stream
<
actor
>>
(
"stream<@actor>"
);
add_message_type_impl
<
stream
<
actor_addr
>>
(
"stream<@addr>"
);
add_message_type_impl
<
stream
<
atom_value
>>
(
"stream<@atom>"
);
add_message_type_impl
<
stream
<
message
>>
(
"stream<@message>"
);
add_message_type_impl
<
std
::
vector
<
actor
>>
(
"std::vector<@actor>"
);
add_message_type_impl
<
std
::
vector
<
actor_addr
>>
(
"std::vector<@addr>"
);
add_message_type_impl
<
std
::
vector
<
atom_value
>>
(
"std::vector<@atom>"
);
add_message_type_impl
<
std
::
vector
<
message
>>
(
"std::vector<@message>"
);
// (1) hard-coded defaults
// (1) hard-coded defaults
scheduler_policy
=
atom
(
"stealing"
);
scheduler_policy
=
atom
(
"stealing"
);
scheduler_max_threads
=
std
::
max
(
std
::
thread
::
hardware_concurrency
(),
scheduler_max_threads
=
std
::
max
(
std
::
thread
::
hardware_concurrency
(),
...
...
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