Version: 9.15.0
SUIT_Operation.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef SUIT_OPERATION_H
24 #define SUIT_OPERATION_H
25 
26 #include "SUIT.h"
27 
28 #include <QObject>
29 #include <QPointer>
30 
31 class SUIT_Study;
32 class SUIT_Application;
33 
51 #ifdef WIN32
52 #pragma warning( disable:4251 )
53 #endif
54 
56 {
57  Q_OBJECT
58 
59 public:
62  {
65  Suspended
66  };
67 
74  {
76  Accepted
77  };
78 
82  enum Flags
83  {
84  None = 0x00,
85  Transaction = 0x01
86  };
87 
88 public:
90  virtual ~SUIT_Operation();
91 
92  OperationState state() const;
93  bool isActive() const;
94  bool isRunning() const;
95 
96  SUIT_Study* study() const;
97  virtual void setStudy( SUIT_Study* theStudy );
98 
99  SUIT_Application* application() const;
100  virtual void setApplication( SUIT_Application* theApp );
101 
102  virtual bool isValid( SUIT_Operation* theOtherOp ) const;
103  virtual bool isGranted() const;
104 
105  bool setSlot( const QObject* theReceiver, const char* theSlot );
106 
107  void setFlags( const int );
108  void clearFlags( const int );
109  bool testFlags( const int ) const;
110 
111  virtual QString operationName() const;
112 
113  int execStatus() const;
114 
115 signals:
119 
123 
124  void callSlot();
125 
126 public slots:
127  void start();
128  void abort();
129  void commit();
130  void resume();
131  void suspend();
132 
133 protected:
134  virtual bool isReadyToStart() const;
135 
136  virtual void stopOperation();
137  virtual void startOperation();
138  virtual void abortOperation();
139  virtual void commitOperation();
140  virtual void resumeOperation();
141  virtual void suspendOperation();
142 
143  virtual bool openTransaction();
144  virtual bool abortTransaction();
145  virtual bool hasTransaction() const;
146  virtual bool commitTransaction( const QString& = QString() );
147 
148  void setExecStatus( const int );
149 
150  void setState( const OperationState );
151 
152  void start( SUIT_Operation*, const bool = false );
153 
154 private:
155  typedef QPointer<SUIT_Study> StudyPtr;
156 
157 private:
159  int myFlags;
163 
164  friend class SUIT_Study;
165 };
166 
167 #ifdef WIN32
168 #pragma warning( default:4251 )
169 #endif
170 
171 #endif
#define SUIT_EXPORT
Definition: SUIT.h:36
bool isValid(const QPolygon *thePoints, const QPoint &theCurrent)
Definition: SVTK_InteractorStyle.cxx:1762
For more information see QT documentation.
Definition: SUIT_Application.h:42
Definition: SUIT_Application.h:61
Base class for all operations.
Definition: SUIT_Operation.h:56
QPointer< SUIT_Study > StudyPtr
Definition: SUIT_Operation.h:155
void suspended(SUIT_Operation *)
void stopped(SUIT_Operation *)
Flags
Definition: SUIT_Operation.h:83
int myFlags
operation flags
Definition: SUIT_Operation.h:159
void started(SUIT_Operation *)
OperationState myState
Operation state.
Definition: SUIT_Operation.h:161
OperationState
Definition: SUIT_Operation.h:62
@ Running
Operation is started.
Definition: SUIT_Operation.h:64
@ Waiting
Operation is not used (it is not run or suspended)
Definition: SUIT_Operation.h:63
SUIT_Application * myApp
application for this operation
Definition: SUIT_Operation.h:158
StudyPtr myStudy
study for this operation
Definition: SUIT_Operation.h:160
void committed(SUIT_Operation *)
ExecStatus myExecStatus
Execution status.
Definition: SUIT_Operation.h:162
void aborted(SUIT_Operation *)
void resumed(SUIT_Operation *)
ExecStatus
Definition: SUIT_Operation.h:74
@ Rejected
Operation has not performed any action (modification of data model for example)
Definition: SUIT_Operation.h:75
Definition: SUIT_Study.h:41
@ None
Definition: Plot2d.h:74