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
a7a8dc50
Commit
a7a8dc50
authored
May 12, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/forward-compatibility'
parents
a7752756
f9f35653
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
32 deletions
+127
-32
configure
configure
+40
-0
libcaf_core/caf/attach_stream_source.hpp
libcaf_core/caf/attach_stream_source.hpp
+1
-0
libcaf_core/caf/duration.hpp
libcaf_core/caf/duration.hpp
+7
-9
libcaf_core/caf/error.hpp
libcaf_core/caf/error.hpp
+32
-6
libcaf_core/caf/expected.hpp
libcaf_core/caf/expected.hpp
+11
-8
libcaf_core/caf/init_global_meta_objects.hpp
libcaf_core/caf/init_global_meta_objects.hpp
+2
-0
libcaf_core/caf/make_message.hpp
libcaf_core/caf/make_message.hpp
+0
-8
libcaf_core/caf/timespan.hpp
libcaf_core/caf/timespan.hpp
+21
-1
libcaf_core/caf/type_id.hpp
libcaf_core/caf/type_id.hpp
+13
-0
No files found.
configure
View file @
a7a8dc50
...
@@ -390,6 +390,46 @@ while [ $# -ne 0 ]; do
...
@@ -390,6 +390,46 @@ while [ $# -ne 0 ]; do
append_cache_entry CAF_ENABLE_ADDRESS_SANITIZER BOOL
yes
append_cache_entry CAF_ENABLE_ADDRESS_SANITIZER BOOL
yes
append_cache_entry CAF_ENABLE_TYPE_ID_CHECKS BOOL
yes
append_cache_entry CAF_ENABLE_TYPE_ID_CHECKS BOOL
yes
;;
;;
# "overloads" for forward compatibility with new 0.18 disable-* syntax
--disable-memory-management
)
append_cache_entry CAF_NO_MEM_MANAGEMENT BOOL
yes
;;
--disable-compiler-check
)
append_cache_entry CAF_NO_COMPILER_CHECK BOOL
yes
;;
--disable-auto-libc
++
)
append_cache_entry CAF_NO_AUTO_LIBCPP BOOL
yes
;;
--disable-exceptions
)
append_cache_entry CAF_NO_EXCEPTIONS BOOL
yes
;;
--disable-examples
)
append_cache_entry CAF_NO_EXAMPLES BOOL
yes
;;
--disable-curl-examples
)
append_cache_entry CAF_NO_CURL_EXAMPLES BOOL
yes
;;
--disable-testing
)
append_cache_entry CAF_NO_UNIT_TESTS BOOL
yes
;;
--disable-opencl
)
append_cache_entry CAF_NO_OPENCL BOOL
yes
;;
--disable-openssl
)
append_cache_entry CAF_NO_OPENSSL BOOL
yes
;;
--disable-tools
)
append_cache_entry CAF_NO_TOOLS BOOL
yes
;;
--disable-io
)
append_cache_entry CAF_NO_IO BOOL
yes
;;
--disable-python
)
append_cache_entry CAF_NO_PYTHON BOOL
yes
;;
--disable-summary
)
append_cache_entry CAF_NO_SUMMARY BOOL
yes
;;
*
)
*
)
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
exit
1
exit
1
...
...
libcaf_core/caf/attach_stream_source.hpp
View file @
a7a8dc50
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <tuple>
#include <tuple>
#include "caf/broadcast_downstream_manager.hpp"
#include "caf/broadcast_downstream_manager.hpp"
#include "caf/check_typed_input.hpp"
#include "caf/default_downstream_manager.hpp"
#include "caf/default_downstream_manager.hpp"
#include "caf/detail/stream_source_driver_impl.hpp"
#include "caf/detail/stream_source_driver_impl.hpp"
#include "caf/detail/stream_source_impl.hpp"
#include "caf/detail/stream_source_impl.hpp"
...
...
libcaf_core/caf/duration.hpp
View file @
a7a8dc50
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <stdexcept>
#include <stdexcept>
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/timespan.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -75,15 +76,6 @@ constexpr time_unit get_time_unit_from_period() {
...
@@ -75,15 +76,6 @@ constexpr time_unit get_time_unit_from_period() {
return
ratio_to_time_unit_helper
<
Period
::
num
,
Period
::
den
>::
value
;
return
ratio_to_time_unit_helper
<
Period
::
num
,
Period
::
den
>::
value
;
}
}
/// Represents an infinite amount of timeout for specifying "invalid" timeouts.
struct
infinite_t
{
constexpr
infinite_t
()
{
// nop
}
};
static
constexpr
infinite_t
infinite
=
infinite_t
{};
/// Time duration consisting of a `time_unit` and a 64 bit unsigned integer.
/// Time duration consisting of a `time_unit` and a 64 bit unsigned integer.
class
duration
{
class
duration
{
public:
public:
...
@@ -145,6 +137,12 @@ inline bool operator!=(const duration& lhs, const duration& rhs) {
...
@@ -145,6 +137,12 @@ inline bool operator!=(const duration& lhs, const duration& rhs) {
return
!
(
lhs
==
rhs
);
return
!
(
lhs
==
rhs
);
}
}
/// @relates duration
template
<
class
T
>
inline
bool
is_infinite
(
duration
x
)
{
return
!
x
.
valid
();
}
/// @relates duration
/// @relates duration
template
<
class
Clock
,
class
Duration
>
template
<
class
Clock
,
class
Duration
>
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
std
::
chrono
::
time_point
<
Clock
,
Duration
>&
...
...
libcaf_core/caf/error.hpp
View file @
a7a8dc50
...
@@ -23,7 +23,9 @@
...
@@ -23,7 +23,9 @@
#include <utility>
#include <utility>
#include "caf/atom.hpp"
#include "caf/atom.hpp"
#include "caf/config.hpp"
#include "caf/detail/comparable.hpp"
#include "caf/detail/comparable.hpp"
#include "caf/detail/pp.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/meta/omittable_if_empty.hpp"
#include "caf/meta/omittable_if_empty.hpp"
#include "caf/meta/type_name.hpp"
#include "caf/meta/type_name.hpp"
...
@@ -71,6 +73,11 @@ template <class T, class U = void>
...
@@ -71,6 +73,11 @@ template <class T, class U = void>
using
enable_if_has_error_factory_t
=
using
enable_if_has_error_factory_t
=
typename
std
::
enable_if
<
detail
::
error_factory
<
T
>::
specialized
,
U
>::
type
;
typename
std
::
enable_if
<
detail
::
error_factory
<
T
>::
specialized
,
U
>::
type
;
/// @private
template
<
class
T
,
class
U
=
void
>
using
enable_if_can_construct_error_t
=
typename
std
::
enable_if
<
detail
::
error_factory
<
T
>::
specialized
||
has_make_error
<
T
>::
value
,
U
>::
type
;
/// A serializable type for storing error codes with category and optional,
/// A serializable type for storing error codes with category and optional,
/// human-readable context information. Unlike error handling classes from
/// human-readable context information. Unlike error handling classes from
/// the C++ standard library, this type is serializable. It consists of an
/// the C++ standard library, this type is serializable. It consists of an
...
@@ -105,9 +112,9 @@ class error : detail::comparable<error> {
...
@@ -105,9 +112,9 @@ class error : detail::comparable<error> {
public:
public:
// -- member types -----------------------------------------------------------
// -- member types -----------------------------------------------------------
using
inspect_fun
=
std
::
function
<
using
inspect_fun
error
(
meta
::
type_name_t
,
uint8_t
&
,
atom_value
&
,
meta
::
omittable_if_empty_t
,
=
std
::
function
<
error
(
meta
::
type_name_t
,
uint8_t
&
,
atom_value
&
,
message
&
)
>
;
meta
::
omittable_if_empty_t
,
message
&
)
>
;
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
@@ -276,15 +283,21 @@ bool operator!=(E x, const error& y) {
...
@@ -276,15 +283,21 @@ bool operator!=(E x, const error& y) {
return
!
(
x
==
y
);
return
!
(
x
==
y
);
}
}
/// @relates error
template
<
class
Code
,
class
...
Ts
>
enable_if_has_error_factory_t
<
Code
,
error
>
make_error
(
Code
code
,
Ts
&&
...
xs
)
{
return
error
{
code
,
std
::
forward
<
Ts
>
(
xs
)...};
}
}
// namespace caf
}
// namespace caf
#define CAF_ERROR_CODE_ENUM
(enum_name)
\
#define CAF_ERROR_CODE_ENUM
_2(enum_type, category_name)
\
namespace caf { \
namespace caf { \
namespace detail { \
namespace detail { \
template <> \
template <> \
struct error_factory<enum_
nam
e> { \
struct error_factory<enum_
typ
e> { \
static constexpr bool specialized = true; \
static constexpr bool specialized = true; \
static constexpr atom_value category = atom(
#enum_name);
\
static constexpr atom_value category = atom(
category_name);
\
template <class... Ts> \
template <class... Ts> \
static message context(Ts&&... xs) { \
static message context(Ts&&... xs) { \
return make_message(std::forward<Ts>(xs)...); \
return make_message(std::forward<Ts>(xs)...); \
...
@@ -292,3 +305,16 @@ bool operator!=(E x, const error& y) {
...
@@ -292,3 +305,16 @@ bool operator!=(E x, const error& y) {
}; \
}; \
} \
} \
}
}
#define CAF_ERROR_CODE_ENUM_1(type_name) \
CAF_ERROR_CODE_ENUM_2(type_name, #type_name)
#ifdef CAF_MSVC
# define CAF_ERROR_CODE_ENUM(...) \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_ERROR_CODE_ENUM_, \
__VA_ARGS__)(__VA_ARGS__), \
CAF_PP_EMPTY())
#else
# define CAF_ERROR_CODE_ENUM(...) \
CAF_PP_OVERLOAD(CAF_ERROR_CODE_ENUM_, __VA_ARGS__)(__VA_ARGS__)
#endif
libcaf_core/caf/expected.hpp
View file @
a7a8dc50
...
@@ -91,9 +91,9 @@ public:
...
@@ -91,9 +91,9 @@ public:
construct
(
other
);
construct
(
other
);
}
}
template
<
class
Code
,
class
E
=
enable_if_has_make
_error_t
<
Code
>
>
template
<
class
Code
,
class
=
enable_if_can_construct
_error_t
<
Code
>
>
expected
(
Code
code
)
:
engaged_
(
false
)
{
expected
(
Code
code
)
:
engaged_
(
false
)
{
new
(
std
::
addressof
(
error_
))
caf
::
error
(
make_error
(
code
)
);
new
(
std
::
addressof
(
error_
))
caf
::
error
(
code
);
}
}
expected
(
expected
&&
other
)
noexcept
(
nothrow_move
)
{
expected
(
expected
&&
other
)
noexcept
(
nothrow_move
)
{
...
@@ -139,7 +139,6 @@ public:
...
@@ -139,7 +139,6 @@ public:
return
*
this
;
return
*
this
;
}
}
expected
&
operator
=
(
T
&&
x
)
noexcept
(
nothrow_move
)
{
expected
&
operator
=
(
T
&&
x
)
noexcept
(
nothrow_move
)
{
if
(
engaged_
)
{
if
(
engaged_
)
{
value_
=
std
::
move
(
x
);
value_
=
std
::
move
(
x
);
...
@@ -169,8 +168,8 @@ public:
...
@@ -169,8 +168,8 @@ public:
}
}
template
<
class
Code
>
template
<
class
Code
>
enable_if_
has_make
_error_t
<
Code
,
expected
&>
operator
=
(
Code
code
)
{
enable_if_
can_construct
_error_t
<
Code
,
expected
&>
operator
=
(
Code
code
)
{
return
*
this
=
make_error
(
code
)
;
return
*
this
=
caf
::
error
{
code
}
;
}
}
// -- modifiers --------------------------------------------------------------
// -- modifiers --------------------------------------------------------------
...
@@ -390,8 +389,8 @@ public:
...
@@ -390,8 +389,8 @@ public:
// nop
// nop
}
}
template
<
class
Code
,
class
E
=
enable_if_has_make
_error_t
<
Code
>
>
template
<
class
Code
,
class
=
enable_if_can_construct
_error_t
<
Code
>
>
expected
(
Code
code
)
:
error_
(
make_error
(
code
)
)
{
expected
(
Code
code
)
:
error_
(
code
)
{
// nop
// nop
}
}
...
@@ -402,6 +401,11 @@ public:
...
@@ -402,6 +401,11 @@ public:
return
*
this
;
return
*
this
;
}
}
template
<
class
Code
>
enable_if_can_construct_error_t
<
Code
,
expected
&>
operator
=
(
Code
code
)
{
error_
=
caf
::
error
{
code
};
}
explicit
operator
bool
()
const
{
explicit
operator
bool
()
const
{
return
!
error_
;
return
!
error_
;
}
}
...
@@ -458,4 +462,3 @@ auto operator<<(ostream& oss, const caf::expected<T>& x)
...
@@ -458,4 +462,3 @@ auto operator<<(ostream& oss, const caf::expected<T>& x)
}
}
}
// namespace std
}
// namespace std
libcaf_core/caf/init_global_meta_objects.hpp
0 → 100644
View file @
a7a8dc50
// This header only exists to make transition to CAF 0.18 easier by not having
// to use #ifdef blocks for includes.
libcaf_core/caf/make_message.hpp
View file @
a7a8dc50
...
@@ -61,14 +61,6 @@ struct is_serializable_or_whitelisted {
...
@@ -61,14 +61,6 @@ struct is_serializable_or_whitelisted {
||
allowed_unsafe_message_type
<
T
>::
value
;
||
allowed_unsafe_message_type
<
T
>::
value
;
};
};
/// @private
template
<
class
T
>
struct
has_type_id
{
static
constexpr
bool
value
=
detail
::
is_complete
<
type_id
<
T
>>::
value
||
is_atom_constant
<
T
>::
value
||
allowed_unsafe_message_type
<
T
>::
value
;
};
/// Returns a new `message` containing the values `(x, xs...)`.
/// Returns a new `message` containing the values `(x, xs...)`.
/// @relates message
/// @relates message
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
...
...
libcaf_core/caf/timespan.hpp
View file @
a7a8dc50
...
@@ -26,5 +26,25 @@ namespace caf {
...
@@ -26,5 +26,25 @@ namespace caf {
/// A portable timespan type with nanosecond resolution.
/// A portable timespan type with nanosecond resolution.
using
timespan
=
std
::
chrono
::
duration
<
int64_t
,
std
::
nano
>
;
using
timespan
=
std
::
chrono
::
duration
<
int64_t
,
std
::
nano
>
;
}
// namespace caf
/// Represents an infinite amount of timeout for specifying "invalid" timeouts.
struct
infinite_t
{
constexpr
infinite_t
()
{
// nop
}
};
/// Constant for passing "no timeout" to functions such as `request`.
static
constexpr
infinite_t
infinite
=
infinite_t
{};
// -- forward compatibility with CAF 0.18 --------------------------------------
constexpr
bool
is_infinite
(
infinite_t
)
{
return
true
;
}
template
<
class
Rep
,
class
Period
>
constexpr
bool
is_infinite
(
std
::
chrono
::
duration
<
Rep
,
Period
>
)
{
return
false
;
}
}
// namespace caf
libcaf_core/caf/type_id.hpp
View file @
a7a8dc50
...
@@ -23,7 +23,9 @@
...
@@ -23,7 +23,9 @@
#include <string>
#include <string>
#include <utility>
#include <utility>
#include "caf/allowed_unsafe_message_type.hpp"
#include "caf/atom.hpp"
#include "caf/atom.hpp"
#include "caf/detail/is_complete.hpp"
#include "caf/detail/pp.hpp"
#include "caf/detail/pp.hpp"
#include "caf/detail/squashed_int.hpp"
#include "caf/detail/squashed_int.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
...
@@ -63,6 +65,17 @@ struct type_name_by_id;
...
@@ -63,6 +65,17 @@ struct type_name_by_id;
/// The first type ID not reserved by CAF and its modules.
/// The first type ID not reserved by CAF and its modules.
constexpr
type_id_t
first_custom_type_id
=
200
;
constexpr
type_id_t
first_custom_type_id
=
200
;
/// Evaluates to `true` if any of these statements holds true:
/// - `type_id<T>` is specialized
/// - `T` is an atom constant
/// - `allowed_unsafe_message_type<T>` is specialized
template
<
class
T
>
struct
has_type_id
{
static
constexpr
bool
value
=
detail
::
is_complete
<
type_id
<
T
>>::
value
||
is_atom_constant
<
T
>::
value
||
allowed_unsafe_message_type
<
T
>::
value
;
};
}
// namespace caf
}
// namespace caf
/// Starts a code block for registering custom types to CAF. Stores the first ID
/// Starts a code block for registering custom types to CAF. Stores the first ID
...
...
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