OpendTect-6_4  6.4
posidxpair.h
Go to the documentation of this file.
1 #ifndef posidxpair_h
2 #define posidxpair_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert/Salil
9  Date: Oct 2013
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "idxpair.h"
17 
18 
19 namespace Pos
20 {
21 
25 
26 
29 mExpClass(Basic) IdxPair : public ::IdxPair
30 {
31 public:
32 
33  IdxPair() : ::IdxPair(0,0) {}
35  : ::IdxPair(f,s) {}
36  inline bool operator ==(const IdxPair&) const;
37  inline bool operator !=( const IdxPair& oth ) const
38  { return !(*this == oth); }
39  inline bool operator <(const IdxPair& oth) const;
40  inline bool operator >(const IdxPair& oth) const;
41 
42  // aliases for first
43  inline IdxType& inl() { return first; }
44  inline IdxType& lineNr() { return first; }
45  inline IdxType& row() { return first; }
46 
47  // aliases for second
48  inline IdxType& crl() { return second; }
49  inline IdxType& trcNr() { return second; }
50  inline IdxType& col() { return second; }
51 
52  // const versions of the aliases
53  inline IdxType inl() const { return first; }
54  inline IdxType crl() const { return second; }
55  inline IdxType lineNr() const { return first; }
56  inline IdxType trcNr() const { return second; }
57  inline IdxType row() const { return first; }
58  inline IdxType col() const { return second; }
59 
60  inline od_int64 toInt64() const;
61  inline static IdxPair fromInt64(od_int64);
62  od_int64 sqDistTo(const IdxPair&) const;
63  bool isNeighborTo(const IdxPair&,
64  const IdxPairStep&,bool conn8=true) const;
65 
66  static const IdxPair& udf();
67 };
68 
69 
70 
71 inline bool IdxPair::operator ==( const IdxPair& oth ) const
72 {
73  return first == oth.first && second == oth.second;
74 }
75 
76 
77 inline bool IdxPair::operator <( const IdxPair& oth ) const
78 {
79  return first < oth.first || (first == oth.first && second < oth.second );
80 }
81 
82 
83 inline bool IdxPair::operator >( const IdxPair& oth ) const
84 {
85  return first > oth.first || (first == oth.first && second > oth.second );
86 }
87 
88 
89 inline od_int64 IdxPair::toInt64() const
90 {
91  return (((od_uint64)first) << 32) + (((od_uint64)second) & 0xFFFFFFFF);
92 }
93 
94 
96 {
97  return IdxPair( (IdxType)(i64 >> 32), (IdxType)(i64 & 0xFFFFFFFF) );
98 }
99 
100 
101 } // namespace Pos
102 
103 #endif
IdxType & row()
Definition: posidxpair.h:45
#define mExpClass(module)
Definition: commondefs.h:160
IdxPair()
Definition: posidxpair.h:33
bool operator<(const IdxPair &oth) const
Definition: posidxpair.h:77
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool operator>(const IdxPair &oth) const
Definition: posidxpair.h:83
#define od_int64
Definition: plftypes.h:36
IdxType & inl()
Definition: posidxpair.h:43
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:29
IdxType crl() const
Definition: posidxpair.h:54
int64_t toInt64(const char *s, int64_t defval=0)
Definition: string2.h:76
IdxType col() const
Definition: posidxpair.h:58
::Index_Type_Pair Index_Type_Pair
Definition: posidxpair.h:22
IdxType & trcNr()
Definition: posidxpair.h:49
int64_t toInt64() const
Definition: posidxpair.h:89
bool operator==(const IdxPair &) const
Definition: posidxpair.h:71
IdxType row() const
Definition: posidxpair.h:57
IdxType inl() const
Definition: posidxpair.h:53
static IdxPair fromInt64(int64_t)
Definition: posidxpair.h:95
IdxPair(IdxType f, IdxType s)
Definition: posidxpair.h:34
Position.
Definition: commontypes.h:42
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
IdxType trcNr() const
Definition: posidxpair.h:56
#define od_uint64
Definition: plftypes.h:37
IdxPair IdxPairStep
Definition: posidxpair.h:24
IdxType & crl()
Definition: posidxpair.h:48
IdxType & col()
Definition: posidxpair.h:50
std::pair< Index_Type, Index_Type > Index_Type_Pair
Definition: idxpair.h:23
IdxType & lineNr()
Definition: posidxpair.h:44
Index_Type IdxType
Definition: idxpair.h:34
IdxType lineNr() const
Definition: posidxpair.h:55
IdxPair IdxPairDelta
Definition: posidxpair.h:23

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