HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
hipo::bank::rowlist Class Reference

rowlist encapsulates a list of rows for this bank, providing a way to iterate over them More...

#include <bank.h>

Public Types

using list_t = std::vector< int >
 

Public Member Functions

 rowlist ()=default
 
 ~rowlist ()=default
 
void reset (int numRows=-1)
 initialize with a full list with specified number of rows
 
bool isInitialized () const
 
list_t constgetList () const
 
void setList (list_t const &list)
 
void filter (std::function< bool(bank &, int)> func)
 filter the list according to a function
 
void filter (char const *expression)
 filter the list according to an expression
 
void filter (Parser &p)
 filter the list according to a parsed expression
 
void setOwnerBank (bank *const ownerBank)
 

Static Public Member Functions

static list_t createFullList (int num)
 

Detailed Description

rowlist encapsulates a list of rows for this bank, providing a way to iterate over them

Member Typedef Documentation

◆ list_t

Constructor & Destructor Documentation

◆ rowlist()

hipo::bank::rowlist::rowlist ( )
default

◆ ~rowlist()

hipo::bank::rowlist::~rowlist ( )
default

Member Function Documentation

◆ reset()

void hipo::bank::rowlist::reset ( int  numRows = -1)

initialize with a full list with specified number of rows

Parameters
numRowsif negative, use the owner bank to set the number of rows, otherwise use numRows

◆ isInitialized()

bool hipo::bank::rowlist::isInitialized ( ) const
inline

◆ getList()

bank::rowlist::list_t const & hipo::bank::rowlist::getList ( ) const
Returns
reference to the immutable list

◆ setList()

void hipo::bank::rowlist::setList ( list_t const list)
Parameters
listset the list to this list

◆ filter() [1/3]

void hipo::bank::rowlist::filter ( std::function< bool(bank &, int)>  func)

filter the list according to a function

Parameters
funca function which takes a hipo::bank reference and an int row number and returns a double; if the returned bool is true, the row is accepted
Warning
the bank parameter of func MUST be an lvalue reference (bank& or auto&, NOT bank or auto), otherwise you may create a (rare) data race:
// this is okay: the bank parameter is passed by lvalue reference
my_bank.getMutableRowList().filter([](auto& bank, auto row) { ..... });
// this is NOT okay: the bank parameter is passed by value (no ampersand '&'),
// which can lead to a (rare) data race
my_bank.getMutableRowList().filter([](auto bank, auto row) { ..... });
Definition bank.h:210
T get(int item, int index) const noexcept
Definition bank.h:311

◆ filter() [2/3]

void hipo::bank::rowlist::filter ( char const expression)

filter the list according to an expression

Parameters
expressionthe filter expression

◆ filter() [3/3]

void hipo::bank::rowlist::filter ( Parser p)

filter the list according to a parsed expression

Parameters
pthe parser with the filter expression

◆ createFullList()

bank::rowlist::list_t hipo::bank::rowlist::createFullList ( int  num)
static
Returns
create a list of numbers from 0 to num
Parameters
numthe size of the list

◆ setOwnerBank()

void hipo::bank::rowlist::setOwnerBank ( bank *const  ownerBank)
inline
Parameters
ownerBankset the owner bank

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