MComputation Class Reference
[OpenMaya - API module for common classes]

#include <MComputation.h>

List of all members.


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.


Public Member Functions

  MComputation ()
virtual  ~MComputation ()
void  beginComputation ()
bool  isInterruptRequested ()
void  endComputation ()

Constructor & Destructor Documentation

MComputation::MComputation (  ) 

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

MComputation::~MComputation (  )  [virtual]

Class destructor


Member Function Documentation

void MComputation::beginComputation (  ) 

Mark the beginning of a long computation. The application will begin looking for user interupts.

Examples:

bool MComputation::isInterruptRequested (  ) 

Query whether a user-interrupt has occurred.

Returns:
true if an interrupt has occurred
Examples:

void MComputation::endComputation (  ) 

Mark the ending of a long computation. The application will stop looking for user interupts.

Examples:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6