4 * Copyright (C) 2005 CEA/DEN, EDF R&D
8 * File : SUIT_Operation.h
13 #ifndef SUIT_OPERATION_H
14 #define SUIT_OPERATION_H
21 class SUIT_Application;
24 * \brief Base class for all operations
26 * Base class for all operations. If you perform an action it is reasonable to create
27 * operation intended for this. This is a base class for all operations which provides
28 * mechanism for correct starting operations, starting operations above already started
29 * ones, committing operations and so on. To create own operation it is reasonable to
30 * inherit it from this class and redefines virtual methods to provide own behavior
31 * Main virtual methods are
32 * - virtual bool isReadyToStart();
33 * - virtual void startOperation();
34 * - virtual void abortOperation();
35 * - virtual void commitOperation();
36 * - virtual void resumeOperation();
37 * - virtual void suspendOperation();
39 class SUIT_EXPORT SUIT_Operation : public QObject
45 /*! Enum describes state of operation */
48 Waiting, //!< Operation is not used (it is not run or suspended)
49 Running, //!< Operation is started
50 Suspended //!< Operation is started but suspended (other operation is performed above it)
54 * Enum describes execution status of operation. Execution status often used after
55 * ending work of operation which was started from this one. In this case this
56 * operation can ask previously started operation whether it finished successfully.
60 Rejected, //!< Operation has not performed any action (modification of data model for example)
61 Accepted //!< Operation has performed an actions and must be stopped
66 SUIT_Operation( SUIT_Application* );
67 virtual ~SUIT_Operation();
69 OperationState state() const;
70 bool isActive() const;
72 SUIT_Study* study() const;
73 virtual void setStudy( SUIT_Study* theStudy );
75 SUIT_Application* application() const;
76 virtual void setApplication( SUIT_Application* theApp );
78 virtual bool isValid( SUIT_Operation* theOtherOp ) const;
79 virtual bool isGranted() const;
81 bool setSlot( const QObject* theReceiver, const char* theSlot );
93 void started( SUIT_Operation* );
94 void aborted( SUIT_Operation* );
95 void resumed( SUIT_Operation* );
96 void committed( SUIT_Operation* );
97 void suspended( SUIT_Operation* );
98 void stopped( SUIT_Operation* );
104 virtual bool isReadyToStart() const;
106 virtual void startOperation();
107 virtual void abortOperation();
108 virtual void commitOperation();
109 virtual void suspendOperation();
110 virtual void resumeOperation();
112 void setExecStatus( const int theStatus );
113 int execStatus() const;
115 void setState( const OperationState theState );
117 void start( SUIT_Operation* theOp );
121 SUIT_Application* myApp; //!< application for this operation
122 SUIT_Study* myStudy; //!< study for this operation
123 OperationState myState; //!< Operation state
124 ExecStatus myExecStatus; //!< Execution status
126 friend class SUIT_Study;