exception.hpp
Go to the documentation of this file.
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
2 
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
7 #define UUID_274DA366004E11DCB1DDFE2E56D89593
8 #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
9 #pragma GCC system_header
10 #endif
11 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
12 #pragma warning(push,1)
13 #endif
14 
15 namespace
16 boost
17  {
18  namespace
19  exception_detail
20  {
21  template <class T>
22  class
24  {
25  public:
26 
28  px_(0)
29  {
30  }
31 
33  {
34  release();
35  }
36 
37  refcount_ptr( refcount_ptr const & x ):
38  px_(x.px_)
39  {
40  add_ref();
41  }
42 
43  refcount_ptr &
44  operator=( refcount_ptr const & x )
45  {
46  adopt(x.px_);
47  return *this;
48  }
49 
50  void
51  adopt( T * px )
52  {
53  release();
54  px_=px;
55  add_ref();
56  }
57 
58  T *
59  get() const
60  {
61  return px_;
62  }
63 
64  private:
65 
66  T * px_;
67 
68  void
70  {
71  if( px_ )
72  px_->add_ref();
73  }
74 
75  void
77  {
78  if( px_ && px_->release() )
79  px_=0;
80  }
81  };
82  }
83 
85 
86  template <class Tag,class T>
87  class error_info;
88 
92 
93  template <>
94  class
96  {
97  public:
98  typedef char const * value_type;
100  explicit
102  v_(v)
103  {
104  }
105  };
106 
107  template <>
108  class
110  {
111  public:
112  typedef char const * value_type;
114  explicit
116  v_(v)
117  {
118  }
119  };
120 
121  template <>
122  class
124  {
125  public:
126  typedef int value_type;
128  explicit
130  v_(v)
131  {
132  }
133  };
134 
135 #if defined(__GNUC__)
136 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
137 # pragma GCC visibility push (default)
138 # endif
139 #endif
140  class exception;
141 #if defined(__GNUC__)
142 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
143 # pragma GCC visibility pop
144 # endif
145 #endif
146 
147  template <class T>
148  class shared_ptr;
149 
150  namespace
151  exception_detail
152  {
153  class error_info_base;
154  struct type_info_;
155 
156  struct
158  {
159  virtual char const * diagnostic_information( char const * ) const = 0;
160  virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
161  virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
162  virtual void add_ref() const = 0;
163  virtual bool release() const = 0;
165 
166  protected:
167 
169  {
170  }
171  };
172 
173  template <class>
174  struct get_info;
175 
176  template <>
177  struct get_info<throw_function>;
178 
179  template <>
180  struct get_info<throw_file>;
181 
182  template <>
183  struct get_info<throw_line>;
184 
185  template <class>
186  struct set_info_rv;
187 
188  template <>
189  struct set_info_rv<throw_function>;
190 
191  template <>
192  struct set_info_rv<throw_file>;
193 
194  template <>
195  struct set_info_rv<throw_line>;
196 
197  char const * get_diagnostic_information( exception const &, char const * );
198 
199  void copy_boost_exception( exception *, exception const * );
200 
201  template <class E,class Tag,class T>
202  E const & set_info( E const &, error_info<Tag,T> const & );
203 
204  template <class E>
205  E const & set_info( E const &, throw_function const & );
206 
207  template <class E>
208  E const & set_info( E const &, throw_file const & );
209 
210  template <class E>
211  E const & set_info( E const &, throw_line const & );
212  }
213 
214 #if defined(__GNUC__)
215 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
216 # pragma GCC visibility push (default)
217 # endif
218 #endif
219  class
220  exception
221  {
222  //<N3757>
223  public:
224  template <class Tag> void set( typename Tag::type const & );
225  template <class Tag> typename Tag::type const * get() const;
226  //</N3757>
227 
228  protected:
229 
231  throw_function_(0),
232  throw_file_(0),
233  throw_line_(-1)
234  {
235  }
236 
237 #ifdef __HP_aCC
238  //On HP aCC, this protected copy constructor prevents throwing boost::exception.
239  //On all other platforms, the same effect is achieved by the pure virtual destructor.
240  exception( exception const & x ) throw():
241  data_(x.data_),
242  throw_function_(x.throw_function_),
243  throw_file_(x.throw_file_),
244  throw_line_(x.throw_line_)
245  {
246  }
247 #endif
248 
249  virtual ~exception() throw()
250 #ifndef __HP_aCC
251  = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
252 #endif
253  ;
254 
255 #if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310)
256  public:
257 #else
258  private:
259 
260  template <class E>
261  friend E const & exception_detail::set_info( E const &, throw_function const & );
262 
263  template <class E>
264  friend E const & exception_detail::set_info( E const &, throw_file const & );
265 
266  template <class E>
267  friend E const & exception_detail::set_info( E const &, throw_line const & );
268 
269  template <class E,class Tag,class T>
270  friend E const & exception_detail::set_info( E const &, error_info<Tag,T> const & );
271 
272  friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
273 
274  template <class>
279  template <class>
285 #endif
287  mutable char const * throw_function_;
288  mutable char const * throw_file_;
289  mutable int throw_line_;
290  };
291 #if defined(__GNUC__)
292 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
293 # pragma GCC visibility pop
294 # endif
295 #endif
296 
297  inline
298  exception::
299  ~exception() throw()
300  {
301  }
302 
303  namespace
304  exception_detail
305  {
306  template <class E>
307  E const &
308  set_info( E const & x, throw_function const & y )
309  {
310  x.throw_function_=y.v_;
311  return x;
312  }
313 
314  template <class E>
315  E const &
316  set_info( E const & x, throw_file const & y )
317  {
318  x.throw_file_=y.v_;
319  return x;
320  }
321 
322  template <class E>
323  E const &
324  set_info( E const & x, throw_line const & y )
325  {
326  x.throw_line_=y.v_;
327  return x;
328  }
329  }
330 
332 
333  namespace
334  exception_detail
335  {
336 #if defined(__GNUC__)
337 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
338 # pragma GCC visibility push (default)
339 # endif
340 #endif
341  template <class T>
342  struct
344  public T,
345  public exception
346  {
347  explicit
348  error_info_injector( T const & x ):
349  T(x)
350  {
351  }
352 
354  {
355  }
356  };
357 #if defined(__GNUC__)
358 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
359 # pragma GCC visibility pop
360 # endif
361 #endif
362 
363  struct large_size { char c[256]; };
365 
366  struct small_size { };
367  small_size dispatch_boost_exception( void const * );
368 
369  template <class,int>
371 
372  template <class T>
373  struct
375  {
376  typedef T type;
377  };
378 
379  template <class T>
380  struct
382  {
384  };
385 
386  template <class T>
387  struct
389  {
391  };
392  }
393 
394  template <class T>
395  inline
396  typename
398  enable_error_info( T const & x )
399  {
401  return rt(x);
402  }
403 
405 
406  namespace
407  exception_detail
408  {
409 #if defined(__GNUC__)
410 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
411 # pragma GCC visibility push (default)
412 # endif
413 #endif
414  class
415  clone_base
416  {
417  public:
418 
419  virtual clone_base const * clone() const = 0;
420  virtual void rethrow() const = 0;
421 
422  virtual
423  ~clone_base() throw()
424  {
425  }
426  };
427 #if defined(__GNUC__)
428 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
429 # pragma GCC visibility pop
430 # endif
431 #endif
432 
433  inline
434  void
436  {
438  if( error_info_container * d=b->data_.get() )
439  data = d->clone();
440  a->throw_file_ = b->throw_file_;
441  a->throw_line_ = b->throw_line_;
443  a->data_ = data;
444  }
445 
446  inline
447  void
448  copy_boost_exception( void *, void const * )
449  {
450  }
451 
452 #if defined(__GNUC__)
453 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
454 # pragma GCC visibility push (default)
455 # endif
456 #endif
457  template <class T>
458  class
459  clone_impl:
460  public T,
461  public virtual clone_base
462  {
463  struct clone_tag { };
465  T(x)
466  {
467  copy_boost_exception(this,&x);
468  }
469 
470  public:
471 
472  explicit
473  clone_impl( T const & x ):
474  T(x)
475  {
476  copy_boost_exception(this,&x);
477  }
478 
479  ~clone_impl() throw()
480  {
481  }
482 
483  private:
484 
485  clone_base const *
486  clone() const
487  {
488  return new clone_impl(*this,clone_tag());
489  }
490 
491  void
492  rethrow() const
493  {
494  throw*this;
495  }
496  };
497  }
498 #if defined(__GNUC__)
499 # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
500 # pragma GCC visibility pop
501 # endif
502 #endif
503 
504  template <class T>
505  inline
506  exception_detail::clone_impl<T>
508  {
510  }
511  }
512 
513 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
514 #pragma warning(pop)
515 #endif
516 #endif
boost::exception::exception
exception()
Definition: exception.hpp:230
boost::exception_detail::refcount_ptr::refcount_ptr
refcount_ptr(refcount_ptr const &x)
Definition: exception.hpp:37
boost::exception_detail::clone_base::~clone_base
virtual ~clone_base()
Definition: exception.hpp:423
boost::exception_detail::refcount_ptr
Definition: exception.hpp:22
boost::error_info< throw_line_, int >
Definition: exception.hpp:122
boost::exception_detail::clone_impl
Definition: exception.hpp:458
boost::error_info< throw_function_, char const * >::value_type
const char * value_type
Definition: exception.hpp:98
boost::exception_detail::enable_error_info_helper< T, sizeof(small_size)>::type
error_info_injector< T > type
Definition: exception.hpp:383
boost::exception_detail::refcount_ptr::adopt
void adopt(T *px)
Definition: exception.hpp:51
boost::exception_detail::copy_boost_exception
void copy_boost_exception(void *, void const *)
Definition: exception.hpp:448
boost::exception_detail::enable_error_info_return_type::type
enable_error_info_helper< T, sizeof(exception_detail::dispatch_boost_exception(static_cast< T * >0)))>::type type
Definition: exception.hpp:390
boost::shared_ptr
Definition: exception.hpp:148
T
T
Definition: mem_fn_cc.hpp:25
boost::error_info< throw_file_, char const * >::v_
value_type v_
Definition: exception.hpp:113
boost::error_info
Definition: exception.hpp:87
boost::exception_detail::refcount_ptr::add_ref
void add_ref()
Definition: exception.hpp:69
boost::multi_index::get
nth_index< multi_index_container< Value, IndexSpecifierList, Allocator >, N >::type & get(multi_index_container< Value, IndexSpecifierList, Allocator > &m) BOOST_NOEXCEPT
Definition: multi_index_container.hpp:981
boost::exception_detail::clone_base
Definition: exception.hpp:414
boost::error_info< throw_file_, char const * >::error_info
error_info(value_type v)
Definition: exception.hpp:115
boost::error_info< throw_file_, char const * >::value_type
const char * value_type
Definition: exception.hpp:112
boost::exception_detail::error_info_injector::error_info_injector
error_info_injector(T const &x)
Definition: exception.hpp:348
boost::exception_detail::refcount_ptr::~refcount_ptr
~refcount_ptr()
Definition: exception.hpp:32
boost::exception_detail::enable_error_info_helper
Definition: exception.hpp:370
boost::throw_file
error_info< struct throw_file_, char const * > throw_file
Definition: exception.hpp:90
boost::exception_detail::refcount_ptr::operator=
refcount_ptr & operator=(refcount_ptr const &x)
Definition: exception.hpp:44
boost::enable_current_exception
exception_detail::clone_impl< T > enable_current_exception(T const &x)
Definition: exception.hpp:507
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::exception::data_
exception_detail::refcount_ptr< exception_detail::error_info_container > data_
Definition: exception.hpp:286
boost::exception_detail::enable_error_info_helper< T, sizeof(large_size)>::type
T type
Definition: exception.hpp:376
data
data
boost::error_info< throw_function_, char const * >::v_
value_type v_
Definition: exception.hpp:99
boost::exception_detail::error_info_injector::~error_info_injector
~error_info_injector()
Definition: exception.hpp:353
boost::exception_detail::error_info_injector
Definition: exception.hpp:342
boost::exception::throw_line_
int throw_line_
Definition: exception.hpp:289
boost::exception_detail::refcount_ptr::get
T * get() const
Definition: exception.hpp:59
boost::exception_detail::error_info_container::~error_info_container
~error_info_container()
Definition: exception.hpp:168
boost::exception_detail::dispatch_boost_exception
small_size dispatch_boost_exception(void const *)
d
d
boost::throw_function
error_info< struct throw_function_, char const * > throw_function
Definition: exception.hpp:87
boost::enable_error_info
exception_detail::enable_error_info_return_type< T >::type enable_error_info(T const &x)
Definition: exception.hpp:398
boost::exception_detail::get_diagnostic_information
const char * get_diagnostic_information(exception const &, char const *)
boost::exception_detail::get_info
Definition: exception.hpp:174
boost::error_info< throw_line_, int >::error_info
error_info(value_type v)
Definition: exception.hpp:129
boost::exception_detail::clone_impl::clone
const clone_base * clone() const
Definition: exception.hpp:486
boost::exception::throw_file_
const char * throw_file_
Definition: exception.hpp:288
set
ROSCPP_DECL void set(const std::string &key, bool b)
boost::error_info< throw_line_, int >::value_type
int value_type
Definition: exception.hpp:126
boost::exception_detail::clone_impl::clone_tag
Definition: exception.hpp:463
boost::error_info< throw_function_, char const * >::error_info
error_info(value_type v)
Definition: exception.hpp:101
boost::exception::throw_function_
const char * throw_function_
Definition: exception.hpp:287
boost::error_info< throw_line_, int >::v_
value_type v_
Definition: exception.hpp:127
boost::exception
Definition: exception.hpp:219
boost::exception_detail::refcount_ptr::release
void release()
Definition: exception.hpp:76
boost::error_info< throw_file_, char const * >
Definition: exception.hpp:108
boost::exception_detail::refcount_ptr::px_
T * px_
Definition: exception.hpp:66
boost::exception_detail::refcount_ptr::refcount_ptr
refcount_ptr()
Definition: exception.hpp:27
boost::exception_detail::error_info_container
Definition: exception.hpp:156
boost::exception_detail::clone_impl::rethrow
void rethrow() const
Definition: exception.hpp:492
boost::exception_detail::clone_impl::clone_impl
clone_impl(clone_impl const &x, clone_tag)
Definition: exception.hpp:464
boost::exception_detail::small_size
Definition: exception.hpp:366
boost::throw_line
error_info< struct throw_line_, int > throw_line
Definition: exception.hpp:91
boost::exception_detail::clone_impl::clone_impl
clone_impl(T const &x)
Definition: exception.hpp:473
boost::exception_detail::set_info_rv
Definition: exception.hpp:186
boost::exception_detail::enable_error_info_return_type
Definition: exception.hpp:387
boost::exception_detail::clone_impl::~clone_impl
~clone_impl()
Definition: exception.hpp:479
boost::exception_detail::large_size
Definition: exception.hpp:363
boost::error_info< throw_function_, char const * >
Definition: exception.hpp:94
boost::exception_detail::set_info
const E & set_info(E const &, throw_line const &)
Definition: exception.hpp:324


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:39:00