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

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