Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::movable_exception< ExceptionData > Class Template Reference

Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread. More...

#include <tbb_exception.h>

Inheritance diagram for tbb::movable_exception< ExceptionData >:
Collaboration diagram for tbb::movable_exception< ExceptionData >:

Public Member Functions

 movable_exception (const ExceptionData &data_)
 
 movable_exception (const movable_exception &src) throw ()
 
 ~movable_exception () throw ()
 
const movable_exceptionoperator= (const movable_exception &src)
 
ExceptionData & data () throw ()
 
const ExceptionData & data () const throw ()
 
const char * name () const __TBB_override throw ()
 Returns RTTI name of the originally intercepted exception. More...
 
const char * what () const __TBB_override throw ()
 Returns the result of originally intercepted exception's what() method. More...
 
movable_exceptionmove () __TBB_override throw ()
 Creates and returns pointer to the deep copy of this exception object. More...
 
void destroy () __TBB_override throw ()
 Destroys objects created by the move() method. More...
 
void throw_self () __TBB_override
 Throws this exception object. More...
 
- Public Member Functions inherited from tbb::tbb_exception
void operator delete (void *p)
 

Protected Attributes

ExceptionData my_exception_data
 User data. More...
 

Private Types

typedef movable_exception< ExceptionData > self_type
 

Private Attributes

bool my_dynamic
 Flag specifying whether this object has been dynamically allocated (by the move method) More...
 
const char * my_exception_name
 RTTI name of this class. More...
 

Detailed Description

template<typename ExceptionData>
class tbb::movable_exception< ExceptionData >

Template that can be used to implement exception that transfers arbitrary ExceptionData to the root thread.

Code using TBB can instantiate this template with an arbitrary ExceptionData type and throw this exception object. Such exceptions are intercepted by the TBB scheduler and delivered to the root thread ().

See also
tbb::tbb_exception

Definition at line 244 of file tbb_exception.h.

Member Typedef Documentation

◆ self_type

template<typename ExceptionData >
typedef movable_exception<ExceptionData> tbb::movable_exception< ExceptionData >::self_type
private

Definition at line 246 of file tbb_exception.h.

Constructor & Destructor Documentation

◆ movable_exception() [1/2]

template<typename ExceptionData >
tbb::movable_exception< ExceptionData >::movable_exception ( const ExceptionData &  data_)
inline

Definition at line 249 of file tbb_exception.h.

250  : my_exception_data(data_)
251  , my_dynamic(false)
254  typeid(self_type).name()
255 #else /* !TBB_USE_EXCEPTIONS */
256  "movable_exception"
257 #endif /* !TBB_USE_EXCEPTIONS */
258  )
259  {}
const char * my_exception_name
RTTI name of this class.
const char * name() const __TBB_override
Returns RTTI name of the originally intercepted exception.
#define TBB_USE_EXCEPTIONS
Definition: tbb_config.h:466
bool my_dynamic
Flag specifying whether this object has been dynamically allocated (by the move method)
movable_exception< ExceptionData > self_type
ExceptionData my_exception_data
User data.

Referenced by tbb::movable_exception< ExceptionData >::move().

Here is the caller graph for this function:

◆ movable_exception() [2/2]

template<typename ExceptionData >
tbb::movable_exception< ExceptionData >::movable_exception ( const movable_exception< ExceptionData > &  src)
throw (
)
inline

Definition at line 261 of file tbb_exception.h.

262  : tbb_exception(src)
263  , my_exception_data(src.my_exception_data)
264  , my_dynamic(false)
265  , my_exception_name(src.my_exception_name)
266  {}
const char * my_exception_name
RTTI name of this class.
bool my_dynamic
Flag specifying whether this object has been dynamically allocated (by the move method)
ExceptionData my_exception_data
User data.

◆ ~movable_exception()

template<typename ExceptionData >
tbb::movable_exception< ExceptionData >::~movable_exception ( )
throw (
)
inline

Definition at line 268 of file tbb_exception.h.

268 {}

Referenced by tbb::movable_exception< ExceptionData >::destroy().

Here is the caller graph for this function:

Member Function Documentation

◆ data() [1/2]

template<typename ExceptionData >
ExceptionData& tbb::movable_exception< ExceptionData >::data ( )
throw (
)
inline

Definition at line 278 of file tbb_exception.h.

278 { return my_exception_data; }
ExceptionData my_exception_data
User data.

References tbb::movable_exception< ExceptionData >::my_exception_data.

◆ data() [2/2]

template<typename ExceptionData >
const ExceptionData& tbb::movable_exception< ExceptionData >::data ( ) const
throw (
)
inline

Definition at line 280 of file tbb_exception.h.

280 { return my_exception_data; }
ExceptionData my_exception_data
User data.

References tbb::movable_exception< ExceptionData >::my_exception_data.

◆ destroy()

template<typename ExceptionData >
void tbb::movable_exception< ExceptionData >::destroy ( )
throw (
)
inlinevirtual

Destroys objects created by the move() method.

Frees memory and calls destructor for this exception object. Can and must be used only on objects created by the move method.

Implements tbb::tbb_exception.

Definition at line 294 of file tbb_exception.h.

294  {
295  __TBB_ASSERT ( my_dynamic, "Method destroy can be called only on dynamically allocated movable_exceptions" );
296  if ( my_dynamic ) {
297  this->~movable_exception();
299  }
300  }
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
bool my_dynamic
Flag specifying whether this object has been dynamically allocated (by the move method)

References __TBB_ASSERT, tbb::internal::deallocate_via_handler_v3(), tbb::movable_exception< ExceptionData >::my_dynamic, and tbb::movable_exception< ExceptionData >::~movable_exception().

Here is the call graph for this function:

◆ move()

template<typename ExceptionData >
movable_exception* tbb::movable_exception< ExceptionData >::move ( )
throw (
)
inlinevirtual

Creates and returns pointer to the deep copy of this exception object.

Move semantics is allowed.

Implements tbb::tbb_exception.

Definition at line 286 of file tbb_exception.h.

286  {
288  if ( e ) {
289  ::new (e) movable_exception(*this);
290  ((movable_exception*)e)->my_dynamic = true;
291  }
292  return (movable_exception*)e;
293  }
movable_exception(const ExceptionData &data_)
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.

References tbb::internal::allocate_via_handler_v3(), and tbb::movable_exception< ExceptionData >::movable_exception().

Here is the call graph for this function:

◆ name()

template<typename ExceptionData >
const char* tbb::movable_exception< ExceptionData >::name ( ) const
throw (
)
inlinevirtual

Returns RTTI name of the originally intercepted exception.

Implements tbb::tbb_exception.

Definition at line 282 of file tbb_exception.h.

282 { return my_exception_name; }
const char * my_exception_name
RTTI name of this class.

References tbb::movable_exception< ExceptionData >::my_exception_name.

◆ operator=()

template<typename ExceptionData >
const movable_exception& tbb::movable_exception< ExceptionData >::operator= ( const movable_exception< ExceptionData > &  src)
inline

Definition at line 270 of file tbb_exception.h.

270  {
271  if ( this != &src ) {
272  my_exception_data = src.my_exception_data;
273  my_exception_name = src.my_exception_name;
274  }
275  return *this;
276  }
const char * my_exception_name
RTTI name of this class.
ExceptionData my_exception_data
User data.

References tbb::movable_exception< ExceptionData >::my_exception_data, and tbb::movable_exception< ExceptionData >::my_exception_name.

◆ throw_self()

template<typename ExceptionData >
void tbb::movable_exception< ExceptionData >::throw_self ( )
inlinevirtual

Throws this exception object.

Make sure that if you have several levels of derivation from this interface you implement or override this method on the most derived level. The implementation is as simple as "throw *this;". Failure to do this will result in exception of a base class type being thrown.

Implements tbb::tbb_exception.

Definition at line 301 of file tbb_exception.h.

301 { __TBB_THROW( *this ); }
#define __TBB_THROW(e)
Definition: tbb_stddef.h:285

References __TBB_THROW.

◆ what()

template<typename ExceptionData >
const char* tbb::movable_exception< ExceptionData >::what ( ) const
throw (
)
inlinevirtual

Returns the result of originally intercepted exception's what() method.

Implements tbb::tbb_exception.

Definition at line 284 of file tbb_exception.h.

284 { return "tbb::movable_exception"; }

Member Data Documentation

◆ my_dynamic

template<typename ExceptionData >
bool tbb::movable_exception< ExceptionData >::my_dynamic
private

Flag specifying whether this object has been dynamically allocated (by the move method)

Definition at line 309 of file tbb_exception.h.

Referenced by tbb::movable_exception< ExceptionData >::destroy().

◆ my_exception_data

template<typename ExceptionData >
ExceptionData tbb::movable_exception< ExceptionData >::my_exception_data
protected

◆ my_exception_name

template<typename ExceptionData >
const char* tbb::movable_exception< ExceptionData >::my_exception_name
private

RTTI name of this class.

We rely on the fact that RTTI names are static string constants.

Definition at line 313 of file tbb_exception.h.

Referenced by tbb::movable_exception< ExceptionData >::name(), and tbb::movable_exception< ExceptionData >::operator=().


The documentation for this class was generated from the following file:

Copyright © 2005-2019 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.