23#ifndef LELY_COAPP_FIBER_DRIVER_HPP_
24#define LELY_COAPP_FIBER_DRIVER_HPP_
39class FiberDriverBase {
85 template <
class F,
class... Args>
88 GetStrand().
post(::std::forward<F>(f), ::std::forward<Args>(args)...);
128 typename ::std::enable_if<!::std::is_void<T>::value, T>::type
133 }
catch (const ::std::system_error& e) {
136 ec = ::std::make_error_code(::std::errc::operation_canceled);
155 void USleep(uint_least64_t usec);
161 void USleep(uint_least64_t usec, ::std::error_code& ec);
An asynchronous CANopen master.
uint8_t id() const noexcept final
Returns the node-ID.
BasicDriver(ev_exec_t *exec, BasicMaster &master, uint8_t id)
Creates a new driver for a remote CANopen node and registers it with the master.
BasicMaster & master
A reference to the master with which this driver is registered.
void Defer(F &&f, Args &&... args)
Schedules the specified Callable object for execution by strand for this driver.
FiberDriver(AsyncMaster &master, uint8_t id)
Creates a new CANopen driver and its associated fiber executor.
T Wait(SdoFuture< T > f)
Waits for the specified future to become ready by suspending the calling fiber.
FiberDriver(ev_exec_t *exec, AsyncMaster &master, uint8_t id)
Creates a new CANopen driver and its associated fiber executor.
typename::std::enable_if<!::std::is_void< T >::value, T >::type Wait(SdoFuture< T > f, ::std::error_code &ec)
Waits for the specified future to become ready by suspending the calling fiber.
void USleep(uint_least64_t usec)
Suspends the calling fiber for usec microseconds.
ev::Executor GetStrand() const noexcept
Returns the strand executor associated with the driver.
A base class for lely::canopen::FiberDriver, containing a fiber executor.
An abstract task executor. This class is a wrapper around #ev_exec_t*.
void post(ev_task &task) noexcept
Convenience class providing a RAII-style mechanism to ensure the calling thread can be used by fiber ...
result_type & get()
Returns the result of a ready future.
The exception thrown when retrieving the result of a future which is not ready or does not contain a ...
value_type & value()
Returns a reference to the value if *this contains a value, and throws an exception if *this contains...
This header file is part of the C++ CANopen application library; it contains the remote node driver i...
void throw_error_code(::std::errc e)
Throws an std::system_error exception corresponding to the specified error code.
This header file is part of the event library; it contains the C++ interface for the fiber executor,...
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
The namespace for implementation details of the C++ CANopen application library.
The namespace for the C++ CANopen application library.
ev::Future< T, ::std::exception_ptr > SdoFuture
A helper alias template for the type of future used to retrieve the result of an asynchronous SDO req...
This header file is part of the event library; it contains the C++ interface for the strand executor.