OpendTect  6.3
segyhdrdef.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: Feb 2011
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "seiscommon.h"
14 #include "bufstring.h"
15 #include "objectset.h"
16 
17 
18 namespace SEGY
19 {
20 
21 class HdrDef;
22 
33 {
34 public:
35 
36  typedef short BytePos;
37  enum DataType { SInt, UInt, Float };
39 
40  HdrEntry( const char* desc, const char* nm,
41  BytePos bp=udfBP(), bool issmall=false,
42  DataType dt=SInt )
43  : bytepos_(bp), issmall_(issmall), type_(dt)
44  , desc_(desc), name_(nm) {}
45  HdrEntry( const HdrEntry& he )
46  { *this = he; }
47  HdrEntry& operator =(const HdrEntry&);
48 
49  const char* description() const;
50  void setDescription(const char*);
51  const char* name() const;
52  void setName(const char*);
53 
54  BytePos bytepos_;
55  bool issmall_;
57 
58  bool isInternal() const { return bytepos_%2 == 0; }
59  int byteSize() const { return issmall_ ? 2 : 4; }
60  inline bool isUdf() const { return bytepos_ < 0; }
61  inline void setUdf() { bytepos_ = udfBP(); }
62  inline bool usesByte( BytePos b ) const
63  { return b >= bytepos_ && b < bytepos_ + byteSize(); }
64 
65  int getValue(const void* buf,bool swapped=false) const;
66  void putValue(void* buf,int) const;
67 
68  void usePar(const IOPar&,const char* ky,const HdrDef* hd=0);
69  void fillPar(IOPar&,const char* ky) const;
70  void removeFromPar(IOPar&,const char* ky) const;
71 
72 protected:
73 
76 
77  inline static BytePos udfBP() { return -32768; }
78 
79 };
80 
81 
82 mExpClass(Seis) HdrDef : public ObjectSet<const HdrEntry>
83 {
84 public:
85  ~HdrDef() { deepErase( *this ); }
86 
87  HdrDef(bool binhead);
88  bool isBin() const { return isbin_; }
89 
90  int indexOf(const char* nm) const;
91  int idxOfBytePos(HdrEntry::BytePos,
92  unsigned char& offs) const;
93 
94  void swapValues(unsigned char*) const;
95 
96  int indexOf( const HdrEntry* he ) const
98 
99 protected:
100 
101  bool isbin_;
102 
103  void mkTrc();
104  void mkBin();
105 
106 };
107 
108 
109 } // namespace
#define mExpClass(module)
Definition: commondefs.h:157
Seismics.
Definition: segydirectdef.h:20
BytePos bytepos_
Definition: segyhdrdef.h:54
void setUdf()
Definition: segyhdrdef.h:61
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Definition: segyhdrdef.h:37
bool isUdf() const
Definition: segyhdrdef.h:60
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
bool isInternal() const
Definition: segyhdrdef.h:58
Data type.
Definition: datainpspec.h:29
bool issmall_
Definition: segyhdrdef.h:55
Set of pointers to objects.
Definition: commontypes.h:28
bool usesByte(BytePos b) const
Definition: segyhdrdef.h:62
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
HdrEntry(const char *desc, const char *nm, BytePos bp=udfBP(), bool issmall=false, DataType dt=SInt)
Definition: segyhdrdef.h:40
Definition: segyhdrdef.h:82
HdrEntry(const HdrEntry &he)
Definition: segyhdrdef.h:45
bool isBin() const
Definition: segyhdrdef.h:88
~HdrDef()
Definition: segyhdrdef.h:85
short BytePos
Definition: segyhdrdef.h:36
int byteSize() const
Definition: segyhdrdef.h:59
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
BufferString name_
Definition: segyhdrdef.h:75
int indexOf(const HdrEntry *he) const
Definition: segyhdrdef.h:96
static BytePos udfBP()
Definition: segyhdrdef.h:77
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
BufferString desc_
Definition: segyhdrdef.h:74
describes one tape or trace header field,
Definition: segyhdrdef.h:32
bool isbin_
Definition: segyhdrdef.h:101
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:18
DataType type_
Definition: segyhdrdef.h:56
virtual size_type indexOf(const T *) const
Definition: objectset.h:341
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122

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