libgpiod 2.1
edge-event.hpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-3.0-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
21namespace gpiod {
22
23class edge_event_buffer;
24
33class edge_event final
34{
35public:
36
40 enum class event_type
41 {
42 RISING_EDGE = 1,
44 FALLING_EDGE,
46 };
47
52 edge_event(const edge_event& other);
53
58 edge_event(edge_event&& other) noexcept;
59
61
68
74 edge_event& operator=(edge_event&& other) noexcept;
75
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
110private:
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__ */
Object into which edge events are read for better performance.
Immutable object containing data about a single edge event.
Definition: edge-event.hpp:34
edge_event(edge_event &&other) noexcept
Move constructor.
line::offset line_offset() const noexcept
Read the offset of the line on which this event was registered.
unsigned long line_seqno() const noexcept
Get the event sequence number specific to the concerned line.
edge_event(const edge_event &other)
Copy constructor.
event_type
Edge event types.
Definition: edge-event.hpp:41
edge_event & operator=(edge_event &&other) noexcept
Move assignment operator.
event_type type() const
Retrieve the event type.
unsigned long global_seqno() const noexcept
Get the global sequence number of this event.
timestamp timestamp_ns() const noexcept
Retrieve the event time-stamp.
edge_event & operator=(const edge_event &other)
Copy assignment operator.
Stores the edge and info event timestamps as returned by the kernel and allows to convert them to std...
Definition: timestamp.hpp:30