libgpiod  2.1.2
request-builder.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /* SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> */
3 
8 #ifndef __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__
9 #define __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__
10 
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14 
15 #include <memory>
16 #include <ostream>
17 
18 namespace gpiod {
19 
20 class chip;
21 class line_config;
22 class line_request;
23 class request_config;
24 
33 class request_builder final
34 {
35 public:
36 
37  request_builder(const request_builder& other) = delete;
38 
43  request_builder(request_builder&& other) noexcept;
44 
45  ~request_builder();
46 
47  request_builder& operator=(const request_builder& other) = delete;
48 
54  request_builder& operator=(request_builder&& other) noexcept;
55 
62 
68  const request_config& get_request_config() const noexcept;
69 
75  request_builder& set_consumer(const ::std::string& consumer) noexcept;
76 
83  request_builder& set_event_buffer_size(::std::size_t event_buffer_size) noexcept;
84 
91 
97  const line_config& get_line_config() const noexcept;
98 
107 
116 
124 
130 
131 private:
132 
133  struct impl;
134 
136 
137  ::std::unique_ptr<impl> _m_priv;
138 
139  friend chip;
140  friend ::std::ostream& operator<<(::std::ostream& out, const request_builder& builder);
141 };
142 
149 ::std::ostream& operator<<(::std::ostream& out, const request_builder& builder);
150 
155 } /* namespace gpiod */
156 
157 #endif /* __LIBGPIOD_CXX_REQUEST_BUILDER_HPP__ */
const request_config & get_request_config() const noexcept
Get the current request config.
friend::std::ostream & operator<<(::std::ostream &out, const request_builder &builder)
Stream insertion operator for GPIO request builder objects.
const line_config & get_line_config() const noexcept
Get the current line config.
Stores the context of a set of requested GPIO lines.
request_builder & set_request_config(request_config &req_cfg)
Set the request config for the request.
request_builder & add_line_settings(line::offset offset, const line_settings &settings)
Add line settings to the line config stored by this object for a single offset.
::std::vector< value > values
Vector of line values.
Definition: line.hpp:173
Intermediate object storing the configuration for a line request.
request_builder & set_output_values(const line::values &values)
Set output values for a number of lines in the line config stored by this object. ...
Contains a set of line config options used in line requests and reconfiguration.
Definition: line-config.hpp:33
Represents a GPIO chip.
Definition: chip.hpp:41
line_request do_request()
Make the line request.
request_builder & set_line_config(line_config &line_cfg)
Set the line config for this request.
Stores GPIO line settings.
request_builder & set_consumer(const ::std::string &consumer) noexcept
Set consumer in the request config stored by this object.
Stores a set of options passed to the kernel when making a line request.
::std::vector< offset > offsets
Vector of line offsets.
Definition: line.hpp:168
request_builder & set_event_buffer_size(::std::size_t event_buffer_size) noexcept
Set the event buffer size in the request config stored by this object.
Wrapper around unsigned int for representing line offsets.
Definition: line.hpp:34