OpendTect-6_4  6.4
binid.h
Go to the documentation of this file.
1 #ifndef binid_h
2 #define binid_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H.Bril
9  Date: 21-6-1996
10  Contents: Positions: Inline/crossline and Coordinate
11  RCS: $Id$
12 ________________________________________________________________________
13 
14 -*/
15 
16 #include "basicmod.h"
17 #include "posidxpair.h"
18 
19 // The following should become separate classes with their own specific
20 // functions at some point in time ...
21 typedef BinID BinIDStep;
22 typedef BinID BinIDDelta; // is base class for:
25 
26 
30 mExpClass(Basic) BinID : public Pos::IdxPair
31 {
32 public:
33 
34  inline BinID() {}
35  inline BinID(IdxType i,IdxType x);
36  inline BinID(const Pos::IdxPair&);
38 
39  inline const BinID& operator+=(const BinIDAbsDelta&);
40  inline const BinID& operator-=(const BinIDAbsDelta&);
41  inline BinID operator+(const BinIDAbsDelta&) const;
42  inline BinID operator-(const BinIDAbsDelta&) const;
43 
44  // BinIDRelDelta operator:
45  inline BinIDAbsDelta operator*(const Pos::Index_Type_Pair&) const;
46  // BinIDAbsDelta operator:
47  inline BinIDRelDelta operator/(const Pos::Index_Type_Pair&) const;
48 
49  // BinID[Abs|Rel]Delta operators:
50  // 'BinID' below should be either BinIDRelDelta or BinIDAbsDelta
51  inline BinID operator*(int) const;
52  inline BinID operator/(int) const;
53  inline BinID operator-() const;
54 
55  inline static BinID fromInt64(od_int64);
56 
57  inline const char* toString(bool is2d=false) const;
58  inline bool fromString(const char*);
59 
60 };
61 
62 
64  : Pos::IdxPair(i,c)
65 {
66 }
67 
68 
69 inline BinID::BinID( const Pos::IdxPair& p )
70  : Pos::IdxPair(p)
71 {
72 }
73 
74 
75 inline const BinID& BinID::operator+=( const BinIDAbsDelta& bid )
76  { inl() += bid.inl(); crl() += bid.crl(); return *this; }
77 inline const BinID& BinID::operator-=( const BinIDAbsDelta& bid )
78  { inl() -= bid.inl(); crl() -= bid.crl(); return *this; }
79 inline BinID BinID::operator+( const BinIDAbsDelta& bid ) const
80  { return BinID( inl()+bid.inl(), crl()+bid.crl() ); }
81 inline BinID BinID::operator-( const BinIDAbsDelta& bid ) const
82 { return BinID( inl()-bid.inl(), crl()-bid.crl() ); }
83 
84 inline BinID BinID::operator-() const
85 { return BinID( -inl(), -crl() ); }
86 
88 { return BinID( first*ip.first, second*ip.second ); }
89 
91 { return BinID( first/ip.first, second/ip.second ); }
92 
93 inline BinID BinID::operator*( int factor ) const
94 { return BinID( inl()*factor, crl()*factor ); }
95 
96 inline BinID BinID::operator/( int denominator ) const
97  { return BinID( inl()/denominator, crl()/denominator ); }
98 
99 
101 {
103  return BinID( p.first, p.second );
104 }
105 
106 
107 inline const char* BinID::toString( bool is2d ) const
108 {
109  return IdxPair::getUsrStr( "", "/", "", is2d );
110 }
111 
112 
113 inline bool BinID::fromString( const char* str )
114 {
115  return IdxPair::parseUsrStr( str, "", "/", "" );
116 }
117 
118 #endif
#define mExpClass(module)
Definition: commondefs.h:160
bool fromString(const char *)
Definition: binid.h:113
int operator-(const DateInfo &di1, const DateInfo &di2)
Definition: dateinfo.h:129
BinID operator-() const
Definition: binid.h:84
const BinID & operator-=(const BinIDAbsDelta &)
Definition: binid.h:77
const char * getUsrStr(const char *prefx, const char *sep, const char *postfx, bool only2nd) const
BinID operator+(const BinIDAbsDelta &) const
Definition: binid.h:79
#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
::Index_Type_Pair Index_Type_Pair
Definition: posidxpair.h:22
BinID BinIDDelta
Definition: binid.h:22
BinIDAbsDelta operator*(const Pos::Index_Type_Pair &) const
Definition: binid.h:87
BinID BinIDAbsDelta
Definition: binid.h:23
static IdxPair fromInt64(int64_t)
Definition: posidxpair.h:95
const BinID & operator+=(const BinIDAbsDelta &)
Definition: binid.h:75
const char * toString(bool is2d=false) const
Definition: binid.h:107
BinID BinIDRelDelta
Definition: binid.h:24
Position.
Definition: commontypes.h:42
BinID()
Definition: binid.h:34
BinIDRelDelta operator/(const Pos::Index_Type_Pair &) const
Definition: binid.h:90
Coord3 operator*(double f, const Coord3 &b)
Definition: coord.h:130
IdxType & crl()
Definition: posidxpair.h:48
Index_Type IdxType
Definition: idxpair.h:34
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
static BinID fromInt64(int64_t)
Definition: binid.h:100
Export_Basic const char * toString(ViewStyle)
A pair of numbers; base class for BinID et al.
Definition: idxpair.h:30
BinID BinIDStep
Definition: binid.h:21
bool parseUsrStr(const char *str, const char *prefx, const char *sep, const char *postfx)

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