23#ifndef LELY_COAPP_FIBER_DRIVER_HPP_
24#define LELY_COAPP_FIBER_DRIVER_HPP_
85 template <
class F,
class... Args>
88 GetStrand().
post(::std::forward<F>(f), ::std::forward<Args>(args)...);
109 return f.get().value();
111 util::throw_error_code(
"Wait", ::std::errc::operation_canceled);
128 typename ::std::enable_if<!::std::is_void<T>::value, T>::type
132 return f.get().value();
133 }
catch (const ::std::system_error& e) {
155 void USleep(uint_least64_t usec);
161 void USleep(uint_least64_t usec, ::std::error_code& ec);
An asynchronous CANopen master.
The base class for drivers for remote CANopen nodes.
uint8_t id() const noexcept final
Returns the node-ID.
BasicMaster & master
A reference to the master with which this driver is registered.
A CANopen driver running its tasks and callbacks in fibers.
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 ...
The exception thrown when retrieving the result of a future which is not ready or does not contain a ...
This header file is part of the C++ CANopen application library; it contains the remote node driver i...
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.
::std::error_code make_error_code(SdoErrc e) noexcept
Creates an error code corresponding to an SDO abort code.
This header file is part of the event library; it contains the C++ interface for the strand executor.