OpendTect  6.3
wellmanager.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: May 2001 / Mar 2016
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "welldata.h"
14 #include "welllog.h"
15 #include "saveablemanager.h"
16 #include "perthreadrepos.h"
17 #include <bitset>
18 
19 
20 namespace Well
21 {
22 
23 class Writer;
24 
25 
26 /*\brief Tells the Well Manager what you need to be loaded.
27 
28 Notes:
29 * D2T is only included if survey Z is Time. If you need it anyway, use
30  forceAddD2T().
31 * Adding Trck will cause Inf to be added too. Removing trck does not kick out
32  Inf automatically.
33 
34 */
35 
37 {
38 public:
39 
40  LoadReqs(bool addall=true);
41  LoadReqs(SubObjType);
42  LoadReqs(SubObjType,SubObjType);
44  static LoadReqs All();
45  bool operator ==( const LoadReqs& oth ) const
46  { return reqs_ == oth.reqs_; }
47 
48  LoadReqs& add(SubObjType);
49  LoadReqs& forceAddD2T();
50  LoadReqs& remove( SubObjType typ ) { reqs_[typ]=0; return *this; }
51  void setToAll() { *this = All(); }
52  void setEmpty() { reqs_.reset(); }
53  void include(const LoadReqs&);
54 
55  bool includes( SubObjType typ ) const
56  { return reqs_[typ]; }
57  bool includes(const LoadReqs&) const;
58  bool isAll() const { return includes( All() ); }
59 
60 protected:
61 
62  std::bitset<mWellNrSubObjTypes> reqs_;
63 
64 };
65 
66 
76 public:
77 
78  typedef LoadReqs LoadState;
79 
80  ConstRefMan<Data> fetch(const ObjID&,LoadReqs reqs=LoadReqs()) const;
81  RefMan<Data> fetchForEdit(const ObjID&,LoadReqs r=LoadReqs()) const;
82  ConstRefMan<Data> fetch(const ObjID&,LoadReqs,uiRetVal&) const;
83  RefMan<Data> fetchForEdit(const ObjID&,LoadReqs,uiRetVal&) const;
84 
85  ObjID getID(const Data&) const;
86  ObjID getIDByUWI(const char*) const;
87  //<! getIDByName() is in base class
88 
89  uiRetVal store(const Data&,const IOPar* ioobjpars=0) const;
91  uiRetVal store(const Data&,const ObjID&,
92  const IOPar* ioobjpars=0) const;
93  uiRetVal save(const ObjID&) const;
94  uiRetVal save(const Data&) const;
95  bool needsSave(const ObjID&) const;
96  bool needsSave(const Data&) const;
97 
98  void getLogNames(const ObjID&,BufferStringSet&) const;
99  void getAllMarkerNames(BufferStringSet&) const;
100  ConstRefMan<Log> getLog(const ObjID&,const char* lognm) const;
101  Coord getMapLocation(const ObjID&) const;
102 
103  // Use MonitorLock when iterating
104  ConstRefMan<Data> get(IdxType) const;
105  RefMan<Data> getForEdit(IdxType);
106 
107  IOObj* getIOObjByUWI(const char*) const;
108  uiRetVal savePart(const ObjID&,SubObjType,
109  bool setwellsaved=false) const;
110  uiRetVal saveLog(const ObjID&,const char*,
111  bool setwellsaved=false) const;
112 
113 protected:
114 
115  Manager();
116  ~Manager();
117 
118  virtual Saveable* getSaver(const SharedObject&) const;
119 
120  template<class T> T doFetch(const ObjID&,const LoadReqs&,uiRetVal&) const;
121  bool readReqData(ObjID,Data&,const LoadReqs&,
122  uiRetVal&) const;
123  Data* gtData(IdxType) const;
124 
127  virtual void setAuxOnAdd();
128 
129 public:
130 
132 
133 };
134 
135 
137 inline Manager& MGR()
138 {
139  return Manager::getInstance();
140 }
141 
142 
145 public:
146 
147  typedef LoadReqs StoreReqs;
148 
149  Saver(const Data&);
152  ~Saver();
153 
154  ConstRefMan<Data> wellData() const;
155  void setWellData(const Data&);
156 
157 protected:
158 
159  virtual uiRetVal doStore(const IOObj&) const;
160 
162  void updateLastSavedSubObjDirtyCounts(const Data&) const;
163  StoreReqs getStoreReqs(const Data&) const;
164 
165 };
166 
167 
168 } // namespace Well
#define mExpClass(module)
Definition: commondefs.h:157
size_type IdxType
Definition: saveablemanager.h:47
Definition: wellmanager.h:143
Definition: ioobj.h:57
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
short IdxType
Definition: seisblocksdata.h:39
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
#define mDeclareSaveableManagerInstance(typ)
Definition: saveablemanager.h:145
Definition: sharedobject.h:18
TypeSet< DirtyCounter > lastsavedsubobjdirtycounts_
Definition: wellmanager.h:161
Manages all stored Well::Data objects.
Definition: wellmanager.h:74
Set of BufferString objects.
Definition: bufstringset.h:25
SubObjType
Definition: wellcommon.h:30
#define mDeclMonitorableAssignment(clss)
like mDeclAbstractMonitorableAssignment but for non-abstract subclasses. Implements the clone() metho...
Definition: monitor.h:111
Object that can be saved at any time.
Definition: saveable.h:23
Definition: wellmanager.h:36
std::bitset< 8 > reqs_
Definition: wellmanager.h:62
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
bool isAll() const
Definition: wellmanager.h:58
Base class for managers of Saveable objects: loading and storing.
Definition: saveablemanager.h:41
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Definition: wellcommon.h:16
FixedString All()
Definition: keystrs.h:34
bool includes(SubObjType typ) const
Definition: wellmanager.h:55
Manager & MGR()
access to the singleton Well Manager
Definition: wellmanager.h:137
PerThreadObjectRepository< LoadState > curloadstate_
Definition: wellmanager.h:126
Definition: uistring.h:299
The holder of all data concerning a certain well.
Definition: welldata.h:36
2D point or vector class.
Definition: commontypes.h:58
TypeSet< LoadState > loadstates_
Definition: wellmanager.h:125
Definition: ptrman.h:227
void setEmpty()
Definition: wellmanager.h:52
Definition: ptrman.h:200
void setToAll()
Definition: wellmanager.h:51

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