Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SUIT_Operation Class Reference

Base class for all operations. More...

#include <SUIT_Operation.h>

Inheritance diagram for SUIT_Operation:
Inheritance graph

Public Types

enum  OperationState { Waiting, Running, Suspended }
 
enum  ExecStatus { Rejected, Accepted }
 
enum  Flags { None = 0x00, Transaction = 0x01 }
 

Public Slots

void start ()
 Starts operation. More...
 
void abort ()
 Aborts operation. More...
 
void commit ()
 Commits operation. More...
 
void resume ()
 Resumes operation. More...
 
void suspend ()
 Suspend operation. More...
 

Signals

void started (SUIT_Operation *)
 
void aborted (SUIT_Operation *)
 
void committed (SUIT_Operation *)
 
void stopped (SUIT_Operation *)
 
void resumed (SUIT_Operation *)
 
void suspended (SUIT_Operation *)
 
void callSlot ()
 

Public Member Functions

 SUIT_Operation (SUIT_Application *)
 Constructor. More...
 
virtual ~SUIT_Operation ()
 Destructor. More...
 
OperationState state () const
 Gets state of operation. More...
 
bool isActive () const
 Verifies whether operation is an active for study. More...
 
bool isRunning () const
 Verifies whether operation is an runned one (state()==Running) More...
 
SUIT_Studystudy () const
 Returns operation study. More...
 
virtual void setStudy (SUIT_Study *theStudy)
 Sets operation study. More...
 
SUIT_Applicationapplication () const
 Gets application. More...
 
virtual void setApplication (SUIT_Application *theApp)
 Sets application. More...
 
virtual bool isValid (SUIT_Operation *theOtherOp) const
 Verifies whether given operator is valid for this one. More...
 
virtual bool isGranted () const
 Verifies whether this operator can be always started above any already runnig one. More...
 
bool setSlot (const QObject *theReceiver, const char *theSlot)
 Sets slot which is called when operation is started. More...
 
void setFlags (const int)
 Sets the flags of operation. More...
 
void clearFlags (const int)
 Clears the flags of operation. More...
 
bool testFlags (const int) const
 Test the flags of operation. More...
 
virtual QString operationName () const
 Name of the operation. More...
 
int execStatus () const
 Gets execution status. More...
 

Protected Member Functions

virtual bool isReadyToStart () const
 Verifies whether operator is ready to start. More...
 
virtual void stopOperation ()
 Virtual method called when operation is started. More...
 
virtual void startOperation ()
 Virtual method called when operation is started. More...
 
virtual void abortOperation ()
 Virtual method called when operation aborted. More...
 
virtual void commitOperation ()
 Virtual method called when operation committed. More...
 
virtual void resumeOperation ()
 Virtual method called when operation resumed. More...
 
virtual void suspendOperation ()
 Virtual method called when operation suspended. More...
 
virtual bool openTransaction ()
 Opens transaction for data modifications. More...
 
virtual bool abortTransaction ()
 Aborts transaction and all performed data modifications. More...
 
virtual bool hasTransaction () const
 Returns true if transaction is opened. More...
 
virtual bool commitTransaction (const QString &=QString())
 Commits transaction and all performed data modifications. More...
 
void setExecStatus (const int)
 Sets execution status. More...
 
void setState (const OperationState)
 Sets state of operation. More...
 
void start (SUIT_Operation *, const bool=false)
 Starts operator above this one. More...
 

Private Types

typedef QPointer< SUIT_StudyStudyPtr
 

Private Attributes

SUIT_ApplicationmyApp
 application for this operation More...
 
int myFlags
 operation flags More...
 
StudyPtr myStudy
 study for this operation More...
 
OperationState myState
 Operation state. More...
 
ExecStatus myExecStatus
 Execution status. More...
 

Friends

class SUIT_Study
 

Detailed Description

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

Member Typedef Documentation

typedef QPointer<SUIT_Study> SUIT_Operation::StudyPtr
private

Member Enumeration Documentation

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.

Enum describes setting of the operation.

Enumerator
None 

None options.

Transaction 

Automatically open (commit/abort) transaction during start (commit/abort).

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)

Constructor & Destructor Documentation

SUIT_Operation::SUIT_Operation ( SUIT_Application app)
Parameters
SUIT_Application- application for this operation

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 ( )
virtual

Member Function Documentation

void SUIT_Operation::abort ( )
slot

Public slot. Aborts operation. This slot is not virtual and cannot be redefined. Redefine abortOperation method to change behavior of operation instead

References SUIT_Study::abort(), aborted(), abortOperation(), myState, stopOperation(), stopped(), study(), and Waiting.

void SUIT_Operation::aborted ( SUIT_Operation )
signal
void SUIT_Operation::abortOperation ( )
protectedvirtual

Virtual method called when operation aborted (see abort() method for more description)

Reimplemented in LightApp_Operation.

bool SUIT_Operation::abortTransaction ( )
protectedvirtual
SUIT_Application * SUIT_Operation::application ( ) const
Returns
Pointer to application

Gets application for this operation

References myApp.

void SUIT_Operation::callSlot ( )
signal
void SUIT_Operation::clearFlags ( const int  f)
Parameters
f- flags of operation to be cleared

Clears flags of operation (see Flags enumeration)

References myFlags.

void SUIT_Operation::commit ( )
slot

Public slot. Commits operation. This slot is not virtual and cannot be redefined. Redefine commitOperation method to change behavior of operation instead

References SUIT_Study::commit(), commitOperation(), committed(), myState, stopOperation(), stopped(), study(), and Waiting.

void SUIT_Operation::commitOperation ( )
protectedvirtual

Virtual method called when operation committed (see commit() method for more description)

Reimplemented in LightApp_Operation.

void SUIT_Operation::committed ( SUIT_Operation )
signal
bool SUIT_Operation::commitTransaction ( const QString &  name = QString())
protectedvirtual
int SUIT_Operation::execStatus ( ) const
Returns
Execution status

Gets execution status

References myExecStatus.

bool SUIT_Operation::hasTransaction ( ) const
protectedvirtual
bool SUIT_Operation::isActive ( ) const
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().

bool SUIT_Operation::isGranted ( ) const
virtual
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.

bool SUIT_Operation::isReadyToStart ( ) const
protectedvirtual
Returns
true if operation is ready to start

Default implementation returns true. Redefine this method to add own verifications

bool SUIT_Operation::isRunning ( ) const
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().

bool SUIT_Operation::isValid ( SUIT_Operation theOtherOp) const
virtual
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)

bool SUIT_Operation::openTransaction ( )
protectedvirtual
QString SUIT_Operation::operationName ( ) const
virtual

Returns string name of the operation. This name will be used for automatically commited transaction.

void SUIT_Operation::resume ( )
slot

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().

void SUIT_Operation::resumed ( SUIT_Operation )
signal
void SUIT_Operation::resumeOperation ( )
protectedvirtual

Virtual method called when operation resumed (see resume() method for more description)

Reimplemented in LightApp_Operation.

void SUIT_Operation::setApplication ( SUIT_Application theApp)
virtual
Parameters
theApp- application for this operation

Gets application for this operation

References myApp.

void SUIT_Operation::setExecStatus ( const int  theVal)
protected
Parameters
theStatus- execution status

Sets myExecStatus to the given value

References myExecStatus.

void SUIT_Operation::setFlags ( const int  f)
Parameters
f- flags of operation to be set

Sets flags of operation (see Flags enumeration)

References myFlags.

bool SUIT_Operation::setSlot ( const QObject theReceiver,
const char *  theSlot 
)
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().

void SUIT_Operation::setState ( const OperationState  theState)
protected
Parameters
theState- state of operation to be set

Sets state of operation (see OperationState enumeration)

References myState.

void SUIT_Operation::setStudy ( SUIT_Study theStudy)
virtual
Parameters
theStudy- study corresponding to this operation

Sets study corresponding to this operation i.e. study which starts this operation.

References myStudy.

void SUIT_Operation::start ( )
slot

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().

void SUIT_Operation::start ( SUIT_Operation op,
const bool  check = false 
)
protected
Parameters
theOp- operation to be started

Start operator above this one. Use this method if you want to call other operator from this one

References abort(), SUIT_Study::start(), start(), stopped(), and study().

void SUIT_Operation::started ( SUIT_Operation )
signal
void SUIT_Operation::startOperation ( )
protectedvirtual

Virtual method called when operation started (see start() method for more description)

Reimplemented in LightApp_Operation, and LightApp_ShowHideOp.

References callSlot(), and commit().

SUIT_Operation::OperationState SUIT_Operation::state ( ) const
Returns
Value from OperationState enumeration

Gets state of operation (see OperationState enumeration)

References myState.

void SUIT_Operation::stopOperation ( )
protectedvirtual

Virtual method called when operation stopped - comitted or aborted.

void SUIT_Operation::stopped ( SUIT_Operation )
signal
SUIT_Study * SUIT_Operation::study ( ) const
Returns
Pointer to study

Get study corresponding to this operation i.e. study which starts this operation.

References myStudy.

void SUIT_Operation::suspend ( )
slot

Public slot. Suspend operation. This slot is called when operation is suspended (for starting other one, for example) This slot is not virtual and cannot be redefined. Redefine suspendOperation method to change behavior of operation instead

References myState, study(), SUIT_Study::suspend(), Suspended, suspended(), and suspendOperation().

void SUIT_Operation::suspended ( SUIT_Operation )
signal
void SUIT_Operation::suspendOperation ( )
protectedvirtual

Virtual method called when operation suspended (see suspend() method for more description)

Reimplemented in LightApp_Operation.

bool SUIT_Operation::testFlags ( const int  f) const
Parameters
f- flags of operation to be tested

Returns true if the specified flags setted in the operation (see Flags enumeration)

References myFlags.

Friends And Related Function Documentation

friend class SUIT_Study
friend

Member Data Documentation

SUIT_Application* SUIT_Operation::myApp
private
ExecStatus SUIT_Operation::myExecStatus
private
int SUIT_Operation::myFlags
private
OperationState SUIT_Operation::myState
private
StudyPtr SUIT_Operation::myStudy
private

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