1 #ifndef posidxpairdataset_h 2 #define posidxpairdataset_h 14 #include "generalmod.h" 19 namespace PosInfo {
class CubeData; }
78 SPos( ArrIdxType ii=-1, ArrIdxType jj=-1 )
82 {
return i == oth.
i && j == oth.
j; }
84 {
return i != oth.
i || j != oth.
j; }
85 inline bool operator>(
const SPos&)
const;
86 inline bool operator<(
const SPos&)
const;
87 inline bool isValid()
const {
return i > -1 && j > -1; }
93 IdxPairDataSet(ObjSzType,
bool allow_duplicate_idxs,
94 bool manage_data=
true);
95 IdxPairDataSet(
const IdxPairDataSet&);
96 virtual ~IdxPairDataSet();
97 IdxPairDataSet& operator =(
const IdxPairDataSet&);
99 inline bool isEmpty()
const {
return frsts_.isEmpty(); }
101 void copyStructureFrom(
const IdxPairDataSet&);
107 void allowDuplicateIdxPairs(
bool);
108 bool append(
const IdxPairDataSet&);
109 void remove(
const IdxPairDataSet&);
117 {
return findFirst(ip); }
119 {
return findOccurrence(ip,0); }
120 SPos findOccurrence(
const IdxPair&,
int occ=0)
const;
121 bool next(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
122 bool prev(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
123 bool isValid(
const IdxPair&)
const;
126 const void* getObj(
SPos)
const;
128 SPos getPos(GlobIdxType)
const;
129 SPos add(
const IdxPair&,
const void* obj=0);
131 void set(SPos,
const void* obj=0);
135 void set(
const IdxPair& ip,
const void* obj=0 )
136 {
set( findFirst(ip), obj ); }
138 SPos update(
const IdxPair&,
const void* obj=0);
143 inline ArrIdxType
nrFirst()
const {
return frsts_.size(); }
144 ArrIdxType nrSecond(IdxType firstidx)
const;
146 {
return find(ip).j > -1; }
147 bool hasFirst(IdxType)
const;
148 bool hasSecond(IdxType)
const;
150 GlobIdxType totalSize()
const;
154 bool hasDuplicateIdxPairs()
const;
155 ArrIdxType nrDuplicateIdxPairs()
const;
156 void removeDuplicateIdxPairs();
157 ArrIdxType nrPos(ArrIdxType lineidx)
const;
164 void randomSubselect(GlobIdxType maxsz);
171 inline ArrIdxType
nrInls()
const {
return nrFirst(); }
172 inline ArrIdxType
nrCrls( IdxType inl )
const {
return nrSecond(inl); }
173 inline ArrIdxType
nrRows()
const {
return nrFirst(); }
174 inline ArrIdxType
nrCols( IdxType row )
const {
return nrSecond(row); }
175 bool hasInl( IdxType inl )
const {
return hasFirst(inl); }
176 bool hasCrl( IdxType crl )
const {
return hasSecond(crl); }
177 inline bool hasRow( IdxType row )
const {
return hasFirst(row); }
178 inline bool hasCol( IdxType col )
const {
return hasSecond(col); }
182 {
return secondRange(inl); }
184 {
return secondRange(row); }
187 bool setObjSize(ObjSzType sz,ObjSzType offs_in_objs=-1,
188 const void* initwith=0);
190 void decrObjSize(ObjSzType,ObjSzType offs=-1);
191 bool incrObjSize(ObjSzType,ObjSzType offs=-1,
const void* =0);
205 { objs_.allowNull(
true); }
209 const void* getObj(
bool,ArrIdxType,ObjSzType)
const;
210 void putObj(
bool,ArrIdxType,ObjSzType,
const void*);
211 bool addObjSpace(
bool,ArrIdxType,ObjSzType);
212 void removeObj(
bool,ArrIdxType,ObjSzType);
213 void decrObjSize(ObjSzType orgsz,ObjSzType newsz,
215 bool incrObjSize(ObjSzType,ObjSzType,ObjSzType,
224 bool manageBufCapacity(ObjSzType);
236 static ArrIdxType findIndexFor(
const IdxSet&,IdxType,
bool* found=0);
237 const void* gtObj(
const SPos&)
const;
238 bool addObj(SPos&,IdxType,
const void*);
239 void putObj(
const SPos&,
const void*);
243 inline IdxType
gtFrst(
const SPos& pos )
const 244 {
return frsts_[pos.
i]; }
245 inline IdxType
gtScnd(
const SPos& pos )
const 246 {
return gtScndSet(pos)[pos.
j]; }
248 {
return IdxPair( gtFrst(pos), gtScnd(pos) ); }
250 {
return *scndsets_[pos.
i]; }
252 {
return *scndsets_[pos.
i]; }
254 {
return *objdatas_[pos.
i]; }
256 {
return *objdatas_[pos.
i]; }
258 {
return *scndsets_[idx]; }
260 {
return *scndsets_[idx]; }
262 {
return *objdatas_[idx]; }
264 {
return *objdatas_[idx]; }
269 inline bool IdxPairDataSet::SPos::operator >(
const SPos& oth )
const 273 return i == oth.
i && j > oth.
j;
277 inline bool IdxPairDataSet::SPos::operator <(
const SPos& oth )
const 281 return i == oth.
i && j < oth.
j;
Interval< IdxType > crlRange(IdxType inl=-1) const
Definition: posidxpairdataset.h:181
#define mExpClass(module)
Definition: commondefs.h:160
ArrIdxType nrCrls(IdxType inl) const
Definition: posidxpairdataset.h:172
const ObjSzType objsz_
Definition: posidxpairdataset.h:228
ObjData()
Definition: posidxpairdataset.h:204
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
const IdxSet & gtScndSet(const SPos &pos) const
Definition: posidxpairdataset.h:251
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool hasCrl(IdxType crl) const
Definition: posidxpairdataset.h:176
IdxSet & gtScndSet(ArrIdxType idx)
Definition: posidxpairdataset.h:257
bool managesData() const
Definition: posidxpairdataset.h:105
bool hasRow(IdxType row) const
Definition: posidxpairdataset.h:177
ArrIdxType nrFirst() const
Definition: posidxpairdataset.h:143
ObjectSet< ObjData > objdatas_
Definition: posidxpairdataset.h:234
#define od_int64
Definition: plftypes.h:36
od_int64 BufSzType
Definition: posidxpairdataset.h:196
Interval< IdxType > rowRange() const
Definition: posidxpairdataset.h:180
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:29
const bool mandata_
Definition: posidxpairdataset.h:229
bool hasCol(IdxType col) const
Definition: posidxpairdataset.h:178
TypeSet< IdxType >::size_type ArrIdxType
Definition: posidxpairdataset.h:66
IdxPair gtIdxPair(const SPos &pos) const
Definition: posidxpairdataset.h:247
BufType * buf_
Definition: posidxpairdataset.h:222
const IdxSet & gtScndSet(ArrIdxType idx) const
Definition: posidxpairdataset.h:259
Interval of values.
Definition: commontypes.h:31
OD class for stream read.
Definition: od_istream.h:24
ArrIdxType j
Definition: posidxpairdataset.h:89
Definition: posidxpairdataset.h:198
Interval< IdxType > inlRange() const
Definition: posidxpairdataset.h:179
ArrIdxType i
Definition: posidxpairdataset.h:89
IdxSet frsts_
Definition: posidxpairdataset.h:232
bool append(TypeSetBase< T, I > &to, const TypeSetBase< S, J > &from)
append allowing a different type to be merged into set
Definition: typeset.h:198
A sorted set of IdxPairs and associated data buffer.
Definition: posidxpairdataset.h:61
ObjectSet< const void > objs_
Definition: posidxpairdataset.h:220
Set of (small) copyable elements.
Definition: commontypes.h:30
Horizontal sampling (inline and crossline range and steps).
Definition: trckeysampling.h:27
const ObjData & gtObjData(const SPos &pos) const
Definition: posidxpairdataset.h:255
ObjectSet< IdxSet > scndsets_
Definition: posidxpairdataset.h:233
SPos findFirst(const IdxPair &ip) const
Definition: posidxpairdataset.h:118
ArrIdxType nrRows() const
Definition: posidxpairdataset.h:173
IdxPair::IdxType IdxType
Definition: posidxpairdataset.h:65
Position.
Definition: commontypes.h:42
bool allowdup_
Definition: posidxpairdataset.h:230
od_int64 GlobIdxType
Definition: posidxpairdataset.h:68
ObjData & gtObjData(ArrIdxType idx)
Definition: posidxpairdataset.h:261
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
void reset()
Definition: posidxpairdataset.h:80
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
ArrIdxType nrInls() const
Definition: posidxpairdataset.h:171
bool includes(const IdxPair &ip) const
Definition: posidxpairdataset.h:145
Position info, often segmented.
Definition: posinfo.h:40
bool isValid() const
Definition: posidxpairdataset.h:87
TypeSet< IdxType > IdxSet
Definition: posidxpairdataset.h:195
IdxType gtScnd(const SPos &pos) const
Definition: posidxpairdataset.h:245
bool isEmpty() const
Definition: posidxpairdataset.h:99
Index_Type IdxType
Definition: idxpair.h:34
BufSzType bufsz_
Definition: posidxpairdataset.h:223
ObjData & gtObjData(const SPos &pos)
Definition: posidxpairdataset.h:253
bool hasInl(IdxType inl) const
Definition: posidxpairdataset.h:175
od_int64 ObjSzType
Definition: posidxpairdataset.h:67
IdxSet & gtScndSet(const SPos &pos)
Definition: posidxpairdataset.h:249
SPos(ArrIdxType ii=-1, ArrIdxType jj=-1)
Definition: posidxpairdataset.h:78
unsigned char BufType
Definition: posidxpairdataset.h:202
void(* EntryCreatedFn)(IdxPairDataSet &, int spos_i, int spos_j)
Definition: posidxpairdataset.h:27
const ObjData & gtObjData(ArrIdxType idx) const
Definition: posidxpairdataset.h:263
IdxType gtFrst(const SPos &pos) const
Definition: posidxpairdataset.h:243
Set Position: position in IdxPairDataSet.
Definition: posidxpairdataset.h:76
Position info for an entire 3D cube. The LineData's are not sorted.
Definition: posinfo.h:95
bool allowsDuplicateIdxPairs() const
Definition: posidxpairdataset.h:106
Interval< IdxType > colRange(IdxType row=-1) const
Definition: posidxpairdataset.h:183
ObjSzType objSize() const
Definition: posidxpairdataset.h:104
~ObjData()
Definition: posidxpairdataset.h:207
ArrIdxType nrCols(IdxType row) const
Definition: posidxpairdataset.h:174
SPos find(const IdxPair &ip) const
Definition: posidxpairdataset.h:116