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

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