Event Source
C++ event source declarations.
Event sources are used to wake up user-space tasks when a specific event
(such as a hardware interrupt from a specific peripheral device) occurs. The
following entities are defined in the cuddl namespace.
-
enum class cuddl::EventSrcFlag
C++ wrapper for
cuddl_eventsrc_flags.The
|operator is overloaded to return anEventSrcFlagsinstance. The stream output operator is also overloaded.Values:
-
enumerator SHARED
-
enumerator WAITABLE
-
enumerator HAS_DISABLE
-
enumerator HAS_ENABLE
-
enumerator HAS_IS_ENABLED
-
enumerator SHARED
-
using cuddl::EventSrcFlags = Flags<EventSrcFlag>
C++ class representing a set of one or more
EventSrcFlagelements.See the
Flagsclass template documentation for member functions.The
|operator is overloaded forEventSrcFlagandEventSrcFlagsarguments. The|=operator is overloaded as an alias forFlags::set. The stream output operator is also overloaded.
-
enum class cuddl::EventSrcClaimFlag
C++ wrapper for
cuddl_eventsrc_claim_flags.The
|operator is overloaded to return anEventSrcClaimFlagsinstance. The stream output operator is also overloaded.Values:
-
enumerator HOSTILE
-
enumerator HOSTILE
-
using cuddl::EventSrcClaimFlags = Flags<EventSrcClaimFlag>
C++ class representing a set of one or more
EventSrcClaimFlagelements.See the
Flagsclass template documentation for member functions.The
|operator is overloaded forEventSrcClaimFlagandEventSrcClaimFlagsarguments. The|=operator is overloaded as an alias forFlags::set. The stream output operator is also overloaded.
-
enum class cuddl::EventSrcOpenFlag
Placeholder for event source open flags that may possibly be implemented in the future.
The
|operator is overloaded to return anEventSrcOpenFlagsinstance. The stream output operator is also overloaded.Values:
-
using cuddl::EventSrcOpenFlags = Flags<EventSrcOpenFlag>
C++ class representing a set of one or more
EventSrcOpenFlagelements.See the
Flagsclass template documentation for member functions.The
|operator is overloaded forEventSrcOpenFlagandEventSrcOpenFlagsarguments. The|=operator is overloaded as an alias forFlags::set. The stream output operator is also overloaded.
-
class EventSrcInfo
C++ wrapper class for
cuddl_eventsrc_info.The stream output operator is overloaded for instances of this class.
Getter Functions
-
inline EventSrcFlags flags() const
Public Functions
-
inline operator cuddl_eventsrc_info() const
Cast operator for converting class instances to the equivalent C structure.
-
inline EventSrcFlags flags() const
-
class TimeSpec
C++ wrapper class for
cuddl_timespec.Constructors
-
inline TimeSpec()
-
inline TimeSpec(const cuddl_timespec &ts)
-
inline TimeSpec(cuddl_time_t s, long n)
Public Functions
-
inline operator cuddl_timespec() const
-
inline TimeSpec()
-
class EventSrc
C++ wrapper class for
cuddl_eventsrc.The stream output operator is overloaded for instances of this class.
Constructors
-
inline EventSrc()
-
inline EventSrc(const cuddl_eventsrc &eventsrc, bool opened = false)
-
inline EventSrc(const cuddl_resource_id &id, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
- Throws:
std::system_error – Operation failed.
-
inline EventSrc(const char *group, const char *device, const char *resource = "", int instance = 0, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
- Throws:
std::system_error – Operation failed.
-
inline EventSrc(const std::string &full_name, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
- Throws:
std::system_error – Operation failed.
Destructor
-
inline ~EventSrc()
Getter Functions
-
inline EventSrcFlags flags() const
Explicit Resource Management
Note that resource management can be performed explicitly, or via the constructor / destructor.
-
inline void claim_and_open(const cuddl_resource_id &id, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
C++ wrapper for
cuddl_eventsrc_claim_and_open().- Throws:
std::system_error – Operation failed.
-
inline void claim_and_open(const char *group, const char *device, const char *resource = "", int instance = 0, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
C++ wrapper for
cuddl_eventsrc_claim_and_open().- Throws:
std::system_error – Operation failed.
-
inline void claim_and_open(const std::string &full_name, const EventSrcClaimFlags &claim_flags = 0, const EventSrcOpenFlags &open_flags = 0)
C++ wrapper for
cuddl_eventsrc_claim_and_open().- Throws:
std::system_error – Operation failed.
-
inline void close_and_release()
C++ wrapper for
cuddl_eventsrc_close_and_release().
Event Wake-Up
-
inline int wait()
C++ wrapper for
cuddl_eventsrc_wait().
-
inline int try_wait()
C++ wrapper for
cuddl_eventsrc_try_wait().
-
inline int timed_wait(const cuddl_timespec &timeout)
C++ wrapper for
cuddl_eventsrc_timed_wait().
-
inline int timed_wait(const std::chrono::nanoseconds &timeout)
C++ wrapper for
cuddl_eventsrc_timed_wait().
Event Enable/Disable
-
inline int enable()
C++ wrapper for
cuddl_eventsrc_enable().
-
inline int disable()
C++ wrapper for
cuddl_eventsrc_disable().
Public Functions
-
inline operator cuddl_eventsrc() const
Cast operator for converting class instances to the equivalent C structure.
-
inline bool is_open() const
Test if the event source has been successfully opened.
-
inline int is_enabled()
C++ wrapper for
cuddl_eventsrc_is_enabled().- Throws:
std::system_error – Operation failed.
-
inline ResourceID get_resource_id()
C++ wrapper for
cuddl_eventsrc_get_resource_id().- Throws:
std::system_error – Operation failed.
-
inline EventSrc()
-
class EventSrcSet
C++ wrapper class for
cuddl_eventsrcset.Public Functions
-
inline void add(const EventSrc &eventsrc)
C++ wrapper for
cuddl_eventsrcset_add().
-
inline void remove(const EventSrc &eventsrc)
C++ wrapper for
cuddl_eventsrcset_remove().
-
inline bool contains(const EventSrc &eventsrc)
C++ wrapper for
cuddl_eventsrcset_contains().
-
inline int timed_wait(const cuddl_timespec &timeout, EventSrcSet *active_set = NULL)
C++ wrapper for
cuddl_eventsrcset_timed_wait().
-
inline int timed_wait(const std::chrono::nanoseconds &timeout, EventSrcSet *active_set = NULL)
C++ wrapper for
cuddl_eventsrcset_timed_wait().
-
inline void add(const EventSrc &eventsrc)