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
8996b00c
Commit
8996b00c
authored
Jul 30, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve backwards compatibility with 0.17
parent
2266cbe9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
115 additions
and
6 deletions
+115
-6
libcaf_core/caf/detail/assign_inspector_try_result.hpp
libcaf_core/caf/detail/assign_inspector_try_result.hpp
+44
-0
libcaf_core/caf/detail/stream_sink_impl.hpp
libcaf_core/caf/detail/stream_sink_impl.hpp
+2
-2
libcaf_core/caf/is_error_code_enum.hpp
libcaf_core/caf/is_error_code_enum.hpp
+19
-1
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+6
-0
libcaf_core/caf/read_inspector.hpp
libcaf_core/caf/read_inspector.hpp
+2
-1
libcaf_core/caf/timespan.hpp
libcaf_core/caf/timespan.hpp
+5
-0
libcaf_core/caf/type_id.hpp
libcaf_core/caf/type_id.hpp
+28
-1
libcaf_core/caf/write_inspector.hpp
libcaf_core/caf/write_inspector.hpp
+2
-1
libcaf_openssl/caf/openssl/manager.hpp
libcaf_openssl/caf/openssl/manager.hpp
+3
-0
libcaf_openssl/src/openssl/manager.cpp
libcaf_openssl/src/openssl/manager.cpp
+4
-0
No files found.
libcaf_core/caf/detail/assign_inspector_try_result.hpp
0 → 100644
View file @
8996b00c
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2020 Dominik Charousset *
* *
* 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. *
******************************************************************************/
#pragma once
#include "caf/error.hpp"
#include "caf/error_code.hpp"
#include "caf/sec.hpp"
#include "caf/type_id.hpp"
namespace
caf
::
detail
{
template
<
class
T
>
void
assign_inspector_try_result
(
error
&
x
,
T
&&
y
)
{
x
=
std
::
forward
<
T
>
(
y
);
}
inline
void
assign_inspector_try_result
(
error_code
<
sec
>&
x
,
const
error
&
y
)
{
if
(
y
.
category
()
==
type_id_v
<
sec
>
)
x
=
static_cast
<
sec
>
(
y
.
code
());
else
x
=
sec
::
runtime_error
;
}
inline
void
assign_inspector_try_result
(
error_code
<
sec
>&
x
,
error_code
<
sec
>
y
)
{
x
=
y
;
}
}
// namespace caf::detail
libcaf_core/caf/detail/stream_sink_impl.hpp
View file @
8996b00c
...
...
@@ -22,11 +22,11 @@
#include "caf/logger.hpp"
#include "caf/make_counted.hpp"
#include "caf/message_id.hpp"
#include "caf/policy/arg.hpp"
#include "caf/sec.hpp"
#include "caf/stream_manager.hpp"
#include "caf/stream_sink.hpp"
#include "caf/policy/arg.hpp"
#include "caf/typed_message_view.hpp"
namespace
caf
::
detail
{
...
...
libcaf_core/caf/is_error_code_enum.hpp
View file @
8996b00c
...
...
@@ -18,6 +18,8 @@
#pragma once
#include "caf/detail/pp.hpp"
namespace
caf
{
/// Customization point for enabling conversion from an enum type to an
...
...
@@ -33,10 +35,26 @@ constexpr bool is_error_code_enum_v = is_error_code_enum<T>::value;
}
// namespace caf
#define CAF_ERROR_CODE_ENUM(type_name) \
// TODO: the overload with two arguments exists only for backwards compatibility
// with CAF 0.17. Remove with CAF 0.19.
#define CAF_ERROR_CODE_ENUM_1(type_name) \
namespace caf { \
template <> \
struct is_error_code_enum<type_name> { \
static constexpr bool value = true; \
}; \
}
#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 @
8996b00c
...
...
@@ -167,6 +167,12 @@ public:
data_
.
reset
(
new_ptr
,
add_ref
);
}
/// Forces the message to copy its content if more than one reference to the
/// content exists.
void
force_unshare
()
{
data_
.
unshare
();
}
private:
data_ptr
data_
;
};
...
...
libcaf_core/caf/read_inspector.hpp
View file @
8996b00c
...
...
@@ -21,6 +21,7 @@
#include <type_traits>
#include "caf/allowed_unsafe_message_type.hpp"
#include "caf/detail/assign_inspector_try_result.hpp"
#include "caf/detail/inspect.hpp"
#include "caf/detail/squashed_int.hpp"
#include "caf/detail/type_traits.hpp"
...
...
@@ -34,7 +35,7 @@
statement; \
} else { \
if (auto err = statement) { \
result = err;
\
detail::assign_inspector_try_result(result, std::move(err));
\
return false; \
} \
}
...
...
libcaf_core/caf/timespan.hpp
View file @
8996b00c
...
...
@@ -31,4 +31,9 @@ using timespan = std::chrono::duration<int64_t, std::nano>;
static
constexpr
timespan
infinite
=
timespan
{
std
::
numeric_limits
<
int64_t
>::
max
()};
/// Checks whether `value` represents an infinite amount of time.
constexpr
bool
is_infinite
(
timespan
value
)
{
return
value
==
infinite
;
}
}
// namespace caf
libcaf_core/caf/type_id.hpp
View file @
8996b00c
...
...
@@ -86,7 +86,13 @@ constexpr type_id_t first_custom_type_id = 200;
/// Checks whether `type_id` is specialized for `T`.
template
<
class
T
>
constexpr
bool
has_type_id
=
detail
::
is_complete
<
type_id
<
T
>>
;
constexpr
bool
has_type_id_v
=
detail
::
is_complete
<
type_id
<
T
>>
;
// TODO: remove with CAF 0.19 (this exists for compatibility with CAF 0.17).
template
<
class
T
>
struct
has_type_id
{
static
constexpr
bool
value
=
detail
::
is_complete
<
type_id
<
T
>>
;
};
}
// namespace caf
...
...
@@ -189,6 +195,27 @@ constexpr bool has_type_id = detail::is_complete<type_id<T>>;
} \
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) \
namespace atom_namespace { \
struct atom_name {}; \
static constexpr atom_name atom_name##_v = atom_name{}; \
[[maybe_unused]] constexpr bool operator==(atom_name, atom_name) { \
return true; \
} \
[[maybe_unused]] constexpr bool operator!=(atom_name, atom_name) { \
return false; \
} \
inline std::string to_string(atom_name) { \
return atom_text; \
} \
template <class Inspector> \
auto inspect(Inspector& f, atom_name&) { \
return f(caf::meta::type_name(#atom_namespace "::" #atom_name)); \
} \
} \
CAF_ADD_TYPE_ID(project_name, (atom_namespace::atom_name))
#ifdef CAF_MSVC
# define CAF_ADD_ATOM(...) \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_ADD_ATOM_, __VA_ARGS__)(__VA_ARGS__), \
...
...
libcaf_core/caf/write_inspector.hpp
View file @
8996b00c
...
...
@@ -24,6 +24,7 @@
#include <utility>
#include "caf/allowed_unsafe_message_type.hpp"
#include "caf/detail/assign_inspector_try_result.hpp"
#include "caf/detail/inspect.hpp"
#include "caf/detail/squashed_int.hpp"
#include "caf/detail/type_traits.hpp"
...
...
@@ -36,7 +37,7 @@
statement; \
} else { \
if (auto err = statement) { \
result = err;
\
detail::assign_inspector_try_result(result, std::move(err));
\
return false; \
} \
}
...
...
libcaf_openssl/caf/openssl/manager.hpp
View file @
8996b00c
...
...
@@ -72,6 +72,9 @@ public:
/// default network backend.
static
actor_system
::
module
*
make
(
actor_system
&
,
detail
::
type_list
<>
);
/// Adds message types of the OpenSSL module to the global meta object table.
static
void
init_global_meta_objects
();
private:
/// Private since instantiation is only allowed via `make`.
manager
(
actor_system
&
sys
);
...
...
libcaf_openssl/src/openssl/manager.cpp
View file @
8996b00c
...
...
@@ -174,6 +174,10 @@ actor_system::module* manager::make(actor_system& sys, detail::type_list<>) {
return
new
manager
(
sys
);
}
void
manager
::
init_global_meta_objects
()
{
// nop
}
manager
::
manager
(
actor_system
&
sys
)
:
system_
(
sys
)
{
// nop
}
...
...
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