HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Interrupt Class Reference

#include <UT_Interrupt.h>

+ Inheritance diagram for UT_Interrupt:

Public Types

enum  Priority { PRIORITY_TRANSIENT = 0, PRIORITY_NODE = 1, PRIORITY_PERMANENT = 2 }
 

Public Member Functions

 UT_Interrupt (const char *app_title=0)
 
 ~UT_Interrupt () override
 
void setEnabled (int state, int print_longtext=0)
 
bool isEnabled () const
 
void setUseLocks (int)
 
bool setInterruptable (bool allow, bool *prev_enabled=nullptr, bool allow_ui=false)
 
bool getInterruptable () const
 
UT_LockgetInterruptableLock ()
 
bool getAllowUI () const
 
void clearStickyInterrupts ()
 
bool stickyInterrupts () const
 
void setStickyInterrupts ()
 
int getOpDepth () const
 
void setAppTitle (const char *title)
 
UT_StringHolder getAppTitle () const
 
void setActiveCallback (UT_InterruptCB function)
 
void setInterruptHandler (UT_InterruptHandler *hand)
 
UT_InterruptHandlergetInterruptHandler ()
 
void pushInterruptCallback (void(*callback)())
 
void popInterruptCallback ()
 
void interrupt (int)
 
void interrupt ()
 
void pause (bool dopause)
 
bool isPaused () const
 
void setSignalCallback (UTsigHandler function)
 
bool testMemoryThreshold ()
 
bool readyForInterrupts () const
 
void delayNextInterrupt ()
 
int opStart (const char *opname=0, int npoll=0, int immediate_dialog=0, int *opid=0)
 
int opStartPriority (int priority, const char *opname=0, int npoll=0, int immediate_dialog=0, int *opid=0)
 
int opStartMessage (int priority, const UT_InterruptMessage &msg, int immediate_dialog=0, int *opid=0)
 
int opInterrupt (int percent=-1)
 
void opEnd (int opid=-1)
 
void setLongOpText (const UT_StringHolder &longoptext)
 
void setLongPercent (float percent)
 

Static Public Member Functions

static void setUpdateModeCallback (OPUI_UpdateModeCB function)
 
static void setEscapeCheckCallback (UI_CheckForEscapeCB function)
 
static bool getIsEscapeCheckCallbackSet ()
 

Protected Member Functions

const char * getSharedKey () const
 
- Protected Member Functions inherited from UT_SharedMem
 UT_SharedMem (const char *keypath=0, int size=0, int keyid=0)
 
 UT_SharedMem (key_t key, int size)
 
 UT_SharedMem (int size)
 
virtual ~UT_SharedMem ()
 
 UT_SharedMem (const UT_SharedMem &)=delete
 
UT_SharedMemoperator= (const UT_SharedMem &)=delete
 
int setKey (const char *path, int id=0)
 
int setKey (key_t key)
 
int setSize (int size)
 
int detach ()
 
int destroy ()
 
virtual voidgetMemory (int reuse=1)
 

Additional Inherited Members

- Protected Attributes inherited from UT_SharedMem
UT_String ourKeyPath
 
int ourKeyId
 

Detailed Description

Member Enumeration Documentation

When interrupts nest, it is not always useful to display the entire stack of interrupts. Priority is used to control if the interrupt should be shown. 1) All PERMANENT messages are shown. 2) Only the topmost NODE is shown, provided it isn't shadowed by a PERMANENT. 3) Only the topmost TRANSIENT is shown, provided it isn't shadowed by a PERMANENT or NODE. Node cooking in Houdini uses the NODE level, so for most ad-hoc interrupt messages the TRANSIENT level is best.

Enumerator
PRIORITY_TRANSIENT 
PRIORITY_NODE 
PRIORITY_PERMANENT 

Definition at line 141 of file UT_Interrupt.h.

Constructor & Destructor Documentation

UT_Interrupt::UT_Interrupt ( const char *  app_title = 0)
explicit
UT_Interrupt::~UT_Interrupt ( )
override

Member Function Documentation

void UT_Interrupt::clearStickyInterrupts ( )
void UT_Interrupt::delayNextInterrupt ( )
inline

Resets the ready for interrupt so no interrupts will be triggered until the hystersis interval (~200ms) occurs

Definition at line 309 of file UT_Interrupt.h.

bool UT_Interrupt::getAllowUI ( ) const
inline

Definition at line 175 of file UT_Interrupt.h.

UT_StringHolder UT_Interrupt::getAppTitle ( ) const
inline

Definition at line 240 of file UT_Interrupt.h.

bool UT_Interrupt::getInterruptable ( ) const
inline

Definition at line 173 of file UT_Interrupt.h.

UT_Lock& UT_Interrupt::getInterruptableLock ( )
inline

Definition at line 174 of file UT_Interrupt.h.

UT_InterruptHandler* UT_Interrupt::getInterruptHandler ( )
inline

Definition at line 254 of file UT_Interrupt.h.

static bool UT_Interrupt::getIsEscapeCheckCallbackSet ( )
inlinestatic

Definition at line 265 of file UT_Interrupt.h.

int UT_Interrupt::getOpDepth ( ) const
inline

Definition at line 188 of file UT_Interrupt.h.

const char* UT_Interrupt::getSharedKey ( ) const
protected
void UT_Interrupt::interrupt ( int  )
inline

Definition at line 281 of file UT_Interrupt.h.

void UT_Interrupt::interrupt ( )
bool UT_Interrupt::isEnabled ( ) const
inline

Definition at line 156 of file UT_Interrupt.h.

bool UT_Interrupt::isPaused ( ) const
void UT_Interrupt::opEnd ( int  opid = -1)

To use the long operation mechanism invoke "opStart" once, giving the name of the operation and (if possible) an estimate of the number of calls which are planned to be made to the opInterrupt method. The start method will return zero if the operation has already been terminated (possibly from a containing long operation) and should not even start. In that case, you must still call opEnd(). It will return one if the operation can proceed normally.

During the long operation, invoke the "opInterrupt" method (if possible, giving a value between 0 and 100 indicating the percentage of the operation that is complete). This method will return zero if the operation should continue and one if a request was made to terminate. When the operation is complete, invoke the "opEnd" method. This should be called even if the operation was interrupted.

The 'immediate_dialog' flag causes the idialog program to be started immediately instead of waiting for a timeout. This is the only way to start the idialog progress monitor, and should only be used for very long operations where the user would minimize Houdini (like rendering)

The opid can be used to verify nesting of interrupts. It can be passed to opEnd to verify that the nesting is proper...

These methods are now thread safe. Only the main thread will start the interrupt server.

Examples:
CHOP/CHOP_Blend.C, and CHOP/CHOP_Spring.C.
int UT_Interrupt::opInterrupt ( int  percent = -1)

To use the long operation mechanism invoke "opStart" once, giving the name of the operation and (if possible) an estimate of the number of calls which are planned to be made to the opInterrupt method. The start method will return zero if the operation has already been terminated (possibly from a containing long operation) and should not even start. In that case, you must still call opEnd(). It will return one if the operation can proceed normally.

During the long operation, invoke the "opInterrupt" method (if possible, giving a value between 0 and 100 indicating the percentage of the operation that is complete). This method will return zero if the operation should continue and one if a request was made to terminate. When the operation is complete, invoke the "opEnd" method. This should be called even if the operation was interrupted.

The 'immediate_dialog' flag causes the idialog program to be started immediately instead of waiting for a timeout. This is the only way to start the idialog progress monitor, and should only be used for very long operations where the user would minimize Houdini (like rendering)

The opid can be used to verify nesting of interrupts. It can be passed to opEnd to verify that the nesting is proper...

These methods are now thread safe. Only the main thread will start the interrupt server.

Examples:
CHOP/CHOP_Blend.C, CHOP/CHOP_Spring.C, SIM/SIM_GasAdd.C, and tetprim/GEO_PrimTetra.h.
int UT_Interrupt::opStart ( const char *  opname = 0,
int  npoll = 0,
int  immediate_dialog = 0,
int opid = 0 
)

To use the long operation mechanism invoke "opStart" once, giving the name of the operation and (if possible) an estimate of the number of calls which are planned to be made to the opInterrupt method. The start method will return zero if the operation has already been terminated (possibly from a containing long operation) and should not even start. In that case, you must still call opEnd(). It will return one if the operation can proceed normally.

During the long operation, invoke the "opInterrupt" method (if possible, giving a value between 0 and 100 indicating the percentage of the operation that is complete). This method will return zero if the operation should continue and one if a request was made to terminate. When the operation is complete, invoke the "opEnd" method. This should be called even if the operation was interrupted.

The 'immediate_dialog' flag causes the idialog program to be started immediately instead of waiting for a timeout. This is the only way to start the idialog progress monitor, and should only be used for very long operations where the user would minimize Houdini (like rendering)

The opid can be used to verify nesting of interrupts. It can be passed to opEnd to verify that the nesting is proper...

These methods are now thread safe. Only the main thread will start the interrupt server.

Examples:
CHOP/CHOP_Blend.C, and CHOP/CHOP_Spring.C.
int UT_Interrupt::opStartMessage ( int  priority,
const UT_InterruptMessage msg,
int  immediate_dialog = 0,
int opid = 0 
)

To use the long operation mechanism invoke "opStart" once, giving the name of the operation and (if possible) an estimate of the number of calls which are planned to be made to the opInterrupt method. The start method will return zero if the operation has already been terminated (possibly from a containing long operation) and should not even start. In that case, you must still call opEnd(). It will return one if the operation can proceed normally.

During the long operation, invoke the "opInterrupt" method (if possible, giving a value between 0 and 100 indicating the percentage of the operation that is complete). This method will return zero if the operation should continue and one if a request was made to terminate. When the operation is complete, invoke the "opEnd" method. This should be called even if the operation was interrupted.

The 'immediate_dialog' flag causes the idialog program to be started immediately instead of waiting for a timeout. This is the only way to start the idialog progress monitor, and should only be used for very long operations where the user would minimize Houdini (like rendering)

The opid can be used to verify nesting of interrupts. It can be passed to opEnd to verify that the nesting is proper...

These methods are now thread safe. Only the main thread will start the interrupt server.

int UT_Interrupt::opStartPriority ( int  priority,
const char *  opname = 0,
int  npoll = 0,
int  immediate_dialog = 0,
int opid = 0 
)

To use the long operation mechanism invoke "opStart" once, giving the name of the operation and (if possible) an estimate of the number of calls which are planned to be made to the opInterrupt method. The start method will return zero if the operation has already been terminated (possibly from a containing long operation) and should not even start. In that case, you must still call opEnd(). It will return one if the operation can proceed normally.

During the long operation, invoke the "opInterrupt" method (if possible, giving a value between 0 and 100 indicating the percentage of the operation that is complete). This method will return zero if the operation should continue and one if a request was made to terminate. When the operation is complete, invoke the "opEnd" method. This should be called even if the operation was interrupted.

The 'immediate_dialog' flag causes the idialog program to be started immediately instead of waiting for a timeout. This is the only way to start the idialog progress monitor, and should only be used for very long operations where the user would minimize Houdini (like rendering)

The opid can be used to verify nesting of interrupts. It can be passed to opEnd to verify that the nesting is proper...

These methods are now thread safe. Only the main thread will start the interrupt server.

void UT_Interrupt::pause ( bool  dopause)
void UT_Interrupt::popInterruptCallback ( )
void UT_Interrupt::pushInterruptCallback ( void(*)()  callback)
bool UT_Interrupt::readyForInterrupts ( ) const
inline

We have some hystersis from starting a computation and accepting the first interrupt, this avoids interactive computations from suddenly getting interrupted by escape keys.

Definition at line 302 of file UT_Interrupt.h.

void UT_Interrupt::setActiveCallback ( UT_InterruptCB  function)
inline

Definition at line 245 of file UT_Interrupt.h.

void UT_Interrupt::setAppTitle ( const char *  title)
void UT_Interrupt::setEnabled ( int  state,
int  print_longtext = 0 
)
static void UT_Interrupt::setEscapeCheckCallback ( UI_CheckForEscapeCB  function)
inlinestatic

Definition at line 263 of file UT_Interrupt.h.

bool UT_Interrupt::setInterruptable ( bool  allow,
bool *  prev_enabled = nullptr,
bool  allow_ui = false 
)
void UT_Interrupt::setInterruptHandler ( UT_InterruptHandler hand)
inline

Definition at line 248 of file UT_Interrupt.h.

void UT_Interrupt::setLongOpText ( const UT_StringHolder longoptext)

Call this before a new set of opStart()s are called. It will also cause idialog to configure the user interface with two text boxes instead of the usual single line. After that, you can call setLongOpText() to modify the second line message.

void UT_Interrupt::setLongPercent ( float  percent)

Call this before a new set of opStart()s are called. It will also cause idialog to configure the user interface with two text boxes instead of the usual single line. After that, you can call setLongOpText() to modify the second line message.

void UT_Interrupt::setSignalCallback ( UTsigHandler  function)
void UT_Interrupt::setStickyInterrupts ( )
static void UT_Interrupt::setUpdateModeCallback ( OPUI_UpdateModeCB  function)
inlinestatic

Definition at line 258 of file UT_Interrupt.h.

void UT_Interrupt::setUseLocks ( int  )
inline

Definition at line 160 of file UT_Interrupt.h.

bool UT_Interrupt::stickyInterrupts ( ) const
inline

Definition at line 185 of file UT_Interrupt.h.

bool UT_Interrupt::testMemoryThreshold ( )
inline

Definition at line 293 of file UT_Interrupt.h.


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