23#include <unordered_map>
128 bool push_back(uint8_t tilePart, uint8_t numTileParts, uint64_t offset, uint32_t length)
134 grklog.error(
"Number of tile parts %d does not match previous value %d", numTileParts,
140 if(tilePart !=
size())
142 grklog.error(
"Tile part %d is out of sequence with current number of tile parts %d", tilePart,
164 for(
auto& part : *
this)
166 part->offset_ += tileStreamOffset;
197 TPFetch(uint64_t offset, uint64_t length, uint16_t tileIndex)
208 void copy(uint8_t* chunk,
size_t chunkLen)
226 void push_back(uint16_t tileIndex,
const std::unique_ptr<TPSeq>& tileParts)
231 for(
auto& part : *tileParts)
234 std::make_shared<TPFetch>(part->offset_, part->length_, tileIndex));
237 void push_back(uint16_t tileIndex,
const std::unique_ptr<TPSeq>& tileParts,
238 std::vector<std::shared_ptr<TPFetch>>& outParts)
243 for(
auto& part : *tileParts)
245 auto fetchPtr = std::make_shared<TPFetch>(part->offset_, part->length_, tileIndex);
247 outParts.push_back(fetchPtr);
253 std::shared_ptr<TPFetchSeq>& tilePartFetchFlat,
254 std::shared_ptr<std::unordered_map<uint16_t, std::shared_ptr<TPFetchSeq>>>&
257 for(
auto& tileIndex : slated)
259 const auto& tileParts = (*allTileParts)[tileIndex];
260 std::vector<std::shared_ptr<TPFetch>> tileFetchParts;
262 tilePartFetchFlat->push_back(tileIndex, tileParts, tileFetchParts);
264 auto [it, inserted] = tilePartFetchByTile->emplace(tileIndex, std::make_unique<TPFetchSeq>());
267 for(
auto& fetchPtr : tileFetchParts)
269 it->second->SharedPtrSeq<TPFetch>::push_back(fetchPtr);
278 return atomicCount.fetch_add(1, std::memory_order_seq_cst) + 1;
300 std::pair<uint64_t, uint64_t>
next()
override
302 auto& req = *
iter_++;
303 return {req->offset_, req->offset_ + req->length_ - 1};
ResWindow.
Definition CompressedChunkCache.h:36
ILogger & grklog
Definition Logger.cpp:24
std::vector< std::unique_ptr< TPSeq > > TPSEQ_VEC
Definition TPFetchSeq.h:181
DataSlice(uint64_t offset, uint64_t length)
Definition FetchCommon.h:115
uint64_t length_
Definition FetchCommon.h:119
Definition FetchCommon.h:158
Sequence of shared_ptr<T>.
Definition TPFetchSeq.h:38
void push_back(std::shared_ptr< T > ptr)
Adds a pre-existing shared_ptr to the end of the sequence.
Definition TPFetchSeq.h:90
void resize(size_t N)
Definition TPFetchSeq.h:95
iterator begin()
Returns iterator to beginning of sequence.
Definition TPFetchSeq.h:54
typename std::vector< std::shared_ptr< T > >::const_iterator const_iterator
Definition TPFetchSeq.h:40
const_iterator end() const
Returns const iterator to end of sequence.
Definition TPFetchSeq.h:63
const std::shared_ptr< T > & operator[](size_t index) const
Definition TPFetchSeq.h:45
bool empty() const
Checks if there are no objects in store.
Definition TPFetchSeq.h:72
size_t size() const
Returns number of objects in store.
Definition TPFetchSeq.h:81
void clear()
Definition TPFetchSeq.h:99
std::shared_ptr< T > & operator[](size_t index)
Definition TPFetchSeq.h:41
std::vector< std::shared_ptr< T > > objStore_
Definition TPFetchSeq.h:105
typename std::vector< std::shared_ptr< T > >::iterator iterator
Definition TPFetchSeq.h:39
std::unique_ptr< IStream > stream_
Definition TPFetchSeq.h:221
uint16_t tileIndex_
Definition TPFetchSeq.h:218
size_t fetchOffset_
Definition TPFetchSeq.h:220
std::unique_ptr< uint8_t[]> data_
Definition TPFetchSeq.h:219
void copy(uint8_t *chunk, size_t chunkLen)
Copies next fetched data chunk into data buffer Chunks are guaranteed to be received in order for a s...
Definition TPFetchSeq.h:208
TPFetch(uint64_t offset, uint64_t length, uint16_t tileIndex)
Construct a new TPFetch object.
Definition TPFetchSeq.h:197
Definition TPFetchSeq.h:225
uint8_t incrementFetchCount()
Definition TPFetchSeq.h:275
static void genCollections(const TPSEQ_VEC *allTileParts, std::set< uint16_t > &slated, std::shared_ptr< TPFetchSeq > &tilePartFetchFlat, std::shared_ptr< std::unordered_map< uint16_t, std::shared_ptr< TPFetchSeq > > > &tilePartFetchByTile)
Definition TPFetchSeq.h:252
uint8_t fetchCount_
Definition TPFetchSeq.h:282
void push_back(uint16_t tileIndex, const std::unique_ptr< TPSeq > &tileParts)
Definition TPFetchSeq.h:226
void push_back(uint16_t tileIndex, const std::unique_ptr< TPSeq > &tileParts, std::vector< std::shared_ptr< TPFetch > > &outParts)
Definition TPFetchSeq.h:237
Sequence of shared_ptr<DataSlice> tile parts parsed from either TLM or SOT marker.
Definition TPFetchSeq.h:114
void reset()
Definition TPFetchSeq.h:150
bool push_back(uint8_t tilePart, uint8_t numTileParts, uint64_t offset, uint32_t length)
Pushes a new tile part to the back of the sequence.
Definition TPFetchSeq.h:128
uint8_t signalledNumTileParts_
Number of tile parts signalled in code stream This number is either explicitly stored in SOT,...
Definition TPFetchSeq.h:178
void complete(uint64_t tileStreamOffset)
Completes calculations such as absolute tile part offsets, which are not available when TLM markers a...
Definition TPFetchSeq.h:162
~TPSeq()=default
Destroys a TPSeq.
size_t remaining() const override
Definition TPFetchSeq.h:296
std::shared_ptr< TPFetchSeq > requests_
Definition TPFetchSeq.h:307
TPFetchSeq::iterator iter_
Definition TPFetchSeq.h:308
bool hasMore() const override
Definition TPFetchSeq.h:292
TileRequestBatch(std::shared_ptr< TPFetchSeq > requests)
Definition TPFetchSeq.h:288
std::pair< uint64_t, uint64_t > next() override
Definition TPFetchSeq.h:300