Debian Codegraph @

bindings/cxx/gpiodcxx/exception.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 exception.hpp
6 */
7
8 #ifndef __LIBGPIOD_CXX_EXCEPTION_HPP__
9 #define __LIBGPIOD_CXX_EXCEPTION_HPP__
10
11 #if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12 #error "Only gpiod.hpp can be included directly."
13 #endif
14
15 #include <stdexcept>
16 #include <string>
17
18 namespace gpiod {
19
20 /**
21 * @brief Exception thrown when an already closed chip is used.
22 */
23 class GPIOD_CXX_API chip_closed final : public ::std::logic_error
24 {
25 public:
26
27 /**
28 * @brief Constructor.
29 * @param what Human readable reason for error.
30 */
31 explicit chip_closed(const ::std::string& what);
32
33 /**
34 * @brief Copy constructor.
35 * @param other Object to copy from.
36 */
37 chip_closed(const chip_closed& other) noexcept;
38
39 /**
40 * @brief Move constructor.
41 * @param other Object to move.
42 */
43 chip_closed(chip_closed&& other) noexcept;
44
45 /**
46 * @brief Assignment operator.
47 * @param other Object to copy from.
48 * @return Reference to self.
49 */
50 chip_closed& operator=(const chip_closed& other) noexcept;
51
52 /**
53 * @brief Move assignment operator.
54 * @param other Object to move.
55 * @return Reference to self.
56 */
57 chip_closed& operator=(chip_closed&& other) noexcept;
58
59 ~chip_closed();
60 };
61
62 /**
63 * @brief Exception thrown when an already released line request is used.
64 */
65 class GPIOD_CXX_API request_released final : public ::std::logic_error
66 {
67 public:
68
69 /**
70 * @brief Constructor.
71 * @param what Human readable reason for error.
72 */
73 explicit request_released(const ::std::string& what);
74
75 /**
76 * @brief Copy constructor.
77 * @param other Object to copy from.
78 */
79 request_released(const request_released& other) noexcept;
80
81 /**
82 * @brief Move constructor.
83 * @param other Object to move.
84 */
85 request_released(request_released&& other) noexcept;
86
87 /**
88 * @brief Assignment operator.
89 * @param other Object to copy from.
90 * @return Reference to self.
91 */
92 request_released& operator=(const request_released& other) noexcept;
93
94 /**
95 * @brief Move assignment operator.
96 * @param other Object to move.
97 * @return Reference to self.
98 */
99 request_released& operator=(request_released&& other) noexcept;
100
101 ~request_released();
102 };
103
104 /**
105 * @brief Exception thrown when the core C library returns an invalid value
106 * for any of the line_info properties.
107 */
108 class GPIOD_CXX_API bad_mapping final : public ::std::runtime_error
109 {
110 public:
111
112 /**
113 * @brief Constructor.
114 * @param what Human readable reason for error.
115 */
116 explicit bad_mapping(const ::std::string& what);
117
118 /**
119 * @brief Copy constructor.
120 * @param other Object to copy from.
121 */
122 bad_mapping(const bad_mapping& other) noexcept;
123
124 /**
125 * @brief Move constructor.
126 * @param other Object to move.
127 */
128 bad_mapping(bad_mapping&& other) noexcept;
129
130 /**
131 * @brief Assignment operator.
132 * @param other Object to copy from.
133 * @return Reference to self.
134 */
135 bad_mapping& operator=(const bad_mapping& other) noexcept;
136
137 /**
138 * @brief Move assignment operator.
139 * @param other Object to move.
140 * @return Reference to self.
141 */
142 bad_mapping& operator=(bad_mapping&& other) noexcept;
143
144 ~bad_mapping();
145 };
146
147 } /* namespace gpiod */
148
149 #endif /* __LIBGPIOD_CXX_EXCEPTION_HPP__ */