OpendTect-6_4  6.4
idxpair.h
Go to the documentation of this file.
1 #ifndef idxpair_h
2 #define idxpair_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Oct 2013
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "gendefs.h"
17 #ifdef __win__
18 # include <tuple>
19 #endif
20 #include <utility>
21 
22 
23 typedef std::pair<Index_Type,Index_Type> Index_Type_Pair;
26 
27 
31 {
32 public:
33 
35 
36  IdxPair() : Index_Type_Pair(0,0) {}
37  IdxPair( IdxType f, IdxType s )
38  : Index_Type_Pair(f,s) {}
39  inline bool operator ==(const IdxPair&) const;
40  inline bool operator !=( const IdxPair& oth ) const
41  { return !(*this == oth); }
42 
43  bool isUdf() const { return *this == udf(); }
44  void setUdf() { *this = udf(); }
45  static const IdxPair& udf();
46 
47  inline IdxType& operator[]( int idx )
48  { return idx ? second : first; }
49  inline IdxType operator[]( int idx ) const
50  { return idx ? second : first; }
51 
52  const char* getUsrStr(const char* prefx,const char* sep,
53  const char* postfx,bool only2nd) const;
54  bool parseUsrStr(const char* str,const char* prefx,
55  const char* sep,const char* postfx);
56 };
57 
58 
59 
60 inline bool IdxPair::operator ==( const IdxPair& oth ) const
61 {
62  return first == oth.first && second == oth.second;
63 }
64 
65 
66 #endif
#define mExpClass(module)
Definition: commondefs.h:160
IdxPair(IdxType f, IdxType s)
Definition: idxpair.h:37
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool operator==(const IdxPair &) const
Definition: idxpair.h:60
bool isUdf() const
Definition: idxpair.h:43
void setUdf()
Definition: idxpair.h:44
od_int32 Index_Type
Definition: commontypes.h:33
IdxPair IdxPairDelta
Definition: idxpair.h:24
IdxPair IdxPairStep
Definition: idxpair.h:25
IdxType operator[](int idx) const
Definition: idxpair.h:49
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
IdxPair()
Definition: idxpair.h:36
std::pair< Index_Type, Index_Type > Index_Type_Pair
Definition: idxpair.h:23
Index_Type IdxType
Definition: idxpair.h:34
A pair of numbers; base class for BinID et al.
Definition: idxpair.h:30
IdxType & operator[](int idx)
Definition: idxpair.h:47

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