source: pacpussensors/trunk/Vislab/lib3dv/error.h@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 2.3 KB
Line 
1#ifndef LIB3DV_ERROR_H
2#define LIB3DV_ERROR_H
3
4/* lib3dv/error.h
5 *
6 * Copyright (C) 2013 VisLab
7 *
8 * This file is part of lib3dv; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <lib3dv/3dv_export.h>
23
24#include <ostream>
25
26namespace lib3dv
27{
28 /**
29 * @brief Structure representing an error condition.
30 *
31 */
32 struct LIB3DV_EXPORT error
33 {
34 enum types
35 {
36 NONE = 0,
37 PROPERTY_READONLY, ///< Attempt to write a read-only property.
38 PROPERTY_NOT_FOUND, ///< Requested property is not available for the device.
39 PROPERTY_TYPE_MISMATCH, ///< Attempted to set a property using the wrong type.
40 PROPERTY_VALUE_INVALID, ///< Attempted to set a property using a value out of range.
41 NETWORK_TIMEOUT, ///< Network connection timed out.
42 NETWORK_FAILURE, ///< Network connection failure.
43 DEVICE_NOT_FOUND, ///< Requested device could not be found.
44 DEVICE_INVALID ///< An invalid device has been used.
45 };
46
47 /**
48 * @brief Create an empty error.
49 *
50 */
51 error() : m_type(NONE) {}
52
53 types m_type; ///< Error type. @see lib3dv::error::types.
54
55 void operator= (const error::types& type) { m_type = type; }
56
57 bool operator== (const error::types& type) { return m_type == type; }
58
59 bool operator!= (const error::types& type) { return m_type != type; }
60
61 operator int() { return static_cast<int>(m_type); }
62
63 friend LIB3DV_EXPORT std::ostream& operator<< (std::ostream& output, const error& error);
64 };
65}
66
67#endif
Note: See TracBrowser for help on using the repository browser.