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 247 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 249 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 252 of file tbb_exception.h.

253  : my_exception_data(data_)
254  , my_dynamic(false)
257  typeid(self_type).name()
258 #else /* !TBB_USE_EXCEPTIONS */
259  "movable_exception"
260 #endif /* !TBB_USE_EXCEPTIONS */
261  )
262  {}

◆ movable_exception() [2/2]

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

Definition at line 264 of file tbb_exception.h.

265  : tbb_exception(src)
266  , my_exception_data(src.my_exception_data)
267  , my_dynamic(false)
268  , my_exception_name(src.my_exception_name)
269  {}

◆ ~movable_exception()

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

Definition at line 271 of file tbb_exception.h.

271 {}

Member Function Documentation

◆ data() [1/2]

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

Definition at line 281 of file tbb_exception.h.

281 { return my_exception_data; }

◆ data() [2/2]

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

Definition at line 283 of file tbb_exception.h.

283 { return 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 297 of file tbb_exception.h.

297  {
298  __TBB_ASSERT ( my_dynamic, "Method destroy can be called only on dynamically allocated movable_exceptions" );
299  if ( my_dynamic ) {
300  this->~movable_exception();
302  }
303  }

References __TBB_ASSERT, and tbb::internal::deallocate_via_handler_v3().

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 289 of file tbb_exception.h.

289  {
291  if ( e ) {
292  ::new (e) movable_exception(*this);
293  ((movable_exception*)e)->my_dynamic = true;
294  }
295  return (movable_exception*)e;
296  }

References tbb::internal::allocate_via_handler_v3().

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 285 of file tbb_exception.h.

285 { return my_exception_name; }

◆ operator=()

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

Definition at line 273 of file tbb_exception.h.

273  {
274  if ( this != &src ) {
275  my_exception_data = src.my_exception_data;
276  my_exception_name = src.my_exception_name;
277  }
278  return *this;
279  }

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 304 of file tbb_exception.h.

304 { __TBB_THROW( *this ); }

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 287 of file tbb_exception.h.

287 { 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 312 of file tbb_exception.h.

◆ my_exception_data

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

User data.

Definition at line 308 of file tbb_exception.h.

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

◆ 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 316 of file tbb_exception.h.

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


The documentation for this class was generated from the following file:
tbb::internal::deallocate_via_handler_v3
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
Definition: cache_aligned_allocator.cpp:232
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
tbb::movable_exception::my_exception_data
ExceptionData my_exception_data
User data.
Definition: tbb_exception.h:308
__TBB_THROW
#define __TBB_THROW(e)
Definition: tbb_stddef.h:285
tbb::movable_exception::my_exception_name
const char * my_exception_name
RTTI name of this class.
Definition: tbb_exception.h:316
tbb::movable_exception::self_type
movable_exception< ExceptionData > self_type
Definition: tbb_exception.h:249
TBB_USE_EXCEPTIONS
#define TBB_USE_EXCEPTIONS
Definition: tbb_config.h:463
tbb::movable_exception::my_dynamic
bool my_dynamic
Flag specifying whether this object has been dynamically allocated (by the move method)
Definition: tbb_exception.h:312
tbb::movable_exception::~movable_exception
~movable_exception()
Definition: tbb_exception.h:271
tbb::movable_exception::movable_exception
movable_exception(const ExceptionData &data_)
Definition: tbb_exception.h:252
tbb::internal::allocate_via_handler_v3
void *__TBB_EXPORTED_FUNC allocate_via_handler_v3(size_t n)
Allocates memory using MallocHandler.
Definition: cache_aligned_allocator.cpp:224
tbb::movable_exception::name
const char * name() const __TBB_override
Returns RTTI name of the originally intercepted exception.
Definition: tbb_exception.h:285

Copyright © 2005-2020 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.