libgpiod
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 
28 class edge_event final
29 {
30 public:
31 
35  enum class event_type
36  {
37  RISING_EDGE = 1,
41  };
42 
47  edge_event(const edge_event& other);
48 
53  edge_event(edge_event&& other) noexcept;
54 
55  ~edge_event();
56 
62  edge_event& operator=(const edge_event& other);
63 
69  edge_event& operator=(edge_event&& other) noexcept;
70 
75  event_type type() const;
76 
82  timestamp timestamp_ns() const noexcept;
83 
89  line::offset line_offset() const noexcept;
90 
96  unsigned long global_seqno() const noexcept;
97 
103  unsigned long line_seqno() const noexcept;
104 
105 private:
106 
107  edge_event();
108 
109  struct impl;
110  struct impl_managed;
111  struct impl_external;
112 
113  ::std::shared_ptr<impl> _m_priv;
114 
115  friend edge_event_buffer;
116 };
117 
124 ::std::ostream& operator<<(::std::ostream& out, const edge_event& event);
125 
126 } /* namespace gpiod */
127 
128 #endif /* __LIBGPIOD_CXX_EDGE_EVENT_HPP__ */
Definition: chip-info.hpp:18
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:28
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:24
event_type
Edge event types.
Definition: edge-event.hpp:35
event_type type() const
Retrieve the event type.
Object into which edge events are read for better performance.
Definition: edge-event-buffer.hpp:32
unsigned long line_seqno() const noexcept
Get the event sequence number specific to the concerned line.