OpendTect  6.3
welldahobj.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 Bril
8  Date: May 2004
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "wellcommon.h"
15 #include "namedmonitorable.h"
16 #include "monitoriter.h"
17 #include "ranges.h"
18 #include "sets.h"
19 #include "integerid.h"
20 
21 
22 namespace Well
23 {
24 
37 {
38 public:
39 
40  typedef float ZType;
44  typedef size_type IdxType;
46  typedef float ValueType;
49 
50  DahObj(const char* nm=0);
51  virtual ~DahObj();
54 
55  size_type size() const;
56  inline bool isEmpty() const { return size() < 1; }
57  ZType dah(PointID) const;
58  ZType firstDah() const;
59  ZType lastDah() const;
60  ValueType value(PointID) const;
61  ValueType valueAt(ZType,bool no_undefs=false) const;
62  ValueType firstValue(bool no_undefs=false) const;
63  ValueType lastValue(bool no_undefs=false) const;
64  ZIntvType dahRange() const;
65  ZType dahStep(bool min_else_average) const;
66  void getDahValues(ZSetType&) const;
67  virtual void getData(ZSetType&,ValueSetType&) const = 0;
68  virtual bool valsAreCodes() const { return false; }
69  PointID firstID() const;
70  PointID lastID() const;
71  PointID nextID(PointID) const;
72  PointID prevID(PointID) const;
73  PointID nearestID(ZType) const ;
74 
75  void setEmpty();
76  void setDah(PointID,ZType);
77  bool setValue(PointID,ValueType);
78  PointID setValueAt(ZType,ValueType);
79  void remove(PointID);
80  void deInterpolate();
81  void shiftDahFrom(PointID,ZType);
82 
83  // Use MonitorLock when iterating
84  PointID pointIDFor(IdxType) const;
85  IdxType indexOf(PointID) const;
86  IdxType indexOf(ZType) const;
87  ZType dahByIdx(IdxType) const;
88  ValueType valueByIdx(IdxType) const;
89  void removeByIdx(IdxType);
90 
91  static ChangeType cParsChange() { return 2; }
92  static ChangeType cPointAdd() { return 3; }
93  static ChangeType cDahChange() { return 4; }
94  static ChangeType cValueChange() { return 5; }
95  static ChangeType cPointRemove() { return 6; }
96  static ZType dahEps() { return 1e-5f; }
97 
98 protected:
99 
100  ZSetType dahs_;
103 
104  // fns for for already locked state
105 
106  virtual bool doSet(IdxType,ValueType) = 0;
107  virtual PointID doInsAtDah(ZType,ValueType) = 0;
108  virtual ValueType gtVal(IdxType) const = 0;
109  virtual void removeAux(IdxType) = 0;
110  virtual void eraseAux() = 0;
111 
112  void doRemove(IdxType);
113  void doSetEmpty();
114  PointID doIns(ZType dh,ValueType val,ValueSetType&,
115  bool ascendingvalsonly);
116  bool doSetData(const ZSetType&,const ValueSetType&,
117  ValueSetType&);
118 
119  size_type gtSize() const { return dahs_.size(); }
120  IdxType gtIsEmpty() const { return dahs_.isEmpty(); }
121  PointID gtNeighbourID(PointID,bool) const;
122  PointID gtNewPointID() const;
123  IdxType gtIndexOf(ZType) const;
124  IdxType gtIdx(PointID) const;
125  ZType gtDah(IdxType) const;
126  ValueType gtValueAt(ZType,bool noudfs) const;
127  static bool areEqualDahs(ZType,ZType);
128 
129  friend class DahObjIter;
130 
131 };
132 
133 
135 {
136 public:
137 
141 
142  DahObjIter(const DahObj&,bool start_at_end=false);
143  DahObjIter(const DahObjIter&);
144 
145  const DahObj& dahObj() const;
146  PointID ID() const;
147 
148  ZType dah() const;
149  ValueType value() const;
150 
151 };
152 
153 
154 }; // namespace Well
DahObj::ZType ZType
Definition: welldahobj.h:139
virtual bool valsAreCodes() const
Definition: welldahobj.h:68
#define mExpClass(module)
Definition: commondefs.h:157
DahObj::ValueType ValueType
Definition: welldahobj.h:140
static ChangeType cParsChange()
Definition: welldahobj.h:91
static ChangeType cDahChange()
Definition: welldahobj.h:93
int ChangeType
Definition: monitorable.h:80
Monitorable object with a name. All but name() are MT-safe.
Definition: namedmonitorable.h:20
Interval< ZType > ZIntvType
Definition: welldahobj.h:42
static ZType dahEps()
Definition: welldahobj.h:96
short IdxType
Definition: seisblocksdata.h:39
Interval< ValueType > ValueIntvType
Definition: welldahobj.h:48
TypeSet< ValueType > ValueSetType
Definition: welldahobj.h:47
Definition: welldahobj.h:134
static ChangeType cPointRemove()
Definition: welldahobj.h:95
float ValueType
Definition: welldahobj.h:46
bool isEmpty() const
Definition: odset.h:43
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
base class for const Monitorable iterator.
Definition: monitoriter.h:83
single integer ID with comparison but no automatic conversion. Note that you will want to make a subc...
Definition: integerid.h:47
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
size_type IdxType
Definition: welldahobj.h:44
I size_type
Definition: typeset.h:29
Threads::Atomic< IdxType > curptidnr_
Definition: welldahobj.h:102
Definition: wellcommon.h:16
bool isEmpty() const
Definition: welldahobj.h:56
object with a geometry defined by depth along hole.
Definition: welldahobj.h:36
TypeSet< ZType > ZSetType
Definition: welldahobj.h:41
IntegerID< IdxType > PointID
Definition: welldahobj.h:45
ZSetType dahs_
Definition: welldahobj.h:100
size_type gtSize() const
Definition: welldahobj.h:119
static ChangeType cPointAdd()
Definition: welldahobj.h:92
DahObj::PointID PointID
Definition: welldahobj.h:138
size_type size() const
Definition: typeset.h:263
TypeSet< PointID > ptids_
Definition: welldahobj.h:101
static ChangeType cValueChange()
Definition: welldahobj.h:94
float ZType
Definition: welldahobj.h:40
ZSetType::size_type size_type
Definition: welldahobj.h:43
FixedString ID()
Definition: keystrs.h:71
#define mDeclAbstractMonitorableAssignment(clss)
Monitorable subclasses: assignment and comparison.
Definition: monitor.h:105
IdxType gtIsEmpty() const
Definition: welldahobj.h:120

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