Realistic 3D camera system
3D camera system components
error_code.hpp
Go to the documentation of this file.
1 //
2 // error_code.hpp
3 // ~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_ERROR_CODE_HPP
12 #define ASIO_ERROR_CODE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if defined(ASIO_HAS_STD_SYSTEM_ERROR)
21 # include <system_error>
22 #else // defined(ASIO_HAS_STD_SYSTEM_ERROR)
23 # include <string>
25 # if !defined(ASIO_NO_IOSTREAM)
26 # include <iosfwd>
27 # endif // !defined(ASIO_NO_IOSTREAM)
28 #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
29 
31 
32 namespace asio {
33 
34 #if defined(ASIO_HAS_STD_SYSTEM_ERROR)
35 
36 typedef std::error_category error_category;
37 
38 #else // defined(ASIO_HAS_STD_SYSTEM_ERROR)
39 
41 class error_category : private noncopyable
42 {
43 public:
45  virtual ~error_category()
46  {
47  }
48 
50  virtual const char* name() const = 0;
51 
53  virtual std::string message(int value) const = 0;
54 
56  bool operator==(const error_category& rhs) const
57  {
58  return this == &rhs;
59  }
60 
62  bool operator!=(const error_category& rhs) const
63  {
64  return !(*this == rhs);
65  }
66 };
67 
68 #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
69 
71 extern ASIO_DECL const error_category& system_category();
72 
73 #if defined(ASIO_HAS_STD_SYSTEM_ERROR)
74 
75 typedef std::error_code error_code;
76 
77 #else // defined(ASIO_HAS_STD_SYSTEM_ERROR)
78 
80 class error_code
81 {
82 public:
85  : value_(0),
86  category_(&system_category())
87  {
88  }
89 
91  error_code(int v, const error_category& c)
92  : value_(v),
93  category_(&c)
94  {
95  }
96 
98  template <typename ErrorEnum>
99  error_code(ErrorEnum e)
100  {
101  *this = make_error_code(e);
102  }
103 
105  int value() const
106  {
107  return value_;
108  }
109 
111  const error_category& category() const
112  {
113  return *category_;
114  }
115 
117  std::string message() const
118  {
119  return category_->message(value_);
120  }
121 
123  {
124  };
125 
126  typedef void (*unspecified_bool_type)(unspecified_bool_type_t);
127 
129 
131  operator unspecified_bool_type() const
132  {
133  if (value_ == 0)
134  return 0;
135  else
137  }
138 
140  bool operator!() const
141  {
142  return value_ == 0;
143  }
144 
146  friend bool operator==(const error_code& e1, const error_code& e2)
147  {
148  return e1.value_ == e2.value_ && e1.category_ == e2.category_;
149  }
150 
152  friend bool operator!=(const error_code& e1, const error_code& e2)
153  {
154  return e1.value_ != e2.value_ || e1.category_ != e2.category_;
155  }
156 
157 private:
158  // The value associated with the error code.
159  int value_;
160 
161  // The category associated with the error code.
162  const error_category* category_;
163 };
164 
165 # if !defined(ASIO_NO_IOSTREAM)
166 
168 template <typename Elem, typename Traits>
169 std::basic_ostream<Elem, Traits>& operator<<(
170  std::basic_ostream<Elem, Traits>& os, const error_code& ec)
171 {
172  os << ec.category().name() << ':' << ec.value();
173  return os;
174 }
175 
176 # endif // !defined(ASIO_NO_IOSTREAM)
177 
178 #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
179 
180 } // namespace asio
181 
183 
184 #if defined(ASIO_HEADER_ONLY)
185 # include "asio/impl/error_code.ipp"
186 #endif // defined(ASIO_HEADER_ONLY)
187 
188 #endif // ASIO_ERROR_CODE_HPP
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const error_code &ec)
Output an error code.
Definition: error_code.hpp:169
error_code()
Default constructor.
Definition: error_code.hpp:84
bool operator==(const error_category &rhs) const
Equality operator to compare two error categories.
Definition: error_code.hpp:56
pylon Camera Software Suite for Linux for Use with Basler Gigabit the pylon Viewer and the IP Configurator applications might not be available System I340 and I350 series Although the pylon software will work with any GigE network we would recommend to use one of these adapters USB For U3V devices a USB3 capable USB controller is necessary For best performance and stability we highly recommend a kernel the following settings should be i e
virtual const char * name() const =0
Returns a string naming the error gategory.
error_code(ErrorEnum e)
Construct from an error code enum.
Definition: error_code.hpp:99
static void unspecified_bool_true(unspecified_bool_type_t)
Definition: error_code.hpp:128
virtual std::string message(int value) const =0
Returns a string describing the error denoted by value.
friend bool operator==(const error_code &e1, const error_code &e2)
Equality operator to compare two error objects.
Definition: error_code.hpp:146
bool operator!=(const error_category &rhs) const
Inequality operator to compare two error categories.
Definition: error_code.hpp:62
error_code(int v, const error_category &c)
Construct with specific error code and category.
Definition: error_code.hpp:91
int value() const
Get the error value.
Definition: error_code.hpp:105
friend bool operator!=(const error_code &e1, const error_code &e2)
Inequality operator to compare two error objects.
Definition: error_code.hpp:152
Class to represent an error code value.
Definition: error_code.hpp:80
#define ASIO_DECL
Definition: config.hpp:43
bool operator!() const
Operator to test if the error represents success.
Definition: error_code.hpp:140
std::string message() const
Get the message associated with the error.
Definition: error_code.hpp:117
asio::error_code make_error_code(basic_errors e)
Definition: error.hpp:297
const error_category & category() const
Get the error category.
Definition: error_code.hpp:111
virtual ~error_category()
Destructor.
Definition: error_code.hpp:45
ASIO_DECL const error_category & system_category()
Returns the error category used for the system errors produced by asio.
Definition: error_code.ipp:118