libgpiod
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 
28 class line_config final
29 {
30 public:
31 
32 
33  line_config();
34 
35  line_config(const line_config& other) = delete;
36 
41  line_config(line_config&& other) noexcept;
42 
43  ~line_config();
44 
50  line_config& operator=(line_config&& other) noexcept;
51 
56  line_config& reset() noexcept;
57 
64  line_config& add_line_settings(line::offset offset, const line_settings& settings);
65 
73 
80 
87  ::std::map<line::offset, line_settings> get_line_settings() const;
88 
89 private:
90 
91  struct impl;
92 
93  ::std::shared_ptr<impl> _m_priv;
94 
95  line_config& operator=(const line_config& other);
96 
97  friend line_request;
98  friend request_builder;
99 };
100 
107 ::std::ostream& operator<<(::std::ostream& out, const line_config& config);
108 
109 } /* namespace gpiod */
110 
111 #endif /* __LIBGPIOD_CXX_LINE_CONFIG_HPP__ */
Definition: chip-info.hpp:18
::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.
::std::ostream & operator<<(::std::ostream &out, const chip_info &chip)
Stream insertion operator for GPIO chip objects.
Stores the context of a set of requested GPIO lines.
Definition: line-request.hpp:32
::std::vector< value > values
Vector of line values.
Definition: line.hpp:168
Intermediate object storing the configuration for a line request.
Definition: request-builder.hpp:28
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:28
line_config & reset() noexcept
Reset the line config object.
Stores GPIO line settings.
Definition: line-settings.hpp:27
line_config & operator=(line_config &&other) noexcept
Move assignment operator.
::std::vector< offset > offsets
Vector of line offsets.
Definition: line.hpp:163
Wrapper around unsigned int for representing line offsets.
Definition: line.hpp:29