libgpiod
info-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_INFO_EVENT_HPP__
9 #define __LIBGPIOD_CXX_INFO_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 chip;
24 class line_info;
25 
29 class info_event final
30 {
31 public:
32 
36  enum class event_type
37  {
38  LINE_REQUESTED = 1,
44  };
45 
50  info_event(const info_event& other);
51 
56  info_event(info_event&& other) noexcept;
57 
58  ~info_event();
59 
65  info_event& operator=(const info_event& other);
66 
72  info_event& operator=(info_event&& other) noexcept;
73 
78  event_type type() const;
79 
84  ::std::uint64_t timestamp_ns() const noexcept;
85 
91  const line_info& get_line_info() const noexcept;
92 
93 private:
94 
95  info_event();
96 
97  struct impl;
98 
99  ::std::shared_ptr<impl> _m_priv;
100 
101  friend chip;
102 };
103 
110 ::std::ostream& operator<<(::std::ostream& out, const info_event& event);
111 
112 } /* namespace gpiod */
113 
114 #endif /* __LIBGPIOD_CXX_INFO_EVENT_HPP__ */
Definition: chip-info.hpp:18
event_type
Types of info events.
Definition: info-event.hpp:36
event_type type() const
Type of this event.
Immutable object containing data about a single line info event.
Definition: info-event.hpp:29
::std::uint64_t timestamp_ns() const noexcept
Timestamp of the event as returned by the kernel.
Represents a GPIO chip.
Definition: chip.hpp:36
Contains an immutable snapshot of the line's state at the time when the object of this class was inst...
Definition: line-info.hpp:29
const line_info & get_line_info() const noexcept
Get the new line information.