OpendTect-6_4  6.4
segyhdrdef.h
Go to the documentation of this file.
1 #ifndef segyhdrdef_h
2 #define segyhdrdef_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Feb 2011
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "seismod.h"
16 
17 #include "bufstring.h"
18 #include "objectset.h"
19 
20 
21 namespace SEGY
22 {
23 
24 class HdrDef;
25 
36 {
37 public:
38 
39  typedef short BytePos;
40  enum DataType { SInt, UInt, Float };
42 
43  HdrEntry( const char* desc, const char* nm,
44  BytePos bp=udfBP(), bool issmall=false,
45  DataType dt=SInt )
46  : bytepos_(bp), issmall_(issmall), type_(dt)
47  , desc_(desc), name_(nm) {}
48  HdrEntry( const HdrEntry& he )
49  { *this = he; }
50  HdrEntry& operator =(const HdrEntry&);
51 
52  const char* description() const;
53  void setDescription(const char*);
54  const char* name() const;
55  void setName(const char*);
56 
57  BytePos bytepos_;
58  bool issmall_;
60 
61  bool isInternal() const { return bytepos_%2 == 0; }
62  int byteSize() const { return issmall_ ? 2 : 4; }
63  inline bool isUdf() const { return bytepos_ < 0; }
64  inline void setUdf() { bytepos_ = udfBP(); }
65  inline bool usesByte( BytePos b ) const
66  { return b >= bytepos_ && b < bytepos_ + byteSize(); }
67 
68  int getValue(const void* buf,bool swapped=false) const;
69  void putValue(void* buf,int) const;
70 
71  void usePar(const IOPar&,const char* ky,const HdrDef* hd=0);
72  void fillPar(IOPar&,const char* ky) const;
73  void removeFromPar(IOPar&,const char* ky) const;
74 
75 protected:
76 
79 
80  inline static BytePos udfBP() { return -32768; }
81 
82 };
83 
84 
85 mExpClass(Seis) HdrDef : public ObjectSet<const HdrEntry>
86 {
87 public:
88  ~HdrDef() { deepErase( *this ); }
89 
90  HdrDef(bool binhead);
91  bool isBin() const { return isbin_; }
92 
93  int indexOf(const char* nm) const;
94  int idxOfBytePos(HdrEntry::BytePos,
95  unsigned char& offs) const;
96 
97  void swapValues(unsigned char*) const;
98 
99  int indexOf( const HdrEntry* he ) const
100  { return ObjectSet<const HdrEntry>::indexOf(he); }
101 
102 protected:
103 
104  bool isbin_;
105 
106  void mkTrc();
107  void mkBin();
108 
109 };
110 
111 
112 } // namespace
113 
114 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Summary for a Seismic object.
Definition: segydirectdef.h:23
BytePos bytepos_
Definition: segyhdrdef.h:57
void setUdf()
Definition: segyhdrdef.h:64
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
Definition: segyhdrdef.h:40
bool isUdf() const
Definition: segyhdrdef.h:63
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
bool isInternal() const
Definition: segyhdrdef.h:61
Data type.
Definition: datainpspec.h:31
bool issmall_
Definition: segyhdrdef.h:58
Set of pointers to objects.
Definition: commontypes.h:32
bool usesByte(BytePos b) const
Definition: segyhdrdef.h:65
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
HdrEntry(const char *desc, const char *nm, BytePos bp=udfBP(), bool issmall=false, DataType dt=SInt)
Definition: segyhdrdef.h:43
Definition: segyhdrdef.h:85
HdrEntry(const HdrEntry &he)
Definition: segyhdrdef.h:48
bool isBin() const
Definition: segyhdrdef.h:91
~HdrDef()
Definition: segyhdrdef.h:88
short BytePos
Definition: segyhdrdef.h:39
int byteSize() const
Definition: segyhdrdef.h:62
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
BufferString name_
Definition: segyhdrdef.h:78
int indexOf(const HdrEntry *he) const
Definition: segyhdrdef.h:99
static BytePos udfBP()
Definition: segyhdrdef.h:80
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
BufferString desc_
Definition: segyhdrdef.h:77
describes one tape or trace header field,
Definition: segyhdrdef.h:35
bool isbin_
Definition: segyhdrdef.h:104
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
DataType type_
Definition: segyhdrdef.h:59
virtual size_type indexOf(const T *) const
Definition: objectset.h:337
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