1 #ifndef posidxpairvalue_h 2 #define posidxpairvalue_h 28 template <
class IPT,
class FT>
37 : IPT(f,s), val_(v) {}
45 {
return !(*
this == vip); }
49 FT&
val() {
return val_; }
50 FT
val()
const {
return val_; }
51 inline operator FT&() {
return val_; }
52 inline operator FT()
const {
return val_; }
54 inline void set( FT f ) { val_ = f; }
55 inline void set(
const IPT& ipt ) { IPT::operator=( ipt ); }
56 inline void set(
const IPT& ipt, FT f ) {
set( ipt );
set( f ); }
75 template <
class IPT,
class FT>
87 : IPT(i1,i2) { setSize(nrvals); }
89 : IPT(p) { setSize(nrvals); }
91 : IPT() { *
this = oth; }
93 : IPT(vip) { setSize(1); value(0) = vip; }
97 {
return !(*
this == ipvs); }
101 inline bool validIdx(
int i )
const {
return vals_.validIdx(i); }
102 inline size_type
size()
const {
return vals_.size(); }
103 inline FT&
value(
int idx ) {
return vals_[idx]; }
104 inline FT
value(
int idx )
const {
return vals_[idx]; }
105 inline FT*
values() {
return vals_.arr(); }
106 inline const FT*
values()
const {
return vals_.arr(); }
108 inline FT
operator[](
int idx )
const {
return value( idx ); }
109 inline set_type&
valSet() {
return vals_; }
110 inline const set_type&
valSet()
const {
return vals_; }
111 inline operator FT*() {
return values(); }
112 inline operator const FT*()
const {
return values(); }
114 inline void setSize(size_type,
bool kpvals=
false);
115 inline void setVals(
const FT*);
116 inline void set(int,FT);
117 inline void set(
const IPT& ipt ) { IPT::operator=( ipt ); }
119 inline bool isUdf(
bool allvalsudf=
true)
const;
128 template <
class IPT,
class FT>
inline 131 IPT::operator=( ipvs );
136 template <
class IPT,
class FT>
inline 139 if ( !equalPos( oth ) )
144 const FT valdiff = val_ - oth.
val_;
149 template <
class IPT,
class FT>
inline 154 if ( sz != size() || !equalPos( oth ) )
159 const FT myval = value(idx);
160 const FT othval = oth.
value(idx);
165 const FT valdiff = myval - othval;
174 template <
class IPT,
class FT>
inline 188 vals_ += idx<orgsz ? tmp[idx] :
mUdf(
float);
192 template <
class IPT,
class FT>
inline 197 vals_[idx] = newvals ? newvals[idx] :
mUdf(
float);
201 template <
class IPT,
class FT>
inline 209 template <
class IPT,
class FT>
inline 218 const FT val = vals_[idx];
219 const bool isudf =
mIsUdf(val);
220 if ( isudf && anyvaludf )
222 else if ( !isudf && !anyvaludf )
#define mExpClass(module)
Definition: commondefs.h:160
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool operator==(const IdxPairValues &) const
Definition: posidxpairvalue.h:150
TypeSet< FT >::size_type size_type
Definition: posidxpairvalue.h:83
bool equalPos(const IPT &ip) const
Definition: posidxpairvalue.h:98
#define mIsZero(x, eps)
Definition: commondefs.h:53
IdxPair with a value.
Definition: posidxpairvalue.h:29
const set_type & valSet() const
Definition: posidxpairvalue.h:110
IPT pos_type
Definition: posidxpairvalue.h:33
IdxPairValues(int i1, int i2, int nrvals)
Definition: posidxpairvalue.h:86
IdxPair with 0-N values.
Definition: posidxpairvalue.h:23
bool validIdx(int i) const
Definition: posidxpairvalue.h:101
size_type size() const
Definition: posidxpairvalue.h:102
set_type & valSet()
Definition: posidxpairvalue.h:109
FT * values()
Definition: posidxpairvalue.h:105
FT & value(int idx)
Definition: posidxpairvalue.h:103
ValueIdxPair(const IPT &b, FT v=Values::Undef< FT >::val())
Definition: posidxpairvalue.h:38
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
IdxPairValues()
Definition: posidxpairvalue.h:85
void setSize(size_type, bool kpvals=false)
Definition: posidxpairvalue.h:175
Position.
Definition: commontypes.h:42
bool isUdf() const
Definition: posidxpairvalue.h:59
TypeSet< FT > vals_
Definition: posidxpairvalue.h:123
FT operator[](int idx) const
Definition: posidxpairvalue.h:108
bool operator!=(const IdxPairValues &ipvs) const
Definition: posidxpairvalue.h:96
FT & operator[](int idx)
Definition: posidxpairvalue.h:107
ValueIdxPair(int f=0, int s=0, FT v=Values::Undef< FT >::val())
Definition: posidxpairvalue.h:36
void set(int, FT)
Definition: posidxpairvalue.h:202
#define mDefEps
Definition: commondefs.h:58
IdxPairValues(const IdxPairValues &oth)
Definition: posidxpairvalue.h:90
size_type size() const
Definition: typeset.h:254
FT value_type
Definition: posidxpairvalue.h:81
FT val_
Definition: posidxpairvalue.h:64
FT value(int idx) const
Definition: posidxpairvalue.h:104
bool operator==(const ValueIdxPair &) const
Definition: posidxpairvalue.h:137
bool operator!=(const ValueIdxPair &vip) const
Definition: posidxpairvalue.h:44
FT val() const
Definition: posidxpairvalue.h:50
IPT pos_type
Definition: posidxpairvalue.h:80
TypeSet< FT > set_type
Definition: posidxpairvalue.h:82
void setVals(const FT *)
Definition: posidxpairvalue.h:193
IdxPairValues(const ValueIdxPair< IPT, FT > &vip)
Definition: posidxpairvalue.h:92
bool isUdf(bool allvalsudf=true) const
Definition: posidxpairvalue.h:210
#define mClass(module)
Definition: commondefs.h:164
void set(FT f)
Definition: posidxpairvalue.h:54
bool isUdf(const T &t)
Definition: undefval.h:243
bool equalPos(const IPT &ip) const
Definition: posidxpairvalue.h:46
ValueIdxPair(const IdxPairValues< IPT, FT > &ipvs, int idx=0)
Definition: posidxpairvalue.h:40
FT & val()
Definition: posidxpairvalue.h:49
FT value_type
Definition: posidxpairvalue.h:34
IdxPairValues(const IPT &p, int nrvals)
Definition: posidxpairvalue.h:88
const FT * values() const
Definition: posidxpairvalue.h:106