OpendTect  6.3
idxpair.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
8  Date: Oct 2013
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "basicmod.h"
14 #include "gendefs.h"
15 #ifdef __win__
16 # include <tuple>
17 #endif
18 #include <utility>
19 
20 
21 typedef std::pair<Index_Type,Index_Type> Index_Type_Pair;
24 
25 
29 {
30 public:
31 
33 
34  IdxPair() : Index_Type_Pair(0,0) {}
35  IdxPair( IdxType f, IdxType s )
36  : Index_Type_Pair(f,s) {}
37  inline bool operator ==(const IdxPair&) const;
38  inline bool operator !=( const IdxPair& oth ) const
39  { return !(*this == oth); }
40 
41  bool isUdf() const { return *this == udf(); }
42  void setUdf() { *this = udf(); }
43  static const IdxPair& udf();
44 
45  inline IdxType& operator[]( int idx )
46  { return idx ? second : first; }
47  inline IdxType operator[]( int idx ) const
48  { return idx ? second : first; }
49 
50  const char* getUsrStr(const char* prefx,const char* sep,
51  const char* postfx,bool only2nd) const;
52  bool parseUsrStr(const char* str,const char* prefx,
53  const char* sep,const char* postfx);
54 };
55 
56 
57 
58 inline bool IdxPair::operator ==( const IdxPair& oth ) const
59 {
60  return first == oth.first && second == oth.second;
61 }
#define mExpClass(module)
Definition: commondefs.h:157
IdxPair(IdxType f, IdxType s)
Definition: idxpair.h:35
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
bool operator==(const IdxPair &) const
Definition: idxpair.h:58
bool isUdf() const
Definition: idxpair.h:41
void setUdf()
Definition: idxpair.h:42
od_int32 Index_Type
Definition: commontypes.h:29
IdxPair IdxPairDelta
Definition: idxpair.h:22
IdxPair IdxPairStep
Definition: idxpair.h:23
IdxType operator[](int idx) const
Definition: idxpair.h:47
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:60
IdxPair()
Definition: idxpair.h:34
std::pair< Index_Type, Index_Type > Index_Type_Pair
Definition: idxpair.h:21
Index_Type IdxType
Definition: idxpair.h:32
A pair of numbers; base class for BinID et al.
Definition: idxpair.h:28
IdxType & operator[](int idx)
Definition: idxpair.h:45

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