OpendTect  6.3
monitorchangerecorder.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: June 2016
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "namedmonitorable.h"
14 #include "uistring.h"
15 #include "objectset.h"
16 
17 
21 {
22 public:
23 
24  ~ChangeRecorder();
26  bool isEmpty() const;
27  void setEmpty();
28 
29  enum Action { Undo, Redo };
30 
33  public:
35  virtual ~Record() {}
36  virtual Record* clone() const = 0;
37  virtual bool isValid() const = 0;
38  virtual uiString name() const = 0;
39  virtual uiString actionText(Action) const;
40  virtual bool apply(Monitorable&,Action) const = 0;
41  };
42 
43 
44  bool canApply(Action) const;
45  uiString usrText(Action) const;
46  bool apply(Action);
47 
48 protected:
49 
51 
52  ChangeRecorder(Monitorable&,const char* nm);
53  ChangeRecorder(const Monitorable&,const char*);
54 
57  IdxType idx4redo_;
58  bool applying_;
59 
60  // fns with no locking:
61  void clear();
62  void objDel(CallBacker*);
63  void objChg(CallBacker*);
64  IdxType gtIdx(Action) const;
65  void addRec(Record*);
66 
67  virtual void handleObjChange(const ChangeData&) = 0;
68 
69 private:
70 
71  void init();
72 
73 };
#define mExpClass(module)
Definition: commondefs.h:157
Object that can be MT-safely monitored from cradle to grave.
Definition: monitorable.h:76
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
Monitorable object with a name. All but name() are MT-safe.
Definition: namedmonitorable.h:20
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
bool init()
void clear(std::ios &)
bool applying_
Definition: monitorchangerecorder.h:58
Definition: uistring.h:88
ObjectSet< Record > recs_
Definition: monitorchangerecorder.h:56
ChangeRecorder::Action Action
Definition: monitorchangerecorder.h:34
IdxType idx4redo_
Definition: monitorchangerecorder.h:57
Set of pointers to objects.
Definition: commontypes.h:28
base class for recorder of changes in a Monitorable
Definition: monitorchangerecorder.h:20
Action
Definition: monitorchangerecorder.h:29
ObjectSet< Record >::size_type IdxType
Definition: monitorchangerecorder.h:50
Definition: monitorchangerecorder.h:29
virtual ~Record()
Definition: monitorchangerecorder.h:35
bool isEmpty(const char *)
Definition: monitorable.h:113
Definition: monitorchangerecorder.h:31
#define mDeclAbstractMonitorableAssignment(clss)
Monitorable subclasses: assignment and comparison.
Definition: monitor.h:105
Monitorable * obj_
Definition: monitorchangerecorder.h:55

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017