libgpiod  2.1.2
line-config.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_LINE_CONFIG_HPP__
9 #define __LIBGPIOD_CXX_LINE_CONFIG_HPP__
10 
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14 
15 #include <map>
16 #include <memory>
17 
18 namespace gpiod {
19 
20 class chip;
21 class line_request;
22 class line_settings;
23 
33 class line_config final
34 {
35 public:
36 
37 
38  line_config();
39 
40  line_config(const line_config& other) = delete;
41 
46  line_config(line_config&& other) noexcept;
47 
48  ~line_config();
49 
55  line_config& operator=(line_config&& other) noexcept;
56 
61  line_config& reset() noexcept;
62 
69  line_config& add_line_settings(line::offset offset, const line_settings& settings);
70 
78 
85 
92  ::std::map<line::offset, line_settings> get_line_settings() const;
93 
94 private:
95 
96  struct impl;
97 
98  ::std::shared_ptr<impl> _m_priv;
99 
100  line_config& operator=(const line_config& other);
101 
102  friend line_request;
103  friend request_builder;
104 };
105 
112 ::std::ostream& operator<<(::std::ostream& out, const line_config& config);
113 
118 } /* namespace gpiod */
119 
120 #endif /* __LIBGPIOD_CXX_LINE_CONFIG_HPP__ */
::std::map< line::offset, line_settings > get_line_settings() const
Get a mapping of offsets to line settings stored by this object.
line_config & set_output_values(const line::values &values)
Set output values for a number of lines.
Stores the context of a set of requested GPIO lines.
::std::vector< value > values
Vector of line values.
Definition: line.hpp:173
Intermediate object storing the configuration for a line request.
line_config & add_line_settings(line::offset offset, const line_settings &settings)
Add line settings for a single offset.
Contains a set of line config options used in line requests and reconfiguration.
Definition: line-config.hpp:33
line_config & reset() noexcept
Reset the line config object.
Stores GPIO line settings.
line_config & operator=(line_config &&other) noexcept
Move assignment operator.
::std::vector< offset > offsets
Vector of line offsets.
Definition: line.hpp:168
Wrapper around unsigned int for representing line offsets.
Definition: line.hpp:34