mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
callback.hpp File Reference
#include <atomic>
#include <concepts>
#include <functional>
#include <memory>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <variant>
#include "mrs_lib/coro/task.hpp"
#include "mrs_lib/utility/meta.hpp"
#include "mrs_lib/utility/scope_cleanup.hpp"
Include dependency graph for callback.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mrs_lib::coro_callback_tags::Reentrant
 Policy tag for reentrant CoroCallback. More...
class  mrs_lib::coro_callback_tags::CancelNew< CallbackRetType >
 Policy tag for CoroCallback ignores new callbacks, when another is already running. More...
class  mrs_lib::coro_callback_tags::CancelNew< void >
 Void specialization of CancelNew. More...
class  mrs_lib::coro_callback_tags::CancelNewDefault
 Policy tag for CoroCallback ignores new callbacks, when another is already running. More...
class  mrs_lib::CoroCallback<... >
 Base template for CoroCallback. More...
class  mrs_lib::CoroCallback< CallbackRetType(CallbackArgs...)>
 Wrapper for safe binding of coroutines to use as callbacks. More...
struct  mrs_lib::internal::CallbackSignature< Ret, meta::TypeList< Params... >, meta::TypeList< Args... > >
 Type trait to determine the signature of a callback function. More...

Namespaces

namespace  mrs_lib
 All mrs_lib functions, classes, variables and definitions are contained in this namespace.
namespace  mrs_lib::coro_callback_tags
 Namespace for tag types used in CoroCallback.

Typedefs

template<typename CallbackRetType>
using mrs_lib::CoroReentrantPolicyVariant = std::variant<coro_callback_tags::Reentrant, coro_callback_tags::CancelNew<CallbackRetType>>
 Variant of CoroCallback reentrancy policies.
template<typename Ret, typename Params, typename Args>
using mrs_lib::internal::CallbackSignatureT = CallbackSignature<Ret, Params, Args>::type
 Helper type alias for CallbackSignature<Ret, Params, Args>::type.

Functions

template<typename F>
 mrs_lib::coro_callback_tags::CancelNew (F) -> CancelNew< std::invoke_result_t< F > >
 Deduction guide to deduce CancelNew type from factory function.
template<typename R, typename... Params, typename... Args, bool Noexcept>
 mrs_lib::CoroCallback (auto, mrs_lib::Task< R >(*)(Params...) noexcept(Noexcept), Args &&...) -> CoroCallback< internal::CallbackSignatureT< R, meta::TypeList< Params... >, meta::TypeList< Args... > > >
 Deduction guide for free functions.
template<typename C1, typename C2, typename R, typename... Params, typename... Args, bool Noexcept>
 mrs_lib::CoroCallback (auto, mrs_lib::Task< R >(C1::*)(Params...) noexcept(Noexcept), C2, Args &&...) -> CoroCallback< internal::CallbackSignatureT< R, meta::TypeList< Params... >, meta::TypeList< Args... > > >
 Deduction guide for non const member functions.

Typedef Documentation

◆ CallbackSignatureT

template<typename Ret, typename Params, typename Args>
using mrs_lib::internal::CallbackSignatureT = CallbackSignature<Ret, Params, Args>::type

Helper type alias for CallbackSignature<Ret, Params, Args>::type.

Template Parameters
RetReturn type of the callback.
ParamsParameter types of the callback.
ArgsArgument types to bind to the callback.