OpendTect  6.3
posidxpair.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/Salil
8  Date: Oct 2013
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "basicmod.h"
14 #include "idxpair.h"
15 
16 
17 namespace Pos
18 {
19 
23 
24 
27 mExpClass(Basic) IdxPair : public ::IdxPair
28 {
29 public:
30 
31  IdxPair() : ::IdxPair(0,0) {}
33  : ::IdxPair(f,s) {}
34  inline bool operator ==(const IdxPair&) const;
35  inline bool operator !=( const IdxPair& oth ) const
36  { return !(*this == oth); }
37  inline bool operator <(const IdxPair& oth) const;
38  inline bool operator >(const IdxPair& oth) const;
39 
40  // aliases for first
41  inline IdxType& inl() { return first; }
42  inline IdxType& lineNr() { return first; }
43  inline IdxType& row() { return first; }
44 
45  // aliases for second
46  inline IdxType& crl() { return second; }
47  inline IdxType& trcNr() { return second; }
48  inline IdxType& col() { return second; }
49 
50  // const versions of the aliases
51  inline IdxType inl() const { return first; }
52  inline IdxType crl() const { return second; }
53  inline IdxType lineNr() const { return first; }
54  inline IdxType trcNr() const { return second; }
55  inline IdxType row() const { return first; }
56  inline IdxType col() const { return second; }
57 
58  inline od_int64 toInt64() const;
59  inline static IdxPair fromInt64(od_int64);
60  od_int64 sqDistTo(const IdxPair&) const;
61  bool isNeighborTo(const IdxPair&,
62  const IdxPairStep&,bool conn8=true) const;
63 
64  static const IdxPair& udf();
65 };
66 
67 
68 
69 inline bool IdxPair::operator ==( const IdxPair& oth ) const
70 {
71  return first == oth.first && second == oth.second;
72 }
73 
74 
75 inline bool IdxPair::operator <( const IdxPair& oth ) const
76 {
77  return first < oth.first || (first == oth.first && second < oth.second );
78 }
79 
80 
81 inline bool IdxPair::operator >( const IdxPair& oth ) const
82 {
83  return first > oth.first || (first == oth.first && second > oth.second );
84 }
85 
86 
87 inline od_int64 IdxPair::toInt64() const
88 {
89  return (((od_uint64)first) << 32) + (((od_uint64)second) & 0xFFFFFFFF);
90 }
91 
92 
94 {
95  return IdxPair( (IdxType)(i64 >> 32), (IdxType)(i64 & 0xFFFFFFFF) );
96 }
97 
98 
99 } // namespace Pos
IdxType & row()
Definition: posidxpair.h:43
#define mExpClass(module)
Definition: commondefs.h:157
IdxPair()
Definition: posidxpair.h:31
bool operator>(const NamedObject &obj1, const NamedObject &obj2)
Definition: namedobj.h:75
bool operator<(const IdxPair &oth) const
Definition: posidxpair.h:75
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
bool operator>(const IdxPair &oth) const
Definition: posidxpair.h:81
#define od_int64
Definition: plftypes.h:34
IdxType & inl()
Definition: posidxpair.h:41
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:27
IdxType crl() const
Definition: posidxpair.h:52
int64_t toInt64(const char *s, int64_t defval=0)
Definition: string2.h:73
IdxType col() const
Definition: posidxpair.h:56
::Index_Type_Pair Index_Type_Pair
Definition: posidxpair.h:20
IdxType & trcNr()
Definition: posidxpair.h:47
int64_t toInt64() const
Definition: posidxpair.h:87
bool operator==(const IdxPair &) const
Definition: posidxpair.h:69
IdxType row() const
Definition: posidxpair.h:55
IdxType inl() const
Definition: posidxpair.h:51
static IdxPair fromInt64(int64_t)
Definition: posidxpair.h:93
IdxPair(IdxType f, IdxType s)
Definition: posidxpair.h:32
Position.
Definition: commontypes.h:38
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:60
IdxType trcNr() const
Definition: posidxpair.h:54
#define od_uint64
Definition: plftypes.h:35
IdxPair IdxPairStep
Definition: posidxpair.h:22
IdxType & crl()
Definition: posidxpair.h:46
IdxType & col()
Definition: posidxpair.h:48
std::pair< Index_Type, Index_Type > Index_Type_Pair
Definition: idxpair.h:21
IdxType & lineNr()
Definition: posidxpair.h:42
Index_Type IdxType
Definition: idxpair.h:32
IdxType lineNr() const
Definition: posidxpair.h:53
IdxPair IdxPairDelta
Definition: posidxpair.h:21

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