- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MComputation Class Reference

# OpenMaya - API module for common classes

Search for all occurrences

## Detailed Description

Interupt monitor for long computations.

An MComputation allows long computations to check for user interrupts. It is very simple to use. Create a new MComputation object and call the beginComputation method at the beginning of the computation and call the endComputation method when you finish. Then, during the computation, use the isInterruptRequested method to check if the user has requested that the computation terminate.

Example: (of a simple traversal)

        MComputation computation;
        computation.beginComputation();
        for (int i= 1; i<1000; i++) {
            Computation();  // Some expensive operation
            if  (computation.isInterruptRequested()) break ;
        }
        computation.endComputation();

Examples:

  animInfoCmd.cpp.

`#include <MComputation.h>`

List of all members.

## Public Member Functions
| MComputation ()
| Constructor for MComputation.
virtual | ~MComputation ()
| Class destructor.
void | beginComputation ()
| Mark the beginning of a long computation.
bool | isInterruptRequested ()
| Query whether a user-interrupt has occurred.
void | endComputation ()
| Mark the ending of a long computation.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.

## Constructor & Destructor Documentation

MComputation | ( |  | ) |

Constructor for MComputation.

Instantiate an MComputation before entering a long computation that should be interruptible.

## Member Function Documentation

void beginComputation | ( |  | ) |

Search for all occurrences

Mark the beginning of a long computation.

The application will begin looking for user interupts.

Examples:
  animInfoCmd.cpp.

bool isInterruptRequested | ( |  | ) |

Search for all occurrences

Query whether a user-interrupt has occurred.

Returns:
  true if an interrupt has occurred

Examples:
  animInfoCmd.cpp.

void endComputation | ( |  | ) |

Search for all occurrences

Mark the ending of a long computation.

The application will stop looking for user interupts.

Examples:
  animInfoCmd.cpp.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation
MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation MComputation