Fix and apply proper version comments

This commit is contained in:
Denis Blank 2018-02-06 02:18:28 +01:00
parent 72974d402e
commit a167261e00
6 changed files with 52 additions and 38 deletions

View File

@ -70,7 +70,7 @@ namespace cti {
/// call the continuable_base::freeze method for disabling the
/// invocation on destruction.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename Data, typename Annotation>
class continuable_base {
@ -129,7 +129,7 @@ public:
/// The continuable_base::freeze method disables the automatic
/// invocation on destruction without invalidating the object.
///
/// \since version 1.0.0
/// \since 1.0.0
~continuable_base() {
if (ownership_.is_acquired() && !ownership_.is_frozen()) {
std::move(*this).done();
@ -218,7 +218,7 @@ public:
/// .then([](std::string atom) { }); // <std::string>
/// ```
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename T, typename E = detail::types::this_thread_executor_tag>
auto then(T&& callback,
E&& executor = detail::types::this_thread_executor_tag{}) && {
@ -246,7 +246,7 @@ public:
/// \returns Returns a continuable_base representing the next asynchronous
/// result to continue within the asynchronous call hierarchy.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename OData, typename OAnnotation>
auto then(continuable_base<OData, OAnnotation>&& continuation) && {
return std::move(*this).then(
@ -291,7 +291,7 @@ public:
/// depending on the previous result type.
///
///
/// \since version 2.0.0
/// \since 2.0.0
template <typename T, typename E = detail::types::this_thread_executor_tag>
auto fail(T&& callback,
E&& executor = detail::types::this_thread_executor_tag{}) && {
@ -316,7 +316,7 @@ public:
/// \returns Returns a continuable_base with an asynchronous return type
/// depending on the previous result type.
///
/// \since version 2.0.0
/// \since 2.0.0
template <typename OData, typename OAnnotation>
auto fail(continuable_base<OData, OAnnotation>&& continuation) && {
continuation.freeze();
@ -350,7 +350,7 @@ public:
/// \returns Returns a continuable_base with an asynchronous return type
/// depending on the current result type.
///
/// \since version 2.0.0
/// \since 2.0.0
template <typename T, typename E = detail::types::this_thread_executor_tag>
auto next(T&& callback,
E&& executor = detail::types::this_thread_executor_tag{}) && {
@ -368,7 +368,7 @@ public:
/// \returns Returns the result of the given transform when this
/// continuable is passed into it.
///
/// \since version 2.0.0
/// \since 2.0.0
template <typename T>
auto apply(T&& transform) && {
return std::forward<T>(transform)(std::move(*this).materialize());
@ -381,7 +381,7 @@ public:
/// \returns See the corresponding continuable_base::then method for the
/// explanation of the return type.
///
/// \since version 2.0.0
/// \since 2.0.0
template <typename T>
auto operator|(T&& right) && {
return std::move(*this).then(std::forward<T>(right));
@ -420,7 +420,7 @@ public:
/// Sequential invocation is also supported through the
/// continuable_base::operator>> method.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename OData, typename OAnnotation>
auto operator&&(continuable_base<OData, OAnnotation>&& right) && {
return detail::composition::connect(detail::composition::strategy_all_tag{},
@ -462,7 +462,7 @@ public:
/// current thread, however, the callback is only called once with
/// the first result which becomes available.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename OData, typename OAnnotation>
auto operator||(continuable_base<OData, OAnnotation>&& right) && {
return detail::composition::connect(detail::composition::strategy_any_tag{},
@ -490,7 +490,7 @@ public:
/// current thread. Parallel invocation is also supported through the
/// continuable_base::operator&& method.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename OData, typename OAnnotation>
auto operator>>(continuable_base<OData, OAnnotation>&& right) && {
return detail::composition::sequential_connect(std::move(*this),
@ -506,7 +506,7 @@ public:
/// \attention This method will trigger an assertion if the
/// continuable_base was released already.
///
/// \since version 1.0.0
/// \since 1.0.0
void done() && {
detail::base::finalize_continuation(std::move(*this));
}
@ -520,7 +520,7 @@ public:
/// \attention This method will trigger an assertion if the
/// continuable_base was released already.
///
/// \since version 1.0.0
/// \since 1.0.0
bool is_frozen() const noexcept {
assert_acquired();
return ownership_.is_frozen();
@ -541,7 +541,7 @@ public:
/// \attention This method will trigger an assertion if the
/// continuable_base was released already.
///
/// \since version 1.0.0
/// \since 1.0.0
continuable_base& freeze(bool enabled = true) & noexcept {
ownership_.freeze(enabled);
return *this;
@ -674,7 +674,7 @@ private:
/// \note You should always turn the callback into a r-value if possible
/// (`std::move` or `std::forward`) for qualifier correct invokation.
///
/// \since version 1.0.0
/// \since 1.0.0
template <typename... Args, typename Continuation>
auto make_continuable(Continuation&& continuation) {
auto hint = detail::composition::annotating::extract(
@ -707,7 +707,7 @@ auto make_continuable(Continuation&& continuation) {
///
/// \note see continuable::next for details.
///
/// \since version 2.0.0
/// \since 2.0.0
using detail::types::dispatch_error_tag;
/// Represents the type that is used as error type
@ -718,7 +718,7 @@ using detail::types::dispatch_error_tag;
/// A custom error type may be set through
/// defining `CONTINUABLE_WITH_CUSTOM_ERROR_TYPE`.
///
/// \since version 2.0.0
/// \since 2.0.0
using detail::types::error_type;
/// Connects the given continuables with an *all* logic.
@ -728,7 +728,7 @@ using detail::types::error_type;
///
/// \see continuable_base::operator && for details.
///
/// \since version 1.1.0
/// \since 1.1.0
template <typename... Continuables>
auto when_all(Continuables&&... continuables) {
static_assert(sizeof...(continuables) >= 2,
@ -744,7 +744,7 @@ auto when_all(Continuables&&... continuables) {
///
/// \see continuable_base::operator|| for details.
///
/// \since version 1.1.0
/// \since 1.1.0
template <typename... Continuables>
auto when_any(Continuables&&... continuables) {
static_assert(sizeof...(continuables) >= 2,
@ -760,7 +760,7 @@ auto when_any(Continuables&&... continuables) {
///
/// \see continuable_base::operator>> for details.
///
/// \since version 1.1.0
/// \since 1.1.0
template <typename... Continuables>
auto when_seq(Continuables&&... continuables) {
static_assert(sizeof...(continuables) >= 2,

View File

@ -45,7 +45,7 @@ namespace cti {
/// Use the promise type defined in `continuable/continuable_types.hpp`,
/// in order to use this class.
///
/// \since version 2.0.0
/// \since 2.0.0
// clang-format off
template <typename Data, typename Hint>
class promise_base
@ -75,13 +75,13 @@ public:
/// Resolves the continuation with the given values
///
/// \since version 2.0.0
/// \since 2.0.0
void operator()(Args... args) && {
std::move(data_)(std::move(args)...);
}
/// Resolves the continuation with the given exception
///
/// \since version 2.0.0
/// \since 2.0.0
void operator()(detail::types::dispatch_error_tag tag,
detail::types::error_type exception) && {
std::move(data_)(tag, std::move(exception));
@ -89,14 +89,14 @@ public:
/// Resolves the continuation with the given values
///
/// \since version 2.0.0
/// \since 2.0.0
void set_value(Args... args) {
std::move(data_)(std::move(args)...);
}
/// Resolves the continuation with the given exception
///
/// \since version 2.0.0
/// \since 2.0.0
void set_exception(detail::types::error_type exception) {
std::move(data_)(detail::types::dispatch_error_tag{}, std::move(exception));
}

View File

@ -37,21 +37,21 @@
/// Asserts that the final callback of the given continuable was called
/// with any result.
///
/// \since version 1.0.0
/// \since 1.0.0
#define ASSERT_ASYNC_COMPLETION(CONTINUABLE) \
cti::detail::testing::assert_async_completion(CONTINUABLE);
/// Asserts that the final callback of the given continuable was called
/// with any exceptional result.
///
/// \since version 2.0.0
/// \since 2.0.0
#define ASSERT_ASYNC_EXCEPTION_COMPLETION(CONTINUABLE) \
cti::detail::testing::assert_async_exception_completion(CONTINUABLE);
/// Asserts that the final callback of the given continuable is never called
/// with any result.
///
/// \since version 1.0.0
/// \since 1.0.0
#define ASSERT_ASYNC_INCOMPLETION(CONTINUABLE) \
cti::detail::testing::assert_async_never_completed(CONTINUABLE);
@ -87,7 +87,7 @@
/// \note This macro is mainly present for building other assertions
/// relying on custom validation logic.
///
/// \since version 1.0.0
/// \since 1.0.0
#define ASSERT_ASYNC_BINARY_VALIDATION(VALIDATOR, ...) \
cti::detail::testing::assert_async_binary_validation(VALIDATOR, __VA_ARGS__);
@ -98,7 +98,7 @@
/// \note This macro is mainly present for building other assertions
/// relying on custom validation logic.
///
/// \since version 2.0.0
/// \since 2.0.0
#define ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION(VALIDATOR, ...) \
cti::detail::testing::assert_async_binary_exception_validation(VALIDATOR, \
__VA_ARGS__);
@ -112,14 +112,14 @@
/// EXPECT_ASYNC_RESULT(async_get("hello"), "hello");
/// ```
///
/// \since version 1.0.0
/// \since 1.0.0
#define EXPECT_ASYNC_RESULT(...) \
ASSERT_ASYNC_BINARY_VALIDATION(cti::detail::testing::expecting_eq_check(), \
__VA_ARGS__)
/// Asserts that the continuable is finished with the given exception
///
/// \since version 2.0.0
/// \since 2.0.0
#define EXPECT_ASYNC_EXCEPTION_RESULT(...) \
ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION( \
cti::detail::testing::expecting_eq_check(), __VA_ARGS__)
@ -133,7 +133,7 @@
/// ASSERT_ASYNC_RESULT(async_get("hello"), "hello");
/// ```
///
/// \since version 1.0.0
/// \since 1.0.0
#define ASSERT_ASYNC_RESULT(...) \
ASSERT_ASYNC_BINARY_VALIDATION(cti::detail::testing::asserting_eq_check(), \
__VA_ARGS__)
@ -150,14 +150,14 @@
///
/// \note This is a compile-time assertion.
///
/// \since version 1.0.0
/// \since 1.0.0
#define ASSERT_ASYNC_TYPES(CONTINUABLE, ...) \
cti::detail::testing::assert_async_types( \
CONTINUABLE, cti::detail::traits::identity<__VA_ARGS__>{})
/// Asserts that the continuable is finished with the given exception
///
/// \since version 2.0.0
/// \since 2.0.0
#define ASSERT_ASYNC_EXCEPTION_RESULT(...) \
ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION( \
cti::detail::testing::asserting_eq_check(), __VA_ARGS__)

View File

@ -59,7 +59,7 @@ namespace transforms {
/// call chain!
/// Otherwise this will yield a trap that causes application exit.
///
/// \since version 2.0.0
/// \since 2.0.0
inline auto futurize() {
return [](auto&& continuable) {
using detail::transforms::as_future;
@ -75,7 +75,7 @@ inline auto futurize() {
/// \attention This can be used to create a continuable which doesn't resolve
/// the continuation on errors.
///
/// \since version 2.0.0
/// \since 2.0.0
inline auto flatten() {
return [](auto&& continuable) {
return std::forward<decltype(continuable)>(continuable).fail([](auto&&) {});

View File

@ -38,16 +38,24 @@
namespace cti {
/// A tag which is passed to the `operator()` of the visitor
/// if an element is visited synchronously.
///
/// \since 3.0.0
using detail::traversal::async_traverse_visit_tag;
/// A tag which is passed to the `operator()` of the visitor
/// if an element is visited after the traversal was detached.
///
/// \since 3.0.0
using detail::traversal::async_traverse_detach_tag;
/// A tag which is passed to the `operator()` of the visitor
/// if the asynchronous pack traversal was finished.
///
/// \since 3.0.0
using detail::traversal::async_traverse_complete_tag;
/// A tag to identify that a mapper shall be constructed in-place
/// from the first argument passed.
///
/// \since 3.0.0
using detail::traversal::async_traverse_in_place_tag;
/// Traverses the pack with the given visitor in an asynchronous way.
@ -103,6 +111,7 @@ using detail::traversal::async_traverse_in_place_tag;
/// See `traverse_pack` for a detailed description about the
/// traversal behaviour and capabilities.
///
/// \since 3.0.0
template <typename Visitor, typename... T>
auto traverse_pack_async(Visitor&& visitor, T&&... pack) {
return detail::traversal::apply_pack_transform_async(

View File

@ -69,6 +69,7 @@ namespace cti {
/// multiple elements, the pack is wrapped into
/// a `std::tuple`.
///
/// \since 3.0.0
template <typename Mapper, typename... T>
auto map_pack(Mapper&& mapper, T&&... pack) {
return detail::traversal::transform(detail::traversal::strategy_remap_tag{},
@ -79,6 +80,8 @@ auto map_pack(Mapper&& mapper, T&&... pack) {
/// Indicate that the result shall be spread across the parent container
/// if possible. This can be used to create a mapper function used
/// in map_pack that maps one element to an arbitrary count (1:n).
///
/// \since 3.0.0
template <typename... T>
constexpr auto spread_this(T&&... args) noexcept(
noexcept(std::make_tuple(std::forward<T>(args)...))) {
@ -92,6 +95,8 @@ constexpr auto spread_this(T&&... args) noexcept(
/// however, the result of the mapper isn't preserved.
///
/// See `map_pack` for a detailed description.
///
/// \since 3.0.0
template <typename Mapper, typename... T>
void traverse_pack(Mapper&& mapper, T&&... pack) {
detail::traversal::transform(detail::traversal::strategy_traverse_tag{},