3ds Max C++ API Reference
BailOutManager Class Reference

A wrapper around the underlying IBailOutProcessManager instance. More...

#include <BailOut.h>

+ Inheritance diagram for BailOutManager:

Public Member Functions

 BailOutManager ()
 Plug-ins may have functions of long busy process which can't be accepted by users. More...
 
 ~BailOutManager ()
 Destructor. More...
 
bool ShouldBail ()
 To detect whether the bail-out should jump out the busy process or not. More...
 
bool IsBailOut ()
 To detect whether the bail-out is done or not. More...
 
bool IsBailOutEmbeded ()
 To detect whether the bail-out is embed or not. More...
 

Static Public Member Functions

static voidoperator new (size_t size)
 Copying and dynamic allocation are not supported for this class. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

A wrapper around the underlying IBailOutProcessManager instance.

Ensures proper cleanup of the state of the instance even if we happen to throw out of the function in which it is used.

Constructor & Destructor Documentation

◆ BailOutManager()

BailOutManager ( )
inline

Plug-ins may have functions of long busy process which can't be accepted by users.

In this condition, users can use this interface to escape the long busy process by pressing ESC key.

void LongBusyProcess()
{
using MaxSDK::Util;
BailOutManager bailoutManager;
...
for(int i=0; i<100000; i++)
{
if(bailoutManager.ShouldBail())
{
MemoryClear(); // here users need to clear the memory manually.
break;
}
...
Process()
...
}
}
BailOutManager()
Plug-ins may have functions of long busy process which can't be accepted by users.
Definition: BailOut.h:154
Definition: autoptr.h:488

Constructor

155  {
156  m_manager = GetBailOutManager();
157  m_manager->EmbedBailOut();
158  }
virtual void EmbedBailOut()=0
At the beginning of the busy process, a bail-out can be embed, so that you can trigger the bail-out i...
UtilExport IBailOutBusyProcessManager * GetBailOutManager()

◆ ~BailOutManager()

~BailOutManager ( )
inline

Destructor.

162  {
163  m_manager->BailOutEnd();
164  }
virtual void BailOutEnd()=0
After bail-out operation is done, you need to end the bail-out.

Member Function Documentation

◆ ShouldBail()

bool ShouldBail ( )
inline

To detect whether the bail-out should jump out the busy process or not.

Returns
If true bail-out should jump out the busy process. If false bail-out should not jump out the busy process.
171  {
172  return m_manager->ShouldBail();
173  }
virtual bool ShouldBail()=0
To detect whether the bail-out should jump out the busy process or not.

◆ IsBailOut()

bool IsBailOut ( )
inline

To detect whether the bail-out is done or not.

Returns
If true bail-out is done. If false bail-out is missed.
179  {
180  return m_manager->IsBailOut();
181  }
virtual bool IsBailOut() const =0
To detect whether the bail-out is done or not.

◆ IsBailOutEmbeded()

bool IsBailOutEmbeded ( )
inline

To detect whether the bail-out is embed or not.

Returns
If true bail-out is embed. If false bail-out is not embed.
187  {
188  return m_manager->IsBailOutEmbeded();
189  }
virtual bool IsBailOutEmbeded() const =0
To detect whether the bail-out is embed or not.

◆ operator new()

static void* operator new ( size_t  size)
inlinestatic

Copying and dynamic allocation are not supported for this class.

194  {
195  UNUSED_PARAM(size);
196  throw std::bad_alloc();
197  return NULL;
198  }
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18
#define NULL
Definition: autoptr.h:18