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

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