17#ifndef ROOFIT_ROOFITCORE_INC_BATCHDATA_H_
18#define ROOFIT_ROOFITCORE_INC_BATCHDATA_H_
21#include <unordered_map>
69 return item == item2 ? item->second.status :
kNoBatch;
72 const Batch& batch = item->second;
73 if (size <= batch.
data.size())
89 if (item ==
_ownedBatches.end() || size != item->second.data.size())
92 item->second.status = stat;
100 elm.second.status =
kDirty;
113 void print(std::ostream& os,
const std::string&
indent)
const;
140 return !batch.empty();
144 using Map_t = std::unordered_map<std::size_t, Batch>;
147 if (it->second.inBatch(evt))
156 if (it->second.inBatch(begin) && it->second.inBatch(begin+batchSize-1))
157 return it->second.makeSpan(begin, batchSize);
static void indent(ostringstream &buf, int indent_level)
Status_t status(std::size_t begin, std::size_t size) const
Return the status of the batch starting at begin.
RooSpan< const double > findSpanInsideExistingBatch(std::size_t begin, std::size_t batchSize) const
RooSpan< const double > getBatch(std::size_t begin, std::size_t batchSize) const
bool setStatus(std::size_t begin, std::size_t size, Status_t stat)
Set the status of a batch with the given start point and size.
Map_t::const_iterator findEnclosingBatch(std::size_t evt) const
void clear()
Discard all storage.
void print(std::ostream &os, const std::string &indent) const
Print to given output stream.
RooSpan< double > makeWritableBatchInit(std::size_t begin, std::size_t batchSize, double value)
Make a batch and return a span pointing to the pdf-local memory.
Status_t
Status of the batch.
std::unordered_map< std::size_t, Batch > Map_t
const std::vector< double > * _foreignData
void markDirty()
Mark all batches dirty. This will trigger recomputations.
void attachForeignStorage(const std::vector< double > &vec)
Attach a foreign storage. Batches coming from this storage will be read only.
RooSpan< double > makeWritableBatchUnInit(std::size_t begin, std::size_t batchSize)
Make a batch and return a span pointing to the pdf-local memory.
bool validRange(std::size_t begin, std::size_t size) const
A simple container to hold a batch of data values.
std::vector< double > data
bool inBatch(std::size_t evt) const
RooSpan< const double > makeSpan(std::size_t evt, std::size_t batchSize) const