Logo ROOT  
Reference Guide
BatchHelpers::BatchData Class Reference

Definition at line 26 of file BatchData.h.

Classes

struct  Batch
 

Public Types

enum  Status_t {
  kNoBatch , kDirty , kWriting , kReady ,
  kReadyAndConstant
}
 Status of the batch. More...
 

Public Member Functions

 BatchData ()
 
void attachForeignStorage (const std::vector< double > &vec)
 Attach a foreign storage. Batches coming from this storage will be read only. More...
 
void clear ()
 Discard all storage. More...
 
RooSpan< const double > getBatch (std::size_t begin, std::size_t batchSize) const
 
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. More...
 
RooSpan< double > makeWritableBatchUnInit (std::size_t begin, std::size_t batchSize)
 Make a batch and return a span pointing to the pdf-local memory. More...
 
void markDirty ()
 Mark all batches dirty. This will trigger recomputations. More...
 
void print (std::ostream &os, const std::string &indent) const
 Print to given output stream. More...
 
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. More...
 
Status_t status (std::size_t begin, std::size_t size) const
 Return the status of the batch starting at begin. More...
 

Private Types

using Map_t = std::unordered_map< std::size_t, Batch >
 

Private Member Functions

Map_t::const_iterator findEnclosingBatch (std::size_t evt) const
 
RooSpan< const double > findSpanInsideExistingBatch (std::size_t begin, std::size_t batchSize) const
 
bool validRange (std::size_t begin, std::size_t size) const
 

Private Attributes

const std::vector< double > * _foreignData
 
Map_t _ownedBatches
 

#include <BatchData.h>

Member Typedef Documentation

◆ Map_t

using BatchHelpers::BatchData::Map_t = std::unordered_map<std::size_t, Batch>
private

Definition at line 144 of file BatchData.h.

Member Enumeration Documentation

◆ Status_t

Status of the batch.

Make sure that everything that is readable has a status >= kReady.

Enumerator
kNoBatch 
kDirty 
kWriting 
kReady 
kReadyAndConstant 

Definition at line 30 of file BatchData.h.

Constructor & Destructor Documentation

◆ BatchData()

BatchHelpers::BatchData::BatchData ( )
inline

Definition at line 32 of file BatchData.h.

Member Function Documentation

◆ attachForeignStorage()

void BatchHelpers::BatchData::attachForeignStorage ( const std::vector< double > &  vec)

Attach a foreign storage. Batches coming from this storage will be read only.

Definition at line 94 of file BatchData.cxx.

◆ clear()

void BatchHelpers::BatchData::clear ( )
inline

Discard all storage.

Definition at line 40 of file BatchData.h.

◆ findEnclosingBatch()

Map_t::const_iterator BatchHelpers::BatchData::findEnclosingBatch ( std::size_t  evt) const
inlineprivate

Definition at line 145 of file BatchData.h.

◆ findSpanInsideExistingBatch()

RooSpan< const double > BatchHelpers::BatchData::findSpanInsideExistingBatch ( std::size_t  begin,
std::size_t  batchSize 
) const
inlineprivate

Definition at line 154 of file BatchData.h.

◆ getBatch()

RooSpan< const double > BatchHelpers::BatchData::getBatch ( std::size_t  begin,
std::size_t  batchSize 
) const

Definition at line 25 of file BatchData.cxx.

◆ makeWritableBatchInit()

RooSpan< double > BatchHelpers::BatchData::makeWritableBatchInit ( std::size_t  begin,
std::size_t  batchSize,
double  value 
)

Make a batch and return a span pointing to the pdf-local memory.

Calls makeWritableBatchUnInit() and initialises the memory.

Parameters
[in]beginBegin of the batch.
[in]batchSizeEnd of the batch (not included)
[in]valueValue to initialise with (defaults to 0.).
Returns
An initialised RooSpan starting at event begin.

Definition at line 83 of file BatchData.cxx.

◆ makeWritableBatchUnInit()

RooSpan< double > BatchHelpers::BatchData::makeWritableBatchUnInit ( std::size_t  begin,
std::size_t  batchSize 
)

Make a batch and return a span pointing to the pdf-local memory.

The batch status is switched to kWriting, but the batch is not initialised. If a batch at this start point exists, the storage will be resized to fit the required size.

Parameters
[in]beginBegin of the batch.
[in]batchSizeSize of the batch.
Returns
An uninitialised RooSpan starting at event begin.

Definition at line 58 of file BatchData.cxx.

◆ markDirty()

void BatchHelpers::BatchData::markDirty ( )
inline

Mark all batches dirty. This will trigger recomputations.

Definition at line 97 of file BatchData.h.

◆ print()

void BatchHelpers::BatchData::print ( std::ostream &  os,
const std::string &  indent 
) const

Print to given output stream.

Definition at line 103 of file BatchData.cxx.

◆ setStatus()

bool BatchHelpers::BatchData::setStatus ( std::size_t  begin,
std::size_t  size,
Status_t  stat 
)
inline

Set the status of a batch with the given start point and size.

The status of foreign read-only data will never change.

Returns
True if status successfully set, false if no such batch / not writable.

Definition at line 84 of file BatchData.h.

◆ status()

Status_t BatchHelpers::BatchData::status ( std::size_t  begin,
std::size_t  size 
) const
inline

Return the status of the batch starting at begin.

Parameters
[in]beginStart of the batch.
[in]sizeSize of the batch. This is used to check if the size of an existing batch matches the requested size. Asking for a too large size will be signalled by kNoBatch.

Definition at line 48 of file BatchData.h.

◆ validRange()

bool BatchHelpers::BatchData::validRange ( std::size_t  begin,
std::size_t  size 
) const
inlineprivate

Definition at line 134 of file BatchData.h.

Member Data Documentation

◆ _foreignData

const std::vector<double>* BatchHelpers::BatchData::_foreignData
private

Definition at line 164 of file BatchData.h.

◆ _ownedBatches

Map_t BatchHelpers::BatchData::_ownedBatches
private

Definition at line 163 of file BatchData.h.

Libraries for BatchHelpers::BatchData:
[legend]

The documentation for this class was generated from the following files: