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
5e18bc9c
Commit
5e18bc9c
authored
May 11, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add macros for backwards compatibility with 0.17.5
parent
16a23dde
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
8 deletions
+54
-8
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+2
-2
libcaf_core/caf/buffered_downstream_manager.hpp
libcaf_core/caf/buffered_downstream_manager.hpp
+1
-1
libcaf_core/caf/detail/implicit_conversions.hpp
libcaf_core/caf/detail/implicit_conversions.hpp
+1
-1
libcaf_core/caf/detail/stream_sink_impl.hpp
libcaf_core/caf/detail/stream_sink_impl.hpp
+1
-0
libcaf_core/caf/is_error_code_enum.hpp
libcaf_core/caf/is_error_code_enum.hpp
+18
-1
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+7
-1
libcaf_core/caf/timespan.hpp
libcaf_core/caf/timespan.hpp
+7
-0
libcaf_core/caf/type_id.hpp
libcaf_core/caf/type_id.hpp
+17
-2
No files found.
libcaf_core/caf/actor_system_config.hpp
View file @
5e18bc9c
...
@@ -136,7 +136,7 @@ public:
...
@@ -136,7 +136,7 @@ public:
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
actor_system_config
&
add_actor_type
(
std
::
string
name
)
{
actor_system_config
&
add_actor_type
(
std
::
string
name
)
{
using
handle
=
typename
infer_handle_from_class
<
T
>::
type
;
using
handle
=
typename
infer_handle_from_class
<
T
>::
type
;
static_assert
(
detail
::
is_complete
<
type_id
<
handle
>
>
);
static_assert
(
has_type_id_v
<
handle
>
);
return
add_actor_factory
(
std
::
move
(
name
),
make_actor_factory
<
T
,
Ts
...
>
());
return
add_actor_factory
(
std
::
move
(
name
),
make_actor_factory
<
T
,
Ts
...
>
());
}
}
...
@@ -146,7 +146,7 @@ public:
...
@@ -146,7 +146,7 @@ public:
template
<
class
F
>
template
<
class
F
>
actor_system_config
&
add_actor_type
(
std
::
string
name
,
F
f
)
{
actor_system_config
&
add_actor_type
(
std
::
string
name
,
F
f
)
{
using
handle
=
typename
infer_handle_from_fun
<
F
>::
type
;
using
handle
=
typename
infer_handle_from_fun
<
F
>::
type
;
static_assert
(
detail
::
is_complete
<
type_id
<
handle
>
>
);
static_assert
(
has_type_id_v
<
handle
>
);
return
add_actor_factory
(
std
::
move
(
name
),
make_actor_factory
(
std
::
move
(
f
)));
return
add_actor_factory
(
std
::
move
(
name
),
make_actor_factory
(
std
::
move
(
f
)));
}
}
...
...
libcaf_core/caf/buffered_downstream_manager.hpp
View file @
5e18bc9c
...
@@ -45,7 +45,7 @@ public:
...
@@ -45,7 +45,7 @@ public:
// -- sanity checks ----------------------------------------------------------
// -- sanity checks ----------------------------------------------------------
static_assert
(
detail
::
is_complete
<
type_id
<
std
::
vector
<
output_type
>
>>
);
static_assert
(
has_type_id_v
<
std
::
vector
<
output_type
>>
);
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/caf/detail/implicit_conversions.hpp
View file @
5e18bc9c
...
@@ -125,6 +125,6 @@ template <class T>
...
@@ -125,6 +125,6 @@ template <class T>
using
strip_and_convert_t
=
typename
strip_and_convert
<
T
>::
type
;
using
strip_and_convert_t
=
typename
strip_and_convert
<
T
>::
type
;
template
<
class
T
>
template
<
class
T
>
constexpr
bool
sendable
=
is_complete
<
type_id
<
strip_and_convert_t
<
T
>
>>
;
constexpr
bool
sendable
=
has_type_id_v
<
strip_and_convert_t
<
T
>>
;
}
// namespace caf::detail
}
// namespace caf::detail
libcaf_core/caf/detail/stream_sink_impl.hpp
View file @
5e18bc9c
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "caf/sec.hpp"
#include "caf/sec.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_sink.hpp"
#include "caf/stream_sink.hpp"
#include "caf/typed_message_view.hpp"
#include "caf/policy/arg.hpp"
#include "caf/policy/arg.hpp"
...
...
libcaf_core/caf/is_error_code_enum.hpp
View file @
5e18bc9c
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
#pragma once
#pragma once
#include "caf/config.hpp"
#include "caf/detail/pp.hpp"
namespace
caf
{
namespace
caf
{
/// Customization point for enabling conversion from an enum type to an
/// Customization point for enabling conversion from an enum type to an
...
@@ -33,10 +36,24 @@ constexpr bool is_error_code_enum_v = is_error_code_enum<T>::value;
...
@@ -33,10 +36,24 @@ constexpr bool is_error_code_enum_v = is_error_code_enum<T>::value;
}
// namespace caf
}
// namespace caf
#define CAF_ERROR_CODE_ENUM
(type_name)
\
#define CAF_ERROR_CODE_ENUM
_1(type_name)
\
namespace caf { \
namespace caf { \
template <> \
template <> \
struct is_error_code_enum<type_name> { \
struct is_error_code_enum<type_name> { \
static constexpr bool value = true; \
static constexpr bool value = true; \
}; \
}; \
}
}
// Exists only for backwards compatibility with 0.17.5.
#define CAF_ERROR_CODE_ENUM_2(type_name, unused) \
CAF_ERROR_CODE_ENUM_1(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/message.hpp
View file @
5e18bc9c
...
@@ -114,6 +114,12 @@ public:
...
@@ -114,6 +114,12 @@ public:
return
!
data_
;
return
!
data_
;
}
}
// -- reference counting -----------------------------------------------------
void
force_unshare
()
{
data_
.
unshare
();
}
// -- serialization ----------------------------------------------------------
// -- serialization ----------------------------------------------------------
error
save
(
serializer
&
sink
)
const
;
error
save
(
serializer
&
sink
)
const
;
...
@@ -183,7 +189,7 @@ template <class... Ts>
...
@@ -183,7 +189,7 @@ template <class... Ts>
message
make_message
(
Ts
&&
...
xs
)
{
message
make_message
(
Ts
&&
...
xs
)
{
using
namespace
detail
;
using
namespace
detail
;
static_assert
((
!
std
::
is_pointer
<
strip_and_convert_t
<
Ts
>>::
value
&&
...));
static_assert
((
!
std
::
is_pointer
<
strip_and_convert_t
<
Ts
>>::
value
&&
...));
static_assert
((
is_complete
<
type_id
<
strip_and_convert_t
<
Ts
>
>>
&&
...));
static_assert
((
has_type_id_v
<
strip_and_convert_t
<
Ts
>>
&&
...));
static
constexpr
size_t
data_size
static
constexpr
size_t
data_size
=
sizeof
(
message_data
)
+
(
padded_size_v
<
strip_and_convert_t
<
Ts
>>
+
...);
=
sizeof
(
message_data
)
+
(
padded_size_v
<
strip_and_convert_t
<
Ts
>>
+
...);
auto
types
=
make_type_id_list
<
strip_and_convert_t
<
Ts
>
...
>
();
auto
types
=
make_type_id_list
<
strip_and_convert_t
<
Ts
>
...
>
();
...
...
libcaf_core/caf/timespan.hpp
View file @
5e18bc9c
...
@@ -31,4 +31,11 @@ using timespan = std::chrono::duration<int64_t, std::nano>;
...
@@ -31,4 +31,11 @@ using timespan = std::chrono::duration<int64_t, std::nano>;
static
constexpr
timespan
infinite
static
constexpr
timespan
infinite
=
timespan
{
std
::
numeric_limits
<
int64_t
>::
max
()};
=
timespan
{
std
::
numeric_limits
<
int64_t
>::
max
()};
/// Checks whether `x` represents an infinite timespan. Timespan are considered
/// infinite if the underlying integer reached its maximum value.
template
<
class
Rep
,
class
Period
>
constexpr
bool
is_infinite
(
std
::
chrono
::
duration
<
Rep
,
Period
>
x
)
{
return
x
.
count
()
==
std
::
numeric_limits
<
int64_t
>::
max
();
}
}
// namespace caf
}
// namespace caf
libcaf_core/caf/type_id.hpp
View file @
5e18bc9c
...
@@ -84,9 +84,15 @@ constexpr const char* type_name_v = type_name<T>::value;
...
@@ -84,9 +84,15 @@ constexpr const char* type_name_v = type_name<T>::value;
/// 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
;
///
Checks whether `type_id`
is specialized for `T`.
///
Evaluates to `true` if @ref type_id
is specialized for `T`.
template
<
class
T
>
template
<
class
T
>
constexpr
bool
has_type_id
=
detail
::
is_complete
<
type_id
<
T
>>
;
struct
has_type_id
{
static
constexpr
bool
value
=
detail
::
is_complete
<
type_id
<
T
>>
;
};
/// Checks whether @ref type_id is specialized for `T`.
template
<
class
T
>
constexpr
bool
has_type_id_v
=
has_type_id
<
T
>::
value
;
}
// namespace caf
}
// namespace caf
...
@@ -189,6 +195,15 @@ constexpr bool has_type_id = detail::is_complete<type_id<T>>;
...
@@ -189,6 +195,15 @@ constexpr bool has_type_id = detail::is_complete<type_id<T>>;
} \
} \
CAF_ADD_TYPE_ID(project_name, (atom_namespace::atom_name))
CAF_ADD_TYPE_ID(project_name, (atom_namespace::atom_name))
/// Creates a new tag type (atom) and assigns the next free type ID to it.
#define CAF_ADD_ATOM_4(project_name, atom_namespace, atom_name, atom_text) \
CAF_ADD_ATOM_3(project_name, atom_namespace, atom_name) \
namespace atom_namespace { \
inline std::string to_string(atom_name) { \
return atom_text; \
} \
}
#ifdef CAF_MSVC
#ifdef CAF_MSVC
# define CAF_ADD_ATOM(...) \
# define CAF_ADD_ATOM(...) \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_ADD_ATOM_, __VA_ARGS__)(__VA_ARGS__), \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_ADD_ATOM_, __VA_ARGS__)(__VA_ARGS__), \
...
...
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