IBailOutBusyProcessManager Class Reference
 
 
 
IBailOutBusyProcessManager Class Reference

This reference page is linked to from the following overview topics: New Classes and Methods.


#include <BailOut.h>

Inheritance diagram for IBailOutBusyProcessManager:
MaxHeapOperators

Class Description

An interface of bailing out the busy processing functions by pressing the 'Esc' key.

Public Member Functions

virtual  ~IBailOutBusyProcessManager ()
  Plug-ins may have functions of long busy process which can't be accepted by users.
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 in the busy process to jump out the busy process.
virtual void  BailOutEnd ()=0
  After bail-out operation is done, you need to end the bail-out.
virtual bool  ShouldBail ()=0
  To detect whether the bail-out should jump out the busy process or not.
virtual bool  IsBailOut () const =0
  To detect whether the bail-out is done or not.
virtual bool  IsBailOutEmbeded () const =0
  To detect whether the bail-out is embed or not.

Constructor & Destructor Documentation

virtual ~IBailOutBusyProcessManager ( ) [inline, virtual]

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;
                        ...
                        if(GetBailOutManager())
                        {
                                GetBailOutManager()->EmbedBailOut();
                        }
                        
                        for(int i=0; i<100000; i++)
                        {
                           if(GetBailOutManager() && GetBailOutManager()->ShouldBail())
                           {
                                   MemoryClear(); // here users need to clear the memory manually.
                               break;
                           }
                           ...
                           Process()
                           ...
                        }
                        if(GetBailOutManager())
                        {
                                GetBailOutManager()->BailOutEnd();
                        }
                }

Destructor

{}

Member Function Documentation

virtual void EmbedBailOut ( ) [pure virtual]

At the beginning of the busy process, a bail-out can be embed, so that you can trigger the bail-out in the busy process to jump out the busy process.

For example, you can embed bail-out at the front of long time loop.

virtual void BailOutEnd ( ) [pure virtual]

After bail-out operation is done, you need to end the bail-out.

virtual bool ShouldBail ( ) [pure virtual]

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.
virtual bool IsBailOut ( ) const [pure virtual]

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

Returns:
If true bail-out is done. If false bail-out is missed.
virtual bool IsBailOutEmbeded ( ) const [pure virtual]

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

Returns:
If true bail-out is embed. If false bail-out is not embed.