libgpiod
Loading...
Searching...
No Matches
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
21namespace gpiod {
22
23class edge_event_buffer;
24
28class edge_event final
29{
30public:
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
56
63
69 edge_event& operator=(edge_event&& other) noexcept;
70
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
105private:
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__ */
Object into which edge events are read for better performance.
Definition edge-event-buffer.hpp:33
Immutable object containing data about a single edge event.
Definition edge-event.hpp:29
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:36
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:25
Definition chip-info.hpp:18