|
HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
|
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 const & | getList () const |
| void | setList (list_t const &list) |
| template<typename F , std::enable_if_t< std::is_invocable_r_v< bool, F &, bank &, int >, int > = 0> | |
| void | filter (F &&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) |
rowlist encapsulates a list of rows for this bank, providing a way to iterate over them
| using hipo::bank::rowlist::list_t = std::vector<int> |
|
default |
|
default |
initialize with a full list with specified number of rows
| numRows | if negative, use the owner bank to set the number of rows, otherwise use numRows |
|
inline |
| bank::rowlist::list_t const & hipo::bank::rowlist::getList | ( | ) | const |
filter the list according to a function
| func | a callable bool(bank&, Row), where Row is any arithmetic type (int, double, float, ...); it takes a hipo::bank reference and a row number, and if it returns true, the row is accepted |
bank parameter of func MUST be an lvalue reference (bank&/bank const& or auto&/auto const&, NOT bank/bank const or auto/auto const), otherwise you may create a (rare) data race: passing the bank by value copies it each row, and the copy shallow-aliases the original's internal buffer pointer. This is now rejected at compile time with a static_assert: std::enable_if_t enables this overload only for callables, so the char const* and Parser& overloads below are still selected for their argument types. Defined out-of-line below, after bank is complete. filter the list according to an expression
| expression | the filter expression |
filter the list according to a parsed expression
| p | the parser with the filter expression |
|
static |
num | num | the size of the list |
| ownerBank | set the owner bank |