Base class for all operations.
More...
#include <SUIT_Operation.h>
Base class for all operations.
Base class for all operations. If you perform an action it is reasonable to create operation intended for this. This is a base class for all operations which provides mechanism for correct starting operations, starting operations above already started ones, committing operations and so on. To create own operation it is reasonable to inherit it from this class and redefines virtual methods to provide own behavior Main virtual methods are
◆ StudyPtr
◆ ExecStatus
Enum describes execution status of operation. Execution status often used after ending work of operation which was started from this one. In this case this operation can ask previously started operation whether it finished successfully.
Enumerator |
---|
Rejected | Operation has not performed any action (modification of data model for example)
|
Accepted | Operation has performed an actions and must be stopped.
|
◆ Flags
Enum describes setting of the operation.
Enumerator |
---|
None | None options.
|
Transaction | Automatically open (commit/abort) transaction during start (commit/abort).
|
◆ OperationState
Enum describes state of operation
Enumerator |
---|
Waiting | Operation is not used (it is not run or suspended)
|
Running | Operation is started.
|
Suspended | Operation is started but suspended (other operation is performed above it)
|
◆ SUIT_Operation()
Constructor.
- Parameters
-
Constructs an empty operation. Constructor should work very fast because many operators may be created after starting application but only several from them may be used. As result this constructor stores given application in myApp field and set Waiting status.
◆ ~SUIT_Operation()
SUIT_Operation::~SUIT_Operation |
( |
| ) |
|
|
virtual |
◆ abort
void SUIT_Operation::abort |
( |
| ) |
|
|
slot |
◆ aborted
◆ abortOperation()
void SUIT_Operation::abortOperation |
( |
| ) |
|
|
protectedvirtual |
Virtual method called when operation aborted.
Virtual method called when operation aborted (see abort() method for more description)
Reimplemented in LightApp_Operation.
◆ abortTransaction()
bool SUIT_Operation::abortTransaction |
( |
| ) |
|
|
protectedvirtual |
◆ application()
Gets application.
- Returns
- Pointer to application
Gets application for this operation
References myApp.
◆ callSlot
void SUIT_Operation::callSlot |
( |
| ) |
|
|
signal |
◆ clearFlags()
void SUIT_Operation::clearFlags |
( |
const int |
f | ) |
|
Clears the flags of operation.
- Parameters
-
f | - flags of operation to be cleared |
Clears flags of operation (see Flags enumeration)
References myFlags.
◆ commit
void SUIT_Operation::commit |
( |
| ) |
|
|
slot |
◆ commitOperation()
void SUIT_Operation::commitOperation |
( |
| ) |
|
|
protectedvirtual |
Virtual method called when operation committed.
Virtual method called when operation committed (see commit() method for more description)
Reimplemented in LightApp_Operation.
◆ committed
◆ commitTransaction()
bool SUIT_Operation::commitTransaction |
( |
const QString & |
name = QString() | ) |
|
|
protectedvirtual |
◆ execStatus()
int SUIT_Operation::execStatus |
( |
| ) |
const |
Gets execution status.
- Returns
- Execution status
Gets execution status
References myExecStatus.
◆ hasTransaction()
bool SUIT_Operation::hasTransaction |
( |
| ) |
const |
|
protectedvirtual |
◆ isActive()
bool SUIT_Operation::isActive |
( |
| ) |
const |
Verifies whether operation is an active for study.
- Returns
true
if operation is active, false
otherwise
Verifies whether operation is an active on. Returns true
if this operator is active for study
References SUIT_Study::activeOperation(), and study().
◆ isGranted()
bool SUIT_Operation::isGranted |
( |
| ) |
const |
|
virtual |
Verifies whether this operator can be always started above any already runnig one.
- Returns
- Returns
true
if current operation must not be checked for ActiveOperation->IsValid( this )
This method must be redefined in derived operation if operation of derived class must be always can start above any launched one. Default implementation returns false
, so it is being checked for IsValid, but some operations may overload IsGranted() In this case they will always start, no matter what operation is running.
◆ isReadyToStart()
bool SUIT_Operation::isReadyToStart |
( |
| ) |
const |
|
protectedvirtual |
Verifies whether operator is ready to start.
- Returns
true
if operation is ready to start
Default implementation returns true
. Redefine this method to add own verifications
◆ isRunning()
bool SUIT_Operation::isRunning |
( |
| ) |
const |
Verifies whether operation is an runned one (state()==Running)
- Returns
true
if operation is active, false
otherwise
Verifies whether operation is an running. Returns true
if state of operator is Running
References Running, and state().
◆ isValid()
Verifies whether given operator is valid for this one.
- Parameters
-
theOtherOp | - other operation |
- Returns
- Returns
true
if the given operator is valid for this one
Verifies whether given operator is valid for this one (i.e. can be started "above" this operator)
◆ openTransaction()
bool SUIT_Operation::openTransaction |
( |
| ) |
|
|
protectedvirtual |
◆ operationName()
QString SUIT_Operation::operationName |
( |
| ) |
const |
|
virtual |
Name of the operation.
Returns string name of the operation. This name will be used for automatically commited transaction.
◆ resume
void SUIT_Operation::resume |
( |
| ) |
|
|
slot |
Resumes operation.
Public slot. Resumes operation. This slot is called when operation is resumed after previous suspending. This slot is not virtual and cannot be redefined. Redefine resumeOperation method to change behavior of operation instead
References myState, SUIT_Study::resume(), resumed(), resumeOperation(), Running, and study().
◆ resumed
◆ resumeOperation()
void SUIT_Operation::resumeOperation |
( |
| ) |
|
|
protectedvirtual |
Virtual method called when operation resumed.
Virtual method called when operation resumed (see resume() method for more description)
Reimplemented in LightApp_Operation.
◆ setApplication()
Sets application.
- Parameters
-
theApp | - application for this operation |
Gets application for this operation
References myApp.
◆ setExecStatus()
void SUIT_Operation::setExecStatus |
( |
const int |
theVal | ) |
|
|
protected |
Sets execution status.
- Parameters
-
theStatus | - execution status |
Sets myExecStatus to the given value
References myExecStatus.
◆ setFlags()
void SUIT_Operation::setFlags |
( |
const int |
f | ) |
|
Sets the flags of operation.
- Parameters
-
f | - flags of operation to be set |
Sets flags of operation (see Flags enumeration)
References myFlags.
◆ setSlot()
bool SUIT_Operation::setSlot |
( |
const QObject * |
theReceiver, |
|
|
const char * |
theSlot |
|
) |
| |
Sets slot which is called when operation is started.
- Parameters
-
theReceiver | - object containing slot |
theSlot | - slot of theReceiver object |
- Returns
true
if slot was connected successfully, false
otherwise
Sets slot which is called when operation is started. There is no point in using this method. It would be better to inherit own operator from base one and redefine startOperation method
References callSlot().
◆ setState()
void SUIT_Operation::setState |
( |
const |
OperationState | ) |
|
|
protected |
Sets state of operation.
- Parameters
-
theState | - state of operation to be set |
Sets state of operation (see OperationState enumeration)
References myState.
◆ setStudy()
void SUIT_Operation::setStudy |
( |
SUIT_Study * |
theStudy | ) |
|
|
virtual |
Sets operation study.
- Parameters
-
theStudy | - study corresponding to this operation |
Sets study corresponding to this operation i.e. study which starts this operation.
References myStudy.
◆ start [1/2]
void SUIT_Operation::start |
( |
| ) |
|
|
slot |
Starts operation.
Public slot. Verifies whether operation can be started and starts operation. This slot is not virtual and cannot be redefined. Redefine startOperation method to change behavior of operation. There is no point in using this method. It would be better to inherit own operator from base one and redefine startOperation method instead.
References SUIT_Study::start(), started(), startOperation(), and study().
◆ start() [2/2]
void SUIT_Operation::start |
( |
SUIT_Operation * |
op, |
|
|
const bool |
check = false |
|
) |
| |
|
protected |
◆ started
◆ startOperation()
void SUIT_Operation::startOperation |
( |
| ) |
|
|
protectedvirtual |
◆ state()
Gets state of operation.
- Returns
- Value from OperationState enumeration
Gets state of operation (see OperationState enumeration)
References myState.
◆ stopOperation()
void SUIT_Operation::stopOperation |
( |
| ) |
|
|
protectedvirtual |
Virtual method called when operation is started.
Virtual method called when operation stopped - comitted or aborted.
◆ stopped
◆ study()
Returns operation study.
- Returns
- Pointer to study
Get study corresponding to this operation i.e. study which starts this operation.
References myStudy.
◆ suspend
void SUIT_Operation::suspend |
( |
| ) |
|
|
slot |
◆ suspended
◆ suspendOperation()
void SUIT_Operation::suspendOperation |
( |
| ) |
|
|
protectedvirtual |
Virtual method called when operation suspended.
Virtual method called when operation suspended (see suspend() method for more description)
Reimplemented in LightApp_Operation.
◆ testFlags()
bool SUIT_Operation::testFlags |
( |
const int |
f | ) |
const |
Test the flags of operation.
- Parameters
-
f | - flags of operation to be tested |
Returns true
if the specified flags setted in the operation (see Flags enumeration)
References myFlags.
◆ SUIT_Study
◆ myApp
application for this operation
◆ myExecStatus
◆ myFlags
int SUIT_Operation::myFlags |
|
private |
◆ myState
◆ myStudy
The documentation for this class was generated from the following files: