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
a42e2ddb
Commit
a42e2ddb
authored
Nov 26, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users to send non-serializable messages
parent
a3424580
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
12 deletions
+49
-12
libcaf_core/caf/data_processor.hpp
libcaf_core/caf/data_processor.hpp
+2
-2
libcaf_core/caf/detail/try_serialize.hpp
libcaf_core/caf/detail/try_serialize.hpp
+39
-0
libcaf_core/caf/detail/tuple_vals.hpp
libcaf_core/caf/detail/tuple_vals.hpp
+3
-2
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+0
-5
libcaf_core/caf/type_erased_value.hpp
libcaf_core/caf/type_erased_value.hpp
+5
-3
No files found.
libcaf_core/caf/data_processor.hpp
View file @
a42e2ddb
...
@@ -213,6 +213,7 @@ public:
...
@@ -213,6 +213,7 @@ public:
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
typename
std
::
enable_if
<
detail
::
is_iterable
<
T
>::
value
detail
::
is_iterable
<
T
>::
value
&&
!
detail
::
has_serialize
<
T
>::
value
>::
type
>::
type
apply
(
T
&
xs
)
{
apply
(
T
&
xs
)
{
apply_sequence
(
dref
(),
xs
);
apply_sequence
(
dref
(),
xs
);
...
@@ -278,8 +279,7 @@ public:
...
@@ -278,8 +279,7 @@ public:
template
<
class
T
>
template
<
class
T
>
typename
std
::
enable_if
<
typename
std
::
enable_if
<
!
detail
::
is_iterable
<
T
>::
value
!
std
::
is_empty
<
T
>::
value
&&
!
std
::
is_empty
<
T
>::
value
&&
detail
::
has_serialize
<
T
>::
value
&&
detail
::
has_serialize
<
T
>::
value
>::
type
>::
type
apply
(
T
&
x
)
{
apply
(
T
&
x
)
{
...
...
libcaf_core/caf/detail/try_serialize.hpp
0 → 100644
View file @
a42e2ddb
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_DETAIL_TRY_SERIALIZE_HPP
#define CAF_DETAIL_TRY_SERIALIZE_HPP
namespace
caf
{
namespace
detail
{
template
<
class
T
,
class
U
>
auto
try_serialize
(
T
&
in_or_out
,
U
*
x
)
->
decltype
(
in_or_out
&
*
x
)
{
in_or_out
&
*
x
;
}
template
<
class
T
>
void
try_serialize
(
T
&
,
const
void
*
)
{
// nop
}
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_TRY_SERIALIZE_HPP
libcaf_core/caf/detail/tuple_vals.hpp
View file @
a42e2ddb
...
@@ -25,12 +25,13 @@
...
@@ -25,12 +25,13 @@
#include "caf/serializer.hpp"
#include "caf/serializer.hpp"
#include "caf/deserializer.hpp"
#include "caf/deserializer.hpp"
#include "caf/deep_to_string.hpp"
#include "caf/detail/type_nr.hpp"
#include "caf/detail/type_nr.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/message_data.hpp"
#include "caf/detail/message_data.hpp"
#include "caf/de
ep_to_string
.hpp"
#include "caf/de
tail/try_serialize
.hpp"
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
...
@@ -59,7 +60,7 @@ struct tup_ptr_access {
...
@@ -59,7 +60,7 @@ struct tup_ptr_access {
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
static
void
serialize
(
size_t
pos
,
T
&
tup
,
U
&
in_or_out
)
{
static
void
serialize
(
size_t
pos
,
T
&
tup
,
U
&
in_or_out
)
{
if
(
pos
==
Pos
)
if
(
pos
==
Pos
)
in_or_out
&
std
::
get
<
Pos
>
(
tup
);
try_serialize
(
in_or_out
,
&
std
::
get
<
Pos
>
(
tup
)
);
else
else
tup_ptr_access
<
Pos
+
1
,
Max
>::
serialize
(
pos
,
tup
,
in_or_out
);
tup_ptr_access
<
Pos
+
1
,
Max
>::
serialize
(
pos
,
tup
,
in_or_out
);
}
}
...
...
libcaf_core/caf/message.hpp
View file @
a42e2ddb
...
@@ -393,11 +393,6 @@ make_message(V&& x, Ts&&... xs) {
...
@@ -393,11 +393,6 @@ make_message(V&& x, Ts&&... xs) {
typename
strip_and_convert
<
Ts
>::
type
typename
strip_and_convert
<
Ts
>::
type
>::
type
...
>::
type
...
>
;
>
;
static_assert
(
tl_forall
<
stored_types
,
is_serializable
>::
value
,
"at least one type is not serializable via free "
"'serialize(InOrOut&, T&, const unsigned int)' or"
"`T::sereialize(InOrOut&, const unsigned int)` "
"member function"
);
using
storage
=
typename
tl_apply
<
stored_types
,
tuple_vals
>::
type
;
using
storage
=
typename
tl_apply
<
stored_types
,
tuple_vals
>::
type
;
auto
ptr
=
make_counted
<
storage
>
(
std
::
forward
<
V
>
(
x
),
std
::
forward
<
Ts
>
(
xs
)...);
auto
ptr
=
make_counted
<
storage
>
(
std
::
forward
<
V
>
(
x
),
std
::
forward
<
Ts
>
(
xs
)...);
return
message
{
detail
::
message_data
::
cow_ptr
{
std
::
move
(
ptr
)}};
return
message
{
detail
::
message_data
::
cow_ptr
{
std
::
move
(
ptr
)}};
...
...
libcaf_core/caf/type_erased_value.hpp
View file @
a42e2ddb
...
@@ -22,9 +22,11 @@
...
@@ -22,9 +22,11 @@
#include <typeinfo>
#include <typeinfo>
#include "caf/deep_to_string.hpp"
#include "caf/detail/type_nr.hpp"
#include "caf/detail/type_nr.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/de
ep_to_string
.hpp"
#include "caf/de
tail/try_serialize
.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -75,11 +77,11 @@ struct type_erased_value_impl : public type_erased_value {
...
@@ -75,11 +77,11 @@ struct type_erased_value_impl : public type_erased_value {
}
}
void
save
(
serializer
&
sink
)
const
override
{
void
save
(
serializer
&
sink
)
const
override
{
sink
&
const_cast
<
T
&>
(
x
);
detail
::
try_serialize
(
sink
,
const_cast
<
T
*>
(
&
x
)
);
}
}
void
load
(
deserializer
&
source
)
override
{
void
load
(
deserializer
&
source
)
override
{
source
&
x
;
detail
::
try_serialize
(
source
,
&
x
)
;
}
}
std
::
string
stringify
()
const
override
{
std
::
string
stringify
()
const
override
{
...
...
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