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
3d2d8690
Commit
3d2d8690
authored
Jul 07, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler errors and wanings on GCC 4.9
parent
236bf701
Changes
49
Show whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
147 additions
and
181 deletions
+147
-181
examples/custom_type/custom_types_1.cpp
examples/custom_type/custom_types_1.cpp
+2
-2
examples/custom_type/custom_types_2.cpp
examples/custom_type/custom_types_2.cpp
+1
-1
examples/custom_type/custom_types_3.cpp
examples/custom_type/custom_types_3.cpp
+1
-1
libcaf_core/caf/abstract_composable_behavior.hpp
libcaf_core/caf/abstract_composable_behavior.hpp
+0
-6
libcaf_core/caf/actor.hpp
libcaf_core/caf/actor.hpp
+1
-1
libcaf_core/caf/actor_addr.hpp
libcaf_core/caf/actor_addr.hpp
+1
-1
libcaf_core/caf/actor_control_block.hpp
libcaf_core/caf/actor_control_block.hpp
+2
-2
libcaf_core/caf/config.hpp
libcaf_core/caf/config.hpp
+1
-1
libcaf_core/caf/data_processor.hpp
libcaf_core/caf/data_processor.hpp
+47
-31
libcaf_core/caf/detail/pseudo_tuple.hpp
libcaf_core/caf/detail/pseudo_tuple.hpp
+7
-4
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+2
-0
libcaf_core/caf/detail/try_match.hpp
libcaf_core/caf/detail/try_match.hpp
+0
-1
libcaf_core/caf/detail/tuple_vals.hpp
libcaf_core/caf/detail/tuple_vals.hpp
+2
-1
libcaf_core/caf/detail/tuple_zip.hpp
libcaf_core/caf/detail/tuple_zip.hpp
+0
-39
libcaf_core/caf/detail/type_erased_tuple_view.hpp
libcaf_core/caf/detail/type_erased_tuple_view.hpp
+0
-1
libcaf_core/caf/duration.hpp
libcaf_core/caf/duration.hpp
+1
-1
libcaf_core/caf/error.hpp
libcaf_core/caf/error.hpp
+1
-1
libcaf_core/caf/exit_reason.hpp
libcaf_core/caf/exit_reason.hpp
+1
-1
libcaf_core/caf/group.hpp
libcaf_core/caf/group.hpp
+1
-1
libcaf_core/caf/index_mapping.hpp
libcaf_core/caf/index_mapping.hpp
+1
-2
libcaf_core/caf/invoke_message_result.hpp
libcaf_core/caf/invoke_message_result.hpp
+1
-1
libcaf_core/caf/mailbox_element.hpp
libcaf_core/caf/mailbox_element.hpp
+1
-1
libcaf_core/caf/match_case.hpp
libcaf_core/caf/match_case.hpp
+3
-10
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+10
-0
libcaf_core/caf/message_id.hpp
libcaf_core/caf/message_id.hpp
+1
-1
libcaf_core/caf/node_id.hpp
libcaf_core/caf/node_id.hpp
+13
-13
libcaf_core/caf/sec.hpp
libcaf_core/caf/sec.hpp
+1
-1
libcaf_core/caf/stream_deserializer.hpp
libcaf_core/caf/stream_deserializer.hpp
+3
-3
libcaf_core/caf/stream_serializer.hpp
libcaf_core/caf/stream_serializer.hpp
+2
-2
libcaf_core/caf/system_messages.hpp
libcaf_core/caf/system_messages.hpp
+4
-4
libcaf_core/caf/type_erased_tuple.hpp
libcaf_core/caf/type_erased_tuple.hpp
+2
-6
libcaf_core/caf/type_erased_value.hpp
libcaf_core/caf/type_erased_value.hpp
+3
-6
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+1
-1
libcaf_core/src/exit_reason.cpp
libcaf_core/src/exit_reason.cpp
+1
-1
libcaf_core/src/sec.cpp
libcaf_core/src/sec.cpp
+1
-1
libcaf_core/test/composable_behavior.cpp
libcaf_core/test/composable_behavior.cpp
+2
-1
libcaf_core/test/message.cpp
libcaf_core/test/message.cpp
+3
-3
libcaf_core/test/serialization.cpp
libcaf_core/test/serialization.cpp
+3
-3
libcaf_core/test/typed_spawn.cpp
libcaf_core/test/typed_spawn.cpp
+1
-1
libcaf_io/caf/io/accept_handle.hpp
libcaf_io/caf/io/accept_handle.hpp
+2
-1
libcaf_io/caf/io/basp/connection_state.hpp
libcaf_io/caf/io/basp/connection_state.hpp
+1
-1
libcaf_io/caf/io/basp/header.hpp
libcaf_io/caf/io/basp/header.hpp
+1
-1
libcaf_io/caf/io/broker_servant.hpp
libcaf_io/caf/io/broker_servant.hpp
+2
-10
libcaf_io/caf/io/connection_handle.hpp
libcaf_io/caf/io/connection_handle.hpp
+2
-1
libcaf_io/caf/io/network/operation.hpp
libcaf_io/caf/io/network/operation.hpp
+1
-1
libcaf_io/caf/io/network/protocol.hpp
libcaf_io/caf/io/network/protocol.hpp
+1
-1
libcaf_io/caf/io/receive_policy.hpp
libcaf_io/caf/io/receive_policy.hpp
+2
-1
libcaf_io/caf/io/system_messages.hpp
libcaf_io/caf/io/system_messages.hpp
+5
-5
libcaf_io/test/typed_remote_actor.cpp
libcaf_io/test/typed_remote_actor.cpp
+2
-2
No files found.
examples/custom_type/custom_types_1.cpp
View file @
3d2d8690
...
...
@@ -27,7 +27,7 @@ struct foo {
// foo needs to be serializable
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
foo
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
foo
&
x
)
{
return
f
(
meta
::
type_name
(
"foo"
),
x
.
a
,
x
.
b
);
}
...
...
@@ -45,7 +45,7 @@ struct foo2 {
// foo2 also needs to be serializable
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
foo2
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
foo2
&
x
)
{
return
f
(
meta
::
type_name
(
"foo2"
),
x
.
a
,
x
.
b
);
}
...
...
examples/custom_type/custom_types_2.cpp
View file @
3d2d8690
...
...
@@ -41,7 +41,7 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
foo
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
foo
&
x
)
{
return
f
(
meta
::
type_name
(
"foo"
),
x
.
a_
,
x
.
b_
);
}
...
...
examples/custom_type/custom_types_3.cpp
View file @
3d2d8690
...
...
@@ -49,7 +49,7 @@ private:
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
foo
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
foo
&
x
)
{
// store current state into temporaries, then give the inspector references
// to temporaries that are written back only when the inspector is saving
auto
a
=
x
.
a
();
...
...
libcaf_core/caf/abstract_composable_behavior.hpp
View file @
3d2d8690
...
...
@@ -23,12 +23,6 @@
#include <utility>
#include "caf/fwd.hpp"
#include "caf/sec.hpp"
#include "caf/message.hpp"
#include "caf/detail/int_list.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/pseudo_tuple.hpp"
namespace
caf
{
...
...
libcaf_core/caf/actor.hpp
View file @
3d2d8690
...
...
@@ -165,7 +165,7 @@ public:
actor
(
actor_control_block
*
,
bool
);
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
actor
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
actor
&
x
)
{
return
inspect
(
f
,
x
.
ptr_
);
}
...
...
libcaf_core/caf/actor_addr.hpp
View file @
3d2d8690
...
...
@@ -110,7 +110,7 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
actor_addr
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
actor_addr
&
x
)
{
return
inspect
(
f
,
x
.
ptr_
);
}
...
...
libcaf_core/caf/actor_control_block.hpp
View file @
3d2d8690
...
...
@@ -201,7 +201,7 @@ inline execution_unit* context_of(void*) {
}
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
strong_actor_ptr
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
strong_actor_ptr
&
x
)
{
actor_id
aid
=
0
;
node_id
nid
;
if
(
x
)
{
...
...
@@ -216,7 +216,7 @@ error inspect(Inspector& f, strong_actor_ptr& x) {
}
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
weak_actor_ptr
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
weak_actor_ptr
&
x
)
{
// inspect as strong pointer, then write back to weak pointer on save
auto
tmp
=
x
.
lock
();
auto
load
=
[
&
]()
->
error
{
x
.
reset
(
tmp
.
get
());
return
none
;
};
...
...
libcaf_core/caf/config.hpp
View file @
3d2d8690
...
...
@@ -214,7 +214,7 @@
#ifdef CAF_NO_EXCEPTIONS
# define CAF_RAISE_ERROR(msg) \
do { std::string str = msg; CAF_CRITICAL(str.c_str()); } while (
fals
e)
do { std::string str = msg; CAF_CRITICAL(str.c_str()); } while (
tru
e)
#else // CAF_NO_EXCEPTIONS
# define CAF_RAISE_ERROR(msg) \
throw std::runtime_error(msg)
...
...
libcaf_core/caf/data_processor.hpp
View file @
3d2d8690
...
...
@@ -49,38 +49,12 @@ namespace caf {
template
<
class
Derived
>
class
data_processor
{
public:
data_processor
(
const
data_processor
&
)
=
delete
;
data_processor
&
operator
=
(
const
data_processor
&
)
=
delete
;
data_processor
(
execution_unit
*
ctx
=
nullptr
)
:
context_
(
ctx
)
{
// nop
}
virtual
~
data_processor
()
{
// nop
}
/// Begins processing of an object. Saves the type information
/// to the underlying storage when in saving mode, otherwise
/// extracts them and sets both arguments accordingly.
virtual
error
begin_object
(
uint16_t
&
typenr
,
std
::
string
&
name
)
=
0
;
/// Ends processing of an object.
virtual
error
end_object
()
=
0
;
// -- member types -----------------------------------------------------------
/// Begins processing of a sequence. Saves the size
/// to the underlying storage when in saving mode, otherwise
/// sets `num` accordingly.
virtual
error
begin_sequence
(
size_t
&
num
)
=
0
;
/// Ends processing of a sequence.
virtual
error
end_sequence
()
=
0
;
/// Returns the actor system associated to this data processor.
execution_unit
*
context
()
{
return
context_
;
}
/// Return type for `operator()`.
using
result_type
=
error
;
/// List of builtin types for data processors.
using
builtin_t
=
detail
::
type_list
<
int8_t
,
...
...
@@ -99,7 +73,7 @@ public:
std
::
u32string
>
;
/// List
s all types an implementation has to accept as builtin types
.
/// List
of builtin types for data processors as enum
.
enum
builtin
{
i8_v
,
u8_v
,
...
...
@@ -117,6 +91,46 @@ public:
string32_v
};
// -- constructors, destructors, and assignment operators --------------------
data_processor
(
const
data_processor
&
)
=
delete
;
data_processor
&
operator
=
(
const
data_processor
&
)
=
delete
;
data_processor
(
execution_unit
*
ctx
=
nullptr
)
:
context_
(
ctx
)
{
// nop
}
virtual
~
data_processor
()
{
// nop
}
// -- pure virtual functions -------------------------------------------------
/// Begins processing of an object. Saves the type information
/// to the underlying storage when in saving mode, otherwise
/// extracts them and sets both arguments accordingly.
virtual
error
begin_object
(
uint16_t
&
typenr
,
std
::
string
&
name
)
=
0
;
/// Ends processing of an object.
virtual
error
end_object
()
=
0
;
/// Begins processing of a sequence. Saves the size
/// to the underlying storage when in saving mode, otherwise
/// sets `num` accordingly.
virtual
error
begin_sequence
(
size_t
&
num
)
=
0
;
/// Ends processing of a sequence.
virtual
error
end_sequence
()
=
0
;
// -- getter -----------------------------------------------------------------
/// Returns the actor system associated to this data processor.
execution_unit
*
context
()
{
return
context_
;
}
// -- apply functions --------------------------------------------------------
/// Applies this processor to an arithmetic type.
template
<
class
T
>
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>::
value
,
error
>::
type
...
...
@@ -420,6 +434,8 @@ public:
return
inspect
(
dref
(),
x
);
}
// -- operator() -------------------------------------------------------------
inline
error
operator
()()
{
return
none
;
}
...
...
libcaf_core/caf/detail/pseudo_tuple.hpp
View file @
3d2d8690
...
...
@@ -32,17 +32,20 @@ namespace detail {
// tuple-like access to an array of void pointers that is
// also aware of the semantics of param<T>
template
<
class
...
T
>
template
<
class
...
T
s
>
struct
pseudo_tuple
{
using
pointer
=
void
*
;
using
const_pointer
=
const
void
*
;
pointer
data
[
sizeof
...(
T
)
>
0
?
sizeof
...(
T
)
:
1
];
pointer
data
[
sizeof
...(
T
s
)
>
0
?
sizeof
...(
Ts
)
:
1
];
bool
shared_access
;
pseudo_tuple
(
bool
is_shared
)
:
shared_access
(
is_shared
)
{
// nop
template
<
class
Tuple
>
pseudo_tuple
(
const
Tuple
&
xs
)
:
data
(),
shared_access
(
xs
.
shared
())
{
CAF_ASSERT
(
sizeof
...(
Ts
)
==
xs
.
size
());
for
(
size_t
i
=
0
;
i
<
xs
.
size
();
++
i
)
data
[
i
]
=
const_cast
<
void
*>
(
xs
.
get
(
i
));
}
inline
const_pointer
at
(
size_t
p
)
const
{
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
3d2d8690
...
...
@@ -45,6 +45,8 @@ namespace detail {
class
stringification_inspector
{
public:
using
result_type
=
error
;
using
is_saving
=
std
::
true_type
;
stringification_inspector
(
std
::
string
&
result
)
:
result_
(
result
)
{
...
...
libcaf_core/caf/detail/try_match.hpp
View file @
3d2d8690
...
...
@@ -28,7 +28,6 @@
#include "caf/type_nr.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/pseudo_tuple.hpp"
namespace
caf
{
namespace
detail
{
...
...
libcaf_core/caf/detail/tuple_vals.hpp
View file @
3d2d8690
...
...
@@ -99,7 +99,8 @@ public:
// -- friend functions -------------------------------------------------------
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
tuple_vals_impl
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
tuple_vals_impl
&
x
)
{
return
apply_args
(
f
,
get_indices
(
x
.
data_
),
x
.
data_
);
}
...
...
libcaf_core/caf/detail/tuple_zip.hpp
deleted
100644 → 0
View file @
236bf701
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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_TUPLE_ZIP_HPP
#define CAF_DETAIL_TUPLE_ZIP_HPP
#include <tuple>
#include "caf/detail/int_list.hpp"
namespace
caf
{
namespace
detail
{
template
<
class
F
,
long
...
Is
,
class
Tup0
,
class
Tup1
>
auto
tuple_zip
(
F
&
f
,
detail
::
int_list
<
Is
...
>
,
Tup0
&&
tup0
,
Tup1
&&
tup1
)
->
decltype
(
std
::
make_tuple
(
f
(
get
<
Is
>
(
tup0
),
get
<
Is
>
(
tup1
))...))
{
return
std
::
make_tuple
(
f
(
get
<
Is
>
(
tup0
),
get
<
Is
>
(
tup1
))...);
}
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_TUPLE_ZIP_HPP
libcaf_core/caf/detail/type_erased_tuple_view.hpp
View file @
3d2d8690
...
...
@@ -34,7 +34,6 @@
#include "caf/detail/try_match.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/pseudo_tuple.hpp"
namespace
caf
{
namespace
detail
{
...
...
libcaf_core/caf/duration.hpp
View file @
3d2d8690
...
...
@@ -142,7 +142,7 @@ private:
/// @relates duration
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
duration
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
duration
&
x
)
{
return
f
(
x
.
unit
,
x
.
count
);
}
...
...
libcaf_core/caf/error.hpp
View file @
3d2d8690
...
...
@@ -184,7 +184,7 @@ public:
// -- friend functions -------------------------------------------------------
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
error
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
error
&
x
)
{
auto
fun
=
[
&
](
meta
::
type_name_t
x0
,
uint8_t
&
x1
,
atom_value
&
x2
,
meta
::
omittable_if_empty_t
x3
,
message
&
x4
)
->
error
{
return
f
(
x0
,
x1
,
x2
,
x3
,
x4
);
...
...
libcaf_core/caf/exit_reason.hpp
View file @
3d2d8690
...
...
@@ -51,7 +51,7 @@ enum class exit_reason : uint8_t {
};
/// Returns a string representation of given exit reason.
const
char
*
to_string
(
exit_reason
x
);
std
::
string
to_string
(
exit_reason
x
);
/// @relates exit_reason
error
make_error
(
exit_reason
);
...
...
libcaf_core/caf/group.hpp
View file @
3d2d8690
...
...
@@ -86,7 +86,7 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
group
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
group
&
x
)
{
std
::
string
x_id
;
std
::
string
x_mod
;
auto
ptr
=
x
.
get
();
...
...
libcaf_core/caf/index_mapping.hpp
View file @
3d2d8690
...
...
@@ -50,8 +50,7 @@ inline bool operator==(const index_mapping& x, const index_mapping& y) {
}
template
<
class
Inspector
>
auto
inspect
(
Inspector
&
f
,
index_mapping
&
x
)
->
decltype
(
f
(
meta
::
type_name
(
"index_mapping"
),
x
.
value
))
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
index_mapping
&
x
)
{
return
f
(
meta
::
type_name
(
"index_mapping"
),
x
.
value
);
}
...
...
libcaf_core/caf/invoke_message_result.hpp
View file @
3d2d8690
...
...
@@ -28,7 +28,7 @@ enum invoke_message_result {
im_dropped
};
constexpr
const
char
*
to_string
(
invoke_message_result
x
)
{
inline
std
::
string
to_string
(
invoke_message_result
x
)
{
return
x
==
im_success
?
"im_success"
:
(
x
==
im_skipped
?
"im_skipped"
:
"im_dropped"
);
}
...
...
libcaf_core/caf/mailbox_element.hpp
View file @
3d2d8690
...
...
@@ -92,7 +92,7 @@ protected:
/// @relates mailbox_element
template
<
class
Inspector
>
void
inspect
(
Inspector
&
f
,
mailbox_element
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
mailbox_element
&
x
)
{
return
f
(
meta
::
type_name
(
"mailbox_element"
),
x
.
sender
,
x
.
mid
,
meta
::
omittable_if_empty
(),
x
.
stages
,
x
.
content
());
}
...
...
libcaf_core/caf/match_case.hpp
View file @
3d2d8690
...
...
@@ -32,7 +32,6 @@
#include "caf/detail/int_list.hpp"
#include "caf/detail/try_match.hpp"
#include "caf/detail/type_list.hpp"
#include "caf/detail/tuple_zip.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/pseudo_tuple.hpp"
...
...
@@ -169,16 +168,10 @@ public:
typename
detail
::
il_indices
<
decayed_arg_types
>::
type
indices
;
lfinvoker
<
std
::
is_same
<
result_type
,
void
>::
value
,
F
>
fun
{
fun_
};
message
tmp
;
intermediate_pseudo_tuple
tup
{
xs
.
shared
()}
;
if
(
is_manipulator
&&
tup
.
shared_access
)
{
auto
needs_detaching
=
is_manipulator
&&
xs
.
shared
()
;
if
(
needs_detaching
)
tmp
=
message
::
copy
(
xs
);
tup
.
shared_access
=
false
;
for
(
size_t
i
=
0
;
i
<
tmp
.
size
();
++
i
)
tup
[
i
]
=
const_cast
<
void
*>
(
tmp
.
at
(
i
));
}
else
{
for
(
size_t
i
=
0
;
i
<
xs
.
size
();
++
i
)
tup
[
i
]
=
const_cast
<
void
*>
(
xs
.
get
(
i
));
}
intermediate_pseudo_tuple
tup
{
needs_detaching
?
tmp
.
content
()
:
xs
};
auto
fun_res
=
apply_args
(
fun
,
indices
,
tup
);
return
f
.
visit
(
fun_res
)
?
match_case
::
match
:
match_case
::
skip
;
}
...
...
libcaf_core/caf/message.hpp
View file @
3d2d8690
...
...
@@ -301,6 +301,16 @@ public:
return
size
()
==
(
sizeof
...(
Ts
)
+
1
)
&&
match_elements_impl
(
p0
,
list
);
}
/// @cond PRIVATE
/// @pre `! empty()`
type_erased_tuple
&
content
()
{
CAF_ASSERT
(
vals_
);
return
*
vals_
;
}
/// @endcond
private:
template
<
size_t
P
>
static
bool
match_elements_impl
(
std
::
integral_constant
<
size_t
,
P
>
,
...
...
libcaf_core/caf/message_id.hpp
View file @
3d2d8690
...
...
@@ -136,7 +136,7 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
message_id
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
message_id
&
x
)
{
return
f
(
meta
::
type_name
(
"message_id"
),
x
.
value_
);
}
...
...
libcaf_core/caf/node_id.hpp
View file @
3d2d8690
...
...
@@ -126,7 +126,8 @@ public:
explicit
node_id
(
intrusive_ptr
<
data
>
dataptr
);
template
<
class
Inspector
>
friend
detail
::
enable_if_t
<
Inspector
::
is_saving
::
value
,
error
>
friend
detail
::
enable_if_t
<
Inspector
::
is_saving
::
value
,
typename
Inspector
::
result_type
>
inspect
(
Inspector
&
f
,
node_id
&
x
)
{
data
tmp
;
data
*
ptr
=
x
?
x
.
data_
.
get
()
:
&
tmp
;
...
...
@@ -135,20 +136,19 @@ public:
}
template
<
class
Inspector
>
friend
detail
::
enable_if_t
<
Inspector
::
is_loading
::
value
,
error
>
friend
detail
::
enable_if_t
<
Inspector
::
is_loading
::
value
,
typename
Inspector
::
result_type
>
inspect
(
Inspector
&
f
,
node_id
&
x
)
{
data
tmp
;
auto
err
=
f
(
meta
::
type_name
(
"node_id"
),
tmp
.
pid_
,
auto
result
=
f
(
meta
::
type_name
(
"node_id"
),
tmp
.
pid_
,
meta
::
hex_formatted
(),
tmp
.
host_
);
if
(
!
err
)
{
if
(
!
tmp
.
valid
())
x
.
data_
.
reset
();
else
if
(
!
x
||
!
x
.
data_
->
unique
())
x
.
data_
.
reset
(
new
data
(
tmp
));
else
*
x
.
data_
=
tmp
;
}
return
err
;
return
result
;
}
/// @endcond
...
...
libcaf_core/caf/sec.hpp
View file @
3d2d8690
...
...
@@ -92,7 +92,7 @@ enum class sec : uint8_t {
};
/// @relates sec
const
char
*
to_string
(
sec
);
std
::
string
to_string
(
sec
);
/// @relates sec
error
make_error
(
sec
);
...
...
libcaf_core/caf/stream_deserializer.hpp
View file @
3d2d8690
...
...
@@ -123,8 +123,8 @@ protected:
error
apply_builtin
(
builtin
type
,
void
*
val
)
override
{
CAF_ASSERT
(
val
!=
nullptr
);
switch
(
type
)
{
case
i8_v
:
case
u8_v
:
default:
// i8_v or u8_v
CAF_ASSERT
(
type
==
i8_v
||
type
==
u8_v
);
return
apply_raw
(
sizeof
(
uint8_t
),
val
);
case
i16_v
:
case
u16_v
:
...
...
@@ -201,7 +201,7 @@ private:
template
<
class
T
>
error
apply_float
(
T
&
x
)
{
typename
detail
::
ieee_754_trait
<
T
>::
packed_type
tmp
;
typename
detail
::
ieee_754_trait
<
T
>::
packed_type
tmp
=
0
;
auto
e
=
apply_int
(
tmp
);
if
(
e
)
return
e
;
...
...
libcaf_core/caf/stream_serializer.hpp
View file @
3d2d8690
...
...
@@ -124,8 +124,8 @@ protected:
error
apply_builtin
(
builtin
type
,
void
*
val
)
override
{
CAF_ASSERT
(
val
!=
nullptr
);
switch
(
type
)
{
case
i8_v
:
case
u8_v
:
default:
// i8_v or u8_v
CAF_ASSERT
(
type
==
i8_v
||
type
==
u8_v
);
return
apply_raw
(
sizeof
(
uint8_t
),
val
);
case
i16_v
:
case
u16_v
:
...
...
libcaf_core/caf/system_messages.hpp
View file @
3d2d8690
...
...
@@ -71,7 +71,7 @@ private:
/// @relates exit_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
exit_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
exit_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"exit_msg"
),
x
.
source
,
x
.
reason
);
}
...
...
@@ -108,7 +108,7 @@ private:
/// @relates down_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
down_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
down_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"down_msg"
),
x
.
source
,
x
.
reason
);
}
...
...
@@ -120,7 +120,7 @@ struct group_down_msg {
/// @relates group_down_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
group_down_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
group_down_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"group_down_msg"
),
x
.
source
);
}
...
...
@@ -133,7 +133,7 @@ struct timeout_msg {
/// @relates timeout_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
timeout_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
timeout_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"timeout_msg"
),
x
.
timeout_id
);
}
...
...
libcaf_core/caf/type_erased_tuple.hpp
View file @
3d2d8690
...
...
@@ -174,9 +174,7 @@ private:
detail
::
type_list
<
Ts
...
>
tk
)
{
if
(
!
match_elements
<
Ts
...
>
())
return
none
;
detail
::
pseudo_tuple
<
typename
std
::
decay
<
Ts
>::
type
...
>
xs
{
shared
()};
for
(
size_t
i
=
0
;
i
<
size
();
++
i
)
xs
[
i
]
=
const_cast
<
void
*>
(
get
(
i
));
// pseud_tuple figures out const-ness
detail
::
pseudo_tuple
<
typename
std
::
decay
<
Ts
>::
type
...
>
xs
{
*
this
};
return
detail
::
apply_args
(
fun
,
detail
::
get_indices
(
tk
),
xs
);
}
...
...
@@ -185,9 +183,7 @@ private:
detail
::
type_list
<
Ts
...
>
tk
)
{
if
(
!
match_elements
<
Ts
...
>
())
return
none
;
detail
::
pseudo_tuple
<
typename
std
::
decay
<
Ts
>::
type
...
>
xs
{
shared
()};
for
(
size_t
i
=
0
;
i
<
size
();
++
i
)
xs
[
i
]
=
const_cast
<
void
*>
(
get
(
i
));
// pseud_tuple figures out const-ness
detail
::
pseudo_tuple
<
typename
std
::
decay
<
Ts
>::
type
...
>
xs
{
*
this
};
detail
::
apply_args
(
fun
,
detail
::
get_indices
(
tk
),
xs
);
return
unit
;
}
...
...
libcaf_core/caf/type_erased_value.hpp
View file @
3d2d8690
...
...
@@ -25,6 +25,7 @@
#include <functional>
#include "caf/fwd.hpp"
#include "caf/error.hpp"
#include "caf/type_nr.hpp"
namespace
caf
{
...
...
@@ -97,16 +98,12 @@ public:
};
/// @relates type_erased_value_impl
template
<
class
Inspector
>
typename
std
::
enable_if
<
Inspector
::
is_saving
::
value
,
error
>::
type
inspect
(
Inspector
&
f
,
type_erased_value
&
x
)
{
inline
error
inspect
(
serializer
&
f
,
type_erased_value
&
x
)
{
return
x
.
save
(
f
);
}
/// @relates type_erased_value_impl
template
<
class
Inspector
>
typename
std
::
enable_if
<
Inspector
::
is_loading
::
value
,
error
>::
type
inspect
(
Inspector
&
f
,
type_erased_value
&
x
)
{
inline
error
inspect
(
deserializer
&
f
,
type_erased_value
&
x
)
{
return
x
.
load
(
f
);
}
...
...
libcaf_core/caf/typed_actor.hpp
View file @
3d2d8690
...
...
@@ -242,7 +242,7 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
typed_actor
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
typed_actor
&
x
)
{
return
f
(
x
.
ptr_
);
}
...
...
libcaf_core/src/exit_reason.cpp
View file @
3d2d8690
...
...
@@ -40,7 +40,7 @@ const char* exit_reason_strings[] = {
}
// namespace <anonymous>
const
char
*
to_string
(
exit_reason
x
)
{
std
::
string
to_string
(
exit_reason
x
)
{
auto
index
=
static_cast
<
size_t
>
(
x
);
if
(
index
>
static_cast
<
size_t
>
(
exit_reason
::
unreachable
))
return
"<unknown>"
;
...
...
libcaf_core/src/sec.cpp
View file @
3d2d8690
...
...
@@ -57,7 +57,7 @@ const char* sec_strings[] = {
}
// namespace <anonymous>
const
char
*
to_string
(
sec
x
)
{
std
::
string
to_string
(
sec
x
)
{
auto
index
=
static_cast
<
size_t
>
(
x
);
if
(
index
>
static_cast
<
size_t
>
(
sec
::
bad_function_call
))
return
"<unknown>"
;
...
...
libcaf_core/test/composable_behavior.cpp
View file @
3d2d8690
...
...
@@ -121,7 +121,8 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
counting_string
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
counting_string
&
x
)
{
return
f
(
x
.
str_
);
}
...
...
libcaf_core/test/message.cpp
View file @
3d2d8690
...
...
@@ -171,7 +171,7 @@ struct s1 {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
s1
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
s1
&
x
)
{
return
f
(
x
.
value
);
}
...
...
@@ -180,7 +180,7 @@ struct s2 {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
s2
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
s2
&
x
)
{
return
f
(
x
.
value
);
}
...
...
@@ -192,7 +192,7 @@ struct s3 {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
s3
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
s3
&
x
)
{
return
f
(
x
.
value
);
}
...
...
libcaf_core/test/serialization.cpp
View file @
3d2d8690
...
...
@@ -80,7 +80,7 @@ struct raw_struct {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
raw_struct
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
raw_struct
&
x
)
{
return
f
(
x
.
str
);
}
...
...
@@ -109,7 +109,7 @@ struct test_array {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
test_array
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
test_array
&
x
)
{
return
f
(
x
.
value
,
x
.
value2
);
}
...
...
@@ -125,7 +125,7 @@ struct test_empty_non_pod {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
,
test_empty_non_pod
&
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
,
test_empty_non_pod
&
)
{
return
none
;
}
...
...
libcaf_core/test/typed_spawn.cpp
View file @
3d2d8690
...
...
@@ -85,7 +85,7 @@ struct my_request {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
my_request
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
my_request
&
x
)
{
return
f
(
x
.
a
,
x
.
b
);
}
...
...
libcaf_io/caf/io/accept_handle.hpp
View file @
3d2d8690
...
...
@@ -56,7 +56,8 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
accept_handle
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
accept_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"accept_handle"
),
x
.
id_
);
}
...
...
libcaf_io/caf/io/basp/connection_state.hpp
View file @
3d2d8690
...
...
@@ -40,7 +40,7 @@ enum connection_state {
};
/// @relates connection_state
constexpr
const
char
*
to_string
(
connection_state
x
)
{
inline
std
::
string
to_string
(
connection_state
x
)
{
return
x
==
await_header
?
"await_header"
:
(
x
==
await_payload
?
"await_payload"
:
"close_connection"
);
...
...
libcaf_io/caf/io/basp/header.hpp
View file @
3d2d8690
...
...
@@ -81,7 +81,7 @@ struct header {
/// @relates header
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
header
&
hdr
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
header
&
hdr
)
{
uint8_t
pad
=
0
;
return
f
(
meta
::
type_name
(
"header"
),
hdr
.
operation
,
...
...
libcaf_io/caf/io/broker_servant.hpp
View file @
3d2d8690
...
...
@@ -38,8 +38,8 @@ public:
:
Base
(
ptr
),
hdl_
(
x
),
value_
(
strong_actor_ptr
{},
message_id
::
make
(),
mailbox_element
::
forwarding_stack
{},
SysMsgType
{})
{
set_hdl
(
msg
(),
x
);
mailbox_element
::
forwarding_stack
{},
SysMsgType
{
x
,
{}
})
{
// nop
}
Handle
hdl
()
const
{
...
...
@@ -67,14 +67,6 @@ protected:
return
value_
.
template
get_mutable_as
<
SysMsgType
>(
0
);
}
static
void
set_hdl
(
new_connection_msg
&
lhs
,
Handle
&
hdl
)
{
lhs
.
source
=
hdl
;
}
static
void
set_hdl
(
new_data_msg
&
lhs
,
Handle
&
hdl
)
{
lhs
.
handle
=
hdl
;
}
Handle
hdl_
;
mailbox_element_vals
<
SysMsgType
>
value_
;
};
...
...
libcaf_io/caf/io/connection_handle.hpp
View file @
3d2d8690
...
...
@@ -57,7 +57,8 @@ public:
}
template
<
class
Inspector
>
friend
error
inspect
(
Inspector
&
f
,
connection_handle
&
x
)
{
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
connection_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"connection_handle"
),
x
.
id_
);
}
...
...
libcaf_io/caf/io/network/operation.hpp
View file @
3d2d8690
...
...
@@ -31,7 +31,7 @@ enum class operation {
propagate_error
};
constexpr
const
char
*
to_string
(
operation
op
)
{
inline
std
::
string
to_string
(
operation
op
)
{
return
op
==
operation
::
read
?
"read"
:
(
op
==
operation
::
write
?
"write"
:
"propagate_error"
);
...
...
libcaf_io/caf/io/network/protocol.hpp
View file @
3d2d8690
...
...
@@ -34,7 +34,7 @@ enum class protocol : uint32_t {
};
/// @relates protocol
constexpr
const
char
*
to_string
(
protocol
value
)
{
inline
std
::
string
to_string
(
protocol
value
)
{
return
value
==
protocol
::
ethernet
?
"ethernet"
:
(
value
==
protocol
::
ipv4
?
"ipv4"
:
"ipv6"
);
...
...
libcaf_io/caf/io/receive_policy.hpp
View file @
3d2d8690
...
...
@@ -20,6 +20,7 @@
#ifndef CAF_IO_RECEIVE_POLICY_HPP
#define CAF_IO_RECEIVE_POLICY_HPP
#include <string>
#include <cstddef>
#include <utility>
...
...
@@ -34,7 +35,7 @@ enum class receive_policy_flag {
exactly
};
constexpr
const
char
*
to_string
(
receive_policy_flag
x
)
{
inline
std
::
string
to_string
(
receive_policy_flag
x
)
{
return
x
==
receive_policy_flag
::
at_least
?
"at_least"
:
(
x
==
receive_policy_flag
::
at_most
?
"at_most"
:
"exactly"
);
...
...
libcaf_io/caf/io/system_messages.hpp
View file @
3d2d8690
...
...
@@ -43,7 +43,7 @@ struct new_connection_msg {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
new_connection_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
new_connection_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"new_connection_msg"
),
x
.
source
,
x
.
handle
);
}
...
...
@@ -69,7 +69,7 @@ struct new_data_msg {
/// @relates new_data_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
new_data_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
new_data_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"new_data_msg"
),
x
.
handle
,
x
.
buf
);
}
...
...
@@ -95,7 +95,7 @@ struct data_transferred_msg {
/// @relates data_transferred_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
data_transferred_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
data_transferred_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"data_transferred_msg"
),
x
.
handle
,
x
.
written
,
x
.
remaining
);
}
...
...
@@ -123,7 +123,7 @@ struct connection_closed_msg {
/// @relates connection_closed_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
connection_closed_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
connection_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"connection_closed_msg"
),
x
.
handle
);
}
...
...
@@ -147,7 +147,7 @@ struct acceptor_closed_msg {
/// @relates connection_closed_msg
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
acceptor_closed_msg
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
acceptor_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"acceptor_closed_msg"
),
x
.
handle
);
}
...
...
libcaf_io/test/typed_remote_actor.cpp
View file @
3d2d8690
...
...
@@ -40,7 +40,7 @@ struct ping {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
ping
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
ping
&
x
)
{
return
f
(
meta
::
type_name
(
"ping"
),
x
.
value
);
}
...
...
@@ -53,7 +53,7 @@ struct pong {
};
template
<
class
Inspector
>
error
inspect
(
Inspector
&
f
,
pong
&
x
)
{
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
pong
&
x
)
{
return
f
(
meta
::
type_name
(
"pong"
),
x
.
value
);
}
...
...
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