Debian Codegraph @

bindings/cxx/gpiodcxx/request-config.hpp

raw symbols SCIP
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <[email protected]> */
3
4 /**
5 * @file request-config.hpp
6 */
7
8 #ifndef __LIBGPIOD_CXX_REQUEST_CONFIG_HPP__
9 #define __LIBGPIOD_CXX_REQUEST_CONFIG_HPP__
10
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14
15 #include <cstddef>
16 #include <iostream>
17 #include <memory>
18 #include <string>
19
20 #include "line.hpp"
21
22 namespace gpiod {
23
24 class chip;
25
26 /**
27 * @brief Stores a set of options passed to the kernel when making a line
28 * request.
29 */
30 class request_config final
31 {
32 public:
33
34 /**
35 * @brief Constructor.
36 */
37 request_config();
38
39 request_config(const request_config& other) = delete;
40
41 /**
42 * @brief Move constructor.
43 * @param other Object to move.
44 */
45 request_config(request_config&& other) noexcept;
46
47 ~request_config();
48
49 /**
50 * @brief Move assignment operator.
51 * @param other Object to move.
52 * @return Reference to self.
53 */
54 request_config& operator=(request_config&& other) noexcept;
55
56 /**
57 * @brief Set the consumer name.
58 * @param consumer New consumer name.
59 * @return Reference to self.
60 */
61 request_config& set_consumer(const ::std::string& consumer) noexcept;
62
63 /**
64 * @brief Get the consumer name.
65 * @return Currently configured consumer name. May be an empty string.
66 */
67 ::std::string consumer() const noexcept;
68
69 /**
70 * @brief Set the size of the kernel event buffer.
71 * @param event_buffer_size New event buffer size.
72 * @return Reference to self.
73 * @note The kernel may adjust the value if it's too high. If set to 0,
74 * the default value will be used.
75 */
76 request_config& set_event_buffer_size(::std::size_t event_buffer_size) noexcept;
77
78 /**
79 * @brief Get the edge event buffer size from this request config.
80 * @return Current edge event buffer size setting.
81 */
82 ::std::size_t event_buffer_size() const noexcept;
83
84 private:
85
86 struct impl;
87
88 ::std::shared_ptr<impl> _m_priv;
89
90 request_config& operator=(const request_config& other);
91
92 friend request_builder;
93 };
94
95 /**
96 * @brief Stream insertion operator for request_config objects.
97 * @param out Output stream to write to.
98 * @param config request_config to insert into the output stream.
99 * @return Reference to out.
100 */
101 ::std::ostream& operator<<(::std::ostream& out, const request_config& config);
102
103 } /* namespace gpiod */
104
105 #endif /* __LIBGPIOD_CXX_REQUEST_CONFIG_HPP__ */