13 #include "generalmod.h" 18 namespace PosInfo {
class CubeData; }
77 SPos( ArrIdxType ii=-1, ArrIdxType jj=-1 )
81 {
return i == oth.
i && j == oth.
j; }
83 {
return i != oth.
i || j != oth.
j; }
85 inline bool operator<(
const SPos&)
const;
86 inline bool isValid()
const {
return i > -1 && j > -1; }
92 IdxPairDataSet(ObjSzType,
bool allow_duplicate_idxs,
93 bool manage_data=
true);
94 IdxPairDataSet(
const IdxPairDataSet&);
95 virtual ~IdxPairDataSet();
96 IdxPairDataSet& operator =(
const IdxPairDataSet&);
98 inline bool isEmpty()
const {
return frsts_.isEmpty(); }
100 void copyStructureFrom(
const IdxPairDataSet&);
106 void allowDuplicateIdxPairs(
bool);
107 bool append(
const IdxPairDataSet&);
108 void remove(
const IdxPairDataSet&);
116 {
return findFirst(ip); }
118 {
return findOccurrence(ip,0); }
119 SPos findOccurrence(
const IdxPair&,
int occ=0)
const;
120 bool next(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
121 bool prev(
SPos&,
bool skip_duplicate_idxpairs=
false)
const;
122 bool isValid(
SPos)
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;
160 bool avoiddups=
true);
163 void randomSubselect(GlobIdxType maxsz);
170 inline ArrIdxType
nrInls()
const {
return nrFirst(); }
171 inline ArrIdxType
nrCrls( IdxType inl )
const {
return nrSecond(inl); }
172 inline ArrIdxType
nrRows()
const {
return nrFirst(); }
173 inline ArrIdxType
nrCols( IdxType row )
const {
return nrSecond(row); }
174 bool hasInl( IdxType inl )
const {
return hasFirst(inl); }
175 bool hasCrl( IdxType crl )
const {
return hasSecond(crl); }
176 inline bool hasRow( IdxType row )
const {
return hasFirst(row); }
177 inline bool hasCol( IdxType col )
const {
return hasSecond(col); }
181 {
return secondRange(inl); }
183 {
return secondRange(row); }
186 bool setObjSize(ObjSzType sz,ObjSzType offs_in_objs=-1,
187 const void* initwith=0);
189 void decrObjSize(ObjSzType,ObjSzType offs);
190 bool incrObjSize(ObjSzType,ObjSzType offs,
const void* =0);
204 { objs_.allowNull(
true); }
208 const void* getObj(
bool,ArrIdxType,ObjSzType)
const;
209 void putObj(
bool,ArrIdxType,ObjSzType,
const void*);
210 bool addObjSpace(
bool,ArrIdxType,ObjSzType);
211 void removeObj(
bool,ArrIdxType,ObjSzType);
212 void decrObjSize(ObjSzType orgsz,ObjSzType newsz,
214 bool incrObjSize(ObjSzType,ObjSzType,ObjSzType,
223 bool manageBufCapacity(ObjSzType);
235 static ArrIdxType findIndexFor(
const IdxSet&,IdxType,
bool* found=0);
236 const void* gtObj(
const SPos&)
const;
237 bool addObj(SPos&,IdxType,
const void*);
238 void putObj(
const SPos&,
const void*);
242 inline IdxType
gtFrst(
const SPos& pos )
const 243 {
return frsts_[pos.
i]; }
244 inline IdxType
gtScnd(
const SPos& pos )
const 245 {
return gtScndSet(pos)[pos.
j]; }
247 {
return IdxPair( gtFrst(pos), gtScnd(pos) ); }
249 {
return *scndsets_[pos.
i]; }
251 {
return *scndsets_[pos.
i]; }
253 {
return *objdatas_[pos.
i]; }
255 {
return *objdatas_[pos.
i]; }
257 {
return *scndsets_[idx]; }
259 {
return *scndsets_[idx]; }
261 {
return *objdatas_[idx]; }
263 {
return *objdatas_[idx]; }
272 return i == oth.
i && j > oth.
j;
276 inline bool IdxPairDataSet::SPos::operator <(
const SPos& oth )
const 280 return i == oth.
i && j < oth.
j;
Interval< IdxType > crlRange(IdxType inl=-1) const
Definition: posidxpairdataset.h:180
#define mExpClass(module)
Definition: commondefs.h:157
ArrIdxType nrCrls(IdxType inl) const
Definition: posidxpairdataset.h:171
const ObjSzType objsz_
Definition: posidxpairdataset.h:227
ObjData()
Definition: posidxpairdataset.h:203
bool operator>(const NamedObject &obj1, const NamedObject &obj2)
Definition: namedobj.h:75
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:25
const IdxSet & gtScndSet(const SPos &pos) const
Definition: posidxpairdataset.h:250
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
bool hasCrl(IdxType crl) const
Definition: posidxpairdataset.h:175
IdxSet & gtScndSet(ArrIdxType idx)
Definition: posidxpairdataset.h:256
bool managesData() const
Definition: posidxpairdataset.h:104
bool hasRow(IdxType row) const
Definition: posidxpairdataset.h:176
ArrIdxType nrFirst() const
Definition: posidxpairdataset.h:143
ObjectSet< ObjData > objdatas_
Definition: posidxpairdataset.h:233
#define od_int64
Definition: plftypes.h:34
od_int64 BufSzType
Definition: posidxpairdataset.h:195
Interval< IdxType > rowRange() const
Definition: posidxpairdataset.h:179
IdxPair with position indices; base class for BinID et al.
Definition: posidxpair.h:27
const bool mandata_
Definition: posidxpairdataset.h:228
bool hasCol(IdxType col) const
Definition: posidxpairdataset.h:177
TypeSet< IdxType >::size_type ArrIdxType
Definition: posidxpairdataset.h:65
IdxPair gtIdxPair(const SPos &pos) const
Definition: posidxpairdataset.h:246
BufType * buf_
Definition: posidxpairdataset.h:221
const IdxSet & gtScndSet(ArrIdxType idx) const
Definition: posidxpairdataset.h:258
OD class for stream read.
Definition: od_istream.h:23
ArrIdxType j
Definition: posidxpairdataset.h:88
Definition: posidxpairdataset.h:197
Interval< IdxType > inlRange() const
Definition: posidxpairdataset.h:178
ArrIdxType i
Definition: posidxpairdataset.h:88
IdxSet frsts_
Definition: posidxpairdataset.h:231
bool append(TypeSetBase< T, I > &to, const TypeSetBase< S, J > &from)
append allowing a different type to be merged into set
Definition: typeset.h:205
A sorted set of IdxPairs and associated data buffer.
Definition: posidxpairdataset.h:60
ObjectSet< const void > objs_
Definition: posidxpairdataset.h:219
Set of (small) copyable elements.
Definition: commontypes.h:26
Horizontal sampling (inline and crossline range and steps).
Definition: trckeysampling.h:25
const ObjData & gtObjData(const SPos &pos) const
Definition: posidxpairdataset.h:254
ObjectSet< IdxSet > scndsets_
Definition: posidxpairdataset.h:232
SPos findFirst(const IdxPair &ip) const
Definition: posidxpairdataset.h:117
ArrIdxType nrRows() const
Definition: posidxpairdataset.h:172
IdxPair::IdxType IdxType
Definition: posidxpairdataset.h:64
Position.
Definition: commontypes.h:38
bool allowdup_
Definition: posidxpairdataset.h:229
od_int64 GlobIdxType
Definition: posidxpairdataset.h:67
ObjData & gtObjData(ArrIdxType idx)
Definition: posidxpairdataset.h:260
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:60
void reset()
Definition: posidxpairdataset.h:79
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:187
ArrIdxType nrInls() const
Definition: posidxpairdataset.h:170
bool includes(const IdxPair &ip) const
Definition: posidxpairdataset.h:145
Position info, often segmented.
Definition: posinfo.h:38
bool isValid() const
Definition: posidxpairdataset.h:86
TypeSet< IdxType > IdxSet
Definition: posidxpairdataset.h:194
IdxType gtScnd(const SPos &pos) const
Definition: posidxpairdataset.h:244
bool isEmpty() const
Definition: posidxpairdataset.h:98
Index_Type IdxType
Definition: idxpair.h:32
BufSzType bufsz_
Definition: posidxpairdataset.h:222
ObjData & gtObjData(const SPos &pos)
Definition: posidxpairdataset.h:252
bool hasInl(IdxType inl) const
Definition: posidxpairdataset.h:174
od_int64 ObjSzType
Definition: posidxpairdataset.h:66
IdxSet & gtScndSet(const SPos &pos)
Definition: posidxpairdataset.h:248
SPos(ArrIdxType ii=-1, ArrIdxType jj=-1)
Definition: posidxpairdataset.h:77
unsigned char BufType
Definition: posidxpairdataset.h:201
void(* EntryCreatedFn)(IdxPairDataSet &, int spos_i, int spos_j)
Definition: posidxpairdataset.h:26
const ObjData & gtObjData(ArrIdxType idx) const
Definition: posidxpairdataset.h:262
IdxType gtFrst(const SPos &pos) const
Definition: posidxpairdataset.h:242
Set Position: position in IdxPairDataSet.
Definition: posidxpairdataset.h:75
Position info for an entire 3D cube. The LineData's are not sorted.
Definition: posinfo.h:96
bool allowsDuplicateIdxPairs() const
Definition: posidxpairdataset.h:105
Interval< IdxType > colRange(IdxType row=-1) const
Definition: posidxpairdataset.h:182
ObjSzType objSize() const
Definition: posidxpairdataset.h:103
~ObjData()
Definition: posidxpairdataset.h:206
ArrIdxType nrCols(IdxType row) const
Definition: posidxpairdataset.h:173
SPos find(const IdxPair &ip) const
Definition: posidxpairdataset.h:115