OpendTect-6_4  6.4
seisbuf.h
Go to the documentation of this file.
1 #ifndef seisbuf_h
2 #define seisbuf_h
3 
4 /*
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 29-1-98
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 */
14 
15 
16 #include "seismod.h"
17 #include "seisinfo.h"
18 #include "executor.h"
19 #include "uistring.h"
20 class SeisTrc;
21 class SeisTrcReader;
22 class SeisPacketInfo;
23 
24 
32 { mODTextTranslationClass(SeisTrcBuf);
33 public:
34 
35  SeisTrcBuf( bool ownr )
36  : owner_(ownr) {}
37  SeisTrcBuf( const SeisTrcBuf& b )
38  : owner_(b.owner_) { b.copyInto( *this ); }
39  virtual ~SeisTrcBuf() { if ( owner_ ) deepErase(); }
40  inline void setIsOwner( bool yn ) { owner_ = yn; }
41  inline bool isOwner() const { return owner_; }
42 
43  void copyInto(SeisTrcBuf&) const;
44  void stealTracesFrom(SeisTrcBuf&);
45  virtual SeisTrcBuf* clone() const { return new SeisTrcBuf(*this);}
46 
47  void deepErase();
48  inline void erase()
49  { if ( owner_ ) deepErase(); else trcs_.erase(); }
50 
51  inline int size() const { return trcs_.size(); }
52  inline bool isEmpty() const { return trcs_.isEmpty(); }
53  inline bool validIdx( od_int64 idx ) const
54  { return trcs_.validIdx(idx); }
55  void insert(SeisTrc*,int atidx=0);
56  inline SeisTrc* replace( int idx, SeisTrc* t )
57  { return trcs_.replace(idx,t); }
58  inline void add( SeisTrc* t ) { trcs_ += t; }
59  void add(SeisTrcBuf&);
60 
61  int find(const BinID&,bool is2d=false) const;
62  int find(const SeisTrc*,bool is2d=false) const;
63  inline SeisTrc* get( int idx )
64  { return trcs_.validIdx(idx) ? trcs_[idx] : 0; }
65  inline const SeisTrc* get( int idx ) const
66  { return trcs_.validIdx(idx) ? trcs_[idx] : 0; }
67  inline void remove( SeisTrc* t ) { if ( t ) trcs_ -= t; }
68  inline SeisTrc* remove( int idx )
69  {
70  if ( !trcs_.validIdx(idx) )
71  return 0;
72 
73  SeisTrc* t = trcs_[idx];
74  if (t) trcs_-=t; return t;
75  }
76 
77  SeisTrc* first() { return trcs_.first(); }
78  const SeisTrc* first() const { return trcs_.first(); }
79  SeisTrc* last() { return trcs_.last(); }
80  const SeisTrc* last() const { return trcs_.last(); }
81 
82  void revert(); // last becomes first
83  void fill(SeisPacketInfo&) const;
84 
85  bool isSorted(bool ascending,SeisTrcInfo::Fld) const;
86  void sort(bool ascending,SeisTrcInfo::Fld);
87  void sortForWrite(bool is2d);
88  void enforceNrTrcs(int nrrequired,SeisTrcInfo::Fld,
89  bool stack_before_remove=false);
91  float* getHdrVals(SeisTrcInfo::Fld,double& offs);
94 
95  bool dump(const char* filenm,bool is2d,bool isps,
96  int icomp=0) const;
98 
99 protected:
100 
102  bool owner_;
103 
104  int probableIdx(const BinID&,bool is2d) const;
105 
106 };
107 
108 
111 public:
113 
114  uiString uiMessage() const { return msg_; }
115  uiString uiNrDoneText() const { return tr("Traces read"); }
116  od_int64 nrDone() const { return buf_.size(); }
117  od_int64 totalNr() const { return totnr_; }
118  int nextStep();
119 
120 protected:
121 
124  int totnr_;
126 
127 };
128 
129 
130 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Summary for a Seismic object.
Definition: segydirectdef.h:23
SeisTrcBuf & buf_
Definition: seisbuf.h:123
const SeisTrc * last() const
Definition: seisbuf.h:80
SeisTrcReader & rdr_
Definition: seisbuf.h:122
uiString msg_
Definition: seisbuf.h:125
int totnr_
Definition: seisbuf.h:124
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Definition: seisbuf.h:109
const SeisTrc * first() const
Definition: seisbuf.h:78
Information for a packet of seismics, AKA tape header info.
Definition: seispacketinfo.h:25
ObjectSet< SeisTrc > trcs_
Definition: seisbuf.h:101
void erase()
Definition: seisbuf.h:48
#define od_int64
Definition: plftypes.h:36
void add(SeisTrc *t)
Definition: seisbuf.h:58
SeisTrcBuf(bool ownr)
Definition: seisbuf.h:35
Definition: uistring.h:89
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: seisbuf.h:115
PtrMan< Array2DImpl< PtrMan< SeisTrc > > > trcs_
Definition: horizontracker.h:136
void copyInto(SeisTrcBuf &) const
SeisTrcBuf(const SeisTrcBuf &b)
Definition: seisbuf.h:37
od_int64 nrDone() const
Definition: seisbuf.h:116
od_int64 totalNr() const
Definition: seisbuf.h:117
reads from a seismic data store.
Definition: seisread.h:50
Fld
Definition: seisinfo.h:66
uiString uiMessage() const
will be message() again in 7.x
Definition: seisbuf.h:114
bool isEmpty() const
Definition: seisbuf.h:52
SeisTrc * last()
Definition: seisbuf.h:79
bool validIdx(od_int64 idx) const
Definition: seisbuf.h:53
int size() const
Definition: seisbuf.h:51
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
bool isOwner() const
Definition: seisbuf.h:41
void sort(ObjectSet< T > &os)
Sort ObjectSet. Must have operator > defined for elements.
Definition: objectset.h:220
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Seismic trace.
Definition: seistrc.h:34
void setIsOwner(bool yn)
Definition: seisbuf.h:40
set of seismic traces.
Definition: seisbuf.h:31
bool owner_
Definition: seisbuf.h:102
SeisTrc * first()
Definition: seisbuf.h:77
virtual SeisTrcBuf * clone() const
Definition: seisbuf.h:45
virtual ~SeisTrcBuf()
Definition: seisbuf.h:39
SeisTrc * replace(int idx, SeisTrc *t)
Definition: seisbuf.h:56
Specification to enable chunkwise execution of a process.
Definition: executor.h:39
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118

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