Core utility functions of the library.
Functions | |
| template<typename Operation > | |
| constexpr auto | ozo::get_operation_initiator (const Operation &op) |
| Get asynchronous operation initiator. More... | |
| template<typename Operation , typename Factory > | |
| constexpr auto | ozo::construct_initiator (Factory &&f, const Operation &op) |
| Create asynchronous operation initiator using factory. More... | |
| template<typename T > | |
| constexpr decltype(auto) | ozo::is_null (const T &v) noexcept(noexcept(is_null_impl< T >::apply(v))) |
| Indicates if value is in null state. More... | |
| template<typename T , typename Alloc > | |
| void | ozo::allocate_nullable (T &out, const Alloc &a) |
| Allocates nullable object of given type. More... | |
| template<typename Map , typename Key > | |
| constexpr decltype(auto) | ozo::get_option (Map &&map, ozo::option< Key > op) |
| Get the option object from Hana.Map. More... | |
| template<typename Map , typename Key , typename T > | |
| constexpr decltype(auto) | ozo::get_option (Map &&map, ozo::option< Key > op, T &&default_) |
| Get the option object from Hana.Map. More... | |
| template<typename ... Options> | |
| constexpr auto | ozo::make_options (Options &&...opts) |
| Constructor for options map. More... | |
| template<typename T > | |
| constexpr decltype(auto) | ozo::unwrap_recursive (T &&v) noexcept |
| Unwraps argument underlying value recursively. More... | |
| template<typename T > | |
| constexpr bool | ozo::is_null_recursive (T &&v) noexcept |
| Indicates if one of unwrapped values is in null state. More... | |
| template<typename T > | |
| constexpr decltype(auto) | ozo::unwrap (T &&v) noexcept(noexcept(unwrap_impl< std::decay_t< T >>::apply(std::forward< T >(v)))) |
| Unwraps argument underlying value or forwards the argument. More... | |
| constexpr time_traits::time_point | ozo::deadline (time_traits::time_point t) noexcept |
| Dealdine calculation. More... | |
| constexpr time_traits::time_point | ozo::deadline (time_traits::duration after, time_traits::time_point now) noexcept |
| Dealdine calculation. More... | |
| time_traits::time_point | ozo::deadline (time_traits::duration after) noexcept |
| Dealdine calculation. More... | |
| constexpr auto | ozo::deadline (none_t) noexcept |
| Dealdine calculation. More... | |
| constexpr time_traits::duration | ozo::time_left (time_traits::time_point t, time_traits::time_point now) noexcept |
| Time left to deadline. More... | |
| time_traits::duration | ozo::time_left (time_traits::time_point t) noexcept |
| Time left to deadline. More... | |
| bool | ozo::expired (time_traits::time_point t, time_traits::time_point now) noexcept |
| Deadline is expired. More... | |
| bool | ozo::expired (time_traits::time_point t) noexcept |
| Deadline is expired. More... | |
| void ozo::allocate_nullable | ( | T & | out, |
| const Alloc & | a | ||
| ) |
Allocates nullable object of given type.
This function allocates memory and constructs nullable object of given type by means of given allocator if applicable. It uses ozo::allocate_nullable_impl functional object as an implementation.
| out | — object to allocate to |
| a | — allocator to use |
|
constexpr |
Create asynchronous operation initiator using factory.
The function constructs asynchronous operation initiator using factory object. The default behaviour is static assertion. The behaviour should be customized for a particular factory.
| f | — factory for asynchronous operation initiator object. |
| op | — asynchronous operation object. |
Default implementation is static assertion
|
constexprnoexcept |
Dealdine calculation.
Calculates deadline from ozo::none_t.
| none_t |
ozo::none References ozo::none.
Referenced by ozo::deadline().
|
noexcept |
Dealdine calculation.
Calculates deadline time point in a given duration from now. The result value is limited by time_traits::time_point::max(). Literally: time_traits::now() + after.
| after | — duration to a deadline time point |
References ozo::deadline(), and ozo::time_traits::now().
|
constexprnoexcept |
Dealdine calculation.
Calculates deadline time point in a given duration from a given time point. The result value range is [now, time_traits::time_point::max()]. Literally: now + after.
| after | — duration to a deadline time point |
| now | — start time point for the duration |
|
constexprnoexcept |
Dealdine calculation.
Calculate deadline from time point. Literally returns it's argument.
| t | — time point of a deadline |
Referenced by ozo::failover::retry_strategy< Options >::get_first_try().
|
noexcept |
Deadline is expired.
Indicates if a given dedline is expired. Deadline is expired then time left duration to the deadline is 0.
| t | — deadline time point |
References ozo::time_traits::now().
|
noexcept |
Deadline is expired.
Indicates if a given dedline is expired for a given time point. Deadline is expired then time left duration to the deadline is 0.
| t | — deadline time point |
References ozo::time_left().
|
constexpr |
Get asynchronous operation initiator.
Initiator is a functional object which may be used with boost::asio::async_initiate to start an asynchronous operation. Typically this is detail zone of an operation, but in OZO this is a part of operations customization for extentions like failover.
| op | — asynchronous operation object |
The function is implemented via ozo::get_operation_initiator_impl. The default implementation is:
So this behaviour may be changed via specialization of the template.
Referenced by ozo::begin(), ozo::execute(), ozo::get_connection(), and ozo::request().
|
constexpr |
Get the option object from Hana.Map.
This function is similar to map[op] call, but it makes a static assert that map should contain an option. This produces human readable compile error in case of no option found.
| map | — map to get option from |
| op | — the option |
Referenced by ozo::failover::basic_try< Options, Context >::get_conditions(), ozo::failover::basic_try< Options, Context >::get_next_try(), ozo::get_transaction_deferrability(), ozo::get_transaction_isolation_level(), ozo::get_transaction_mode(), and ozo::failover::basic_try< Options, Context >::tries_remain().
|
constexpr |
Get the option object from Hana.Map.
This function is similar to map[op] call, but returns default value if no such option has been found.
| map | — map to get option from |
| op | — the option |
| default_ | — the default value for the option which is not found |
Referenced by ozo::options_factory_base< options_factory< decltype(hana::make_map()) >, decltype(hana::make_map()) >::get().
|
constexprnoexcept |
Indicates if value is in null state.
This utility function indicates if given value is in null state. If argument is not #Nullable it always returns false
| value | — object to examine |
true — object is in null-state, false — overwise. Referenced by ozo::send(), and ozo::size_of().
|
constexprnoexcept |
Indicates if one of unwrapped values is in null state.
This utility function recursively examines the value for a null state. The function is useful to examine Connection object for a null state because it is normal for such object to be wrapped.
The function is equal to this pesudo-code:
| v | — object to examine |
true — one of the objects is in null-state, false — overwise.Referenced by ozo::defer_close_connection(), and ozo::error_message().
|
constexpr |
Constructor for options map.
This function is a semantic wrapper for boost::hana::make_map.
| opts | — pairs of options and its' values |
boost::hana::map
|
noexcept |
Time left to deadline.
Calculates time left to a given deadline time point.
| t | — deadline time point |
References ozo::time_traits::now().
Referenced by ozo::expired().
|
constexprnoexcept |
Time left to deadline.
Calculates time left form given now time point to a given deadline time point t.
| t | — deadline time point |
| now | — time point to calculate duration from |
|
constexprnoexcept |
Unwraps argument underlying value or forwards the argument.
This utility function returns underlying value of it's argument as defined by the operation implementation ozo::unwrap_impl.
In-library implementations returns:
std::reference_wrapper and other types like pointers, optional values which are defined via External adaptors,| value | — object to unwrap |
unwrap_impl<std::decay_t<T>>::apply(std::forward<T>(v)) call Referenced by ozo::pooled_connection< Rep, Executor >::close(), ozo::failover::basic_try< Options, Context >::get_context(), ozo::pooled_connection< Rep, Executor >::get_error_context(), ozo::failover::get_next_try(), ozo::failover::get_try_context(), ozo::failover::initiate_next_try(), ozo::transaction< Connection, Options >::lowest_layer(), ozo::pooled_connection< Rep, Executor >::native_handle(), ozo::pooled_connection< Rep, Executor >::oid_map(), ozo::failover::role_based_connection_provider< Source >::rebind_role(), ozo::send(), and ozo::size_of().
|
constexprnoexcept |
Unwraps argument underlying value recursively.
This utility function unwraps argument recursively applying ozo::unwrap() function until the type of unwrapped value and type of it's argument become the same.
ozo::is_null_recursive().The function is equal to this pesudo-code:
| value | — object to unwrap |
ozo::unwrap()