OpendTect  6.3
trckeyvalue.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: A.H.Bril
8  Date: 21-6-1996
9  Contents: Positions: Inline/crossline and Coordinate
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "basicmod.h"
15 
16 
17 #include "trckey.h"
18 
23 class BinIDValue;
24 
26 {
27 public:
28 
29  inline TrcKeyValue( const TrcKey& tk=TrcKey::udf(),
30  float v=mUdf(float) )
31  : tk_(tk)
32  , val_(v) {}
33  TrcKeyValue(const BinIDValue&);
34 
35  Pos::LineID lineNr() const { return tk_.lineNr(); }
36  Pos::TraceID trcNr() const { return tk_.trcNr(); }
37  // mDeprecated Pos::LineID& lineNr() { return tk_.lineNr(); }
38  // mDeprecated Pos::TraceID& trcNr() { return tk_.trcNr(); }
39  TrcKeyValue& setLineNr( Pos::LineID nr )
40  { tk_.setLineNr(nr); return *this; }
41  TrcKeyValue& setTrcNr( Pos::TraceID nr )
42  { tk_.setTrcNr(nr); return *this; }
43 
44  inline bool operator==( const TrcKeyValue& oth ) const
45  { return oth.tk_==tk_ && mIsEqual(oth.val_,val_,1e-5); }
46  inline bool operator!=( const TrcKeyValue& oth ) const
47  { return !(*this==oth); }
48 
49  inline bool isDefined() const;
50  inline bool isUdf() const { return !isDefined(); }
51  static const TrcKeyValue& udf();
52 
54  float val_;
55 };
56 
57 inline bool TrcKeyValue::isDefined() const
58 { return !tk_.isUdf() && !mIsUdf(val_); }
#define mExpClass(module)
Definition: commondefs.h:157
Definition: trckeyvalue.h:25
TrcKey tk_
Definition: trckeyvalue.h:53
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
Index_Type LineID
Definition: commontypes.h:46
TrcKeyValue & setTrcNr(Pos::TraceID nr)
Definition: trckeyvalue.h:41
Index_Type TraceID
Definition: commontypes.h:47
#define mIsEqual(x, y, eps)
Definition: commondefs.h:56
TrcKeyValue & setLineNr(Pos::LineID nr)
Definition: trckeyvalue.h:39
bool operator==(const TrcKeyValue &oth) const
Definition: trckeyvalue.h:44
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
Pos::LineID lineNr() const
Definition: trckeyvalue.h:35
BinID and a value.
Definition: binidvalue.h:29
bool operator!=(const TrcKeyValue &oth) const
Definition: trckeyvalue.h:46
FT val_
Definition: posidxpairvalue.h:62
static const TrcKey & udf()
Pos::TraceID trcNr() const
Definition: trckeyvalue.h:36
float val_
Definition: trckeyvalue.h:54
bool isUdf() const
Definition: trckey.h:59
bool isDefined() const
Definition: trckeyvalue.h:57
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:26
bool isUdf() const
Definition: trckeyvalue.h:50
TrcKeyValue(const TrcKey &tk=TrcKey::udf(), float v=Values::Undef< float >::val())
Definition: trckeyvalue.h:29

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