libgpiod  2.1.2
edge-event.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
3 
8 #ifndef __LIBGPIOD_CXX_EDGE_EVENT_HPP__
9 #define __LIBGPIOD_CXX_EDGE_EVENT_HPP__
10 
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14 
15 #include <cstdint>
16 #include <iostream>
17 #include <memory>
18 
19 #include "timestamp.hpp"
20 
21 namespace gpiod {
22 
23 class edge_event_buffer;
24 
33 class edge_event final
34 {
35 public:
36 
40  enum class event_type
41  {
42  RISING_EDGE = 1,
46  };
47 
52  edge_event(const edge_event& other);
53 
58  edge_event(edge_event&& other) noexcept;
59 
60  ~edge_event();
61 
67  edge_event& operator=(const edge_event& other);
68 
74  edge_event& operator=(edge_event&& other) noexcept;
75 
80  event_type type() const;
81 
87  timestamp timestamp_ns() const noexcept;
88 
94  line::offset line_offset() const noexcept;
95 
101  unsigned long global_seqno() const noexcept;
102 
108  unsigned long line_seqno() const noexcept;
109 
110 private:
111 
112  edge_event();
113 
114  struct impl;
115  struct impl_managed;
116  struct impl_external;
117 
118  ::std::shared_ptr<impl> _m_priv;
119 
120  friend edge_event_buffer;
121 };
122 
129 ::std::ostream& operator<<(::std::ostream& out, const edge_event& event);
130 
135 } /* namespace gpiod */
136 
137 #endif /* __LIBGPIOD_CXX_EDGE_EVENT_HPP__ */
This is a rising edge event.
line::offset line_offset() const noexcept
Read the offset of the line on which this event was registered.
timestamp timestamp_ns() const noexcept
Retrieve the event time-stamp.
Immutable object containing data about a single edge event.
Definition: edge-event.hpp:33
unsigned long global_seqno() const noexcept
Get the global sequence number of this event.
Stores the edge and info event timestamps as returned by the kernel and allows to convert them to std...
Definition: timestamp.hpp:29
event_type
Edge event types.
Definition: edge-event.hpp:40
event_type type() const
Retrieve the event type.
Object into which edge events are read for better performance.
unsigned long line_seqno() const noexcept
Get the event sequence number specific to the concerned line.