17 #include <string_view>
18 #include <unordered_map>
44 std::unique_ptr<hipo::reader>
reader;
46 mutable std::unordered_map<std::string, bank> bank_templates;
50 reader = std::make_unique<hipo::reader>();
56 bank_templates.reserve(schema_list.size());
57 for (
const std::string& name : schema_list) {
59 bank_templates.emplace(name,
bank(sch));
100 if (!event_ptr || !file_ptr)
throw std::runtime_error(
"Invalid HipoEvent (no event data)");
101 auto it = file_ptr->bank_templates.find(std::string(bankName));
102 if (it == file_ptr->bank_templates.end())
throw std::runtime_error(
"Schema not found for bank: " + std::string(bankName));
103 event_ptr->
read(it->second);
126 if (!reader_ptr || !reader_ptr->
next(current_event)) {
127 reader_ptr =
nullptr;
131 current_wrap =
iter_event(¤t_event, file_ptr);
137 iterator() : reader_ptr(nullptr), file_ptr(nullptr), at_end(true) {}
142 if (!reader_ptr || at_end)
return *
this;
143 if (!reader_ptr->
next(current_event)) {
144 reader_ptr =
nullptr;
148 current_wrap.event_ptr = ¤t_event;
149 current_wrap.file_ptr = file_ptr;
177 return {
reader.get(),
this};
Core HIPO data structures: structure, composite, and bank classes for tabular data access.
Represents a HIPO bank, a tabular data structure with rows and typed columns.
Collection of schema definitions, typically read from a HIPO file header.
std::vector< std::string > getSchemaList()
Get a list of all schema names in the dictionary.
schema & getSchema(const char *name)
Retrieve a schema by name.
Represents a HIPO event, a container for multiple structures/banks.
void read(hipo::bank &b)
Read a bank from this event (alias for getStructure).
Input iterator for traversing events in a hipoeventfile.
reference operator*()
Dereference operator; get a reference to the current event wrapper.
std::input_iterator_tag iterator_category
bool operator!=(const iterator &other) const
Inequality comparison operator.
bool operator==(const iterator &other) const
Equality comparison operator.
pointer operator->()
Member access operator; get a pointer to the current event wrapper.
iterator & operator++()
Increment operator; advance to the next event.
iterator()
Construct an end-of-file sentinel iterator.
HIPO file wrapper providing range-based iteration over events.
hipoeventfile & operator=(const hipoeventfile &)=delete
hipoeventfile(const std::string &filename)
hipoeventfile & operator=(hipoeventfile &&other) noexcept=default
iterator end()
Return an iterator representing the end of the file.
hipoeventfile(hipoeventfile &&other) noexcept=default
iterator begin()
Return an iterator to the first event in the file.
hipoeventfile(const hipoeventfile &)=delete
Lightweight event wrapper providing bank access by name.
iter_event(iter_event &&) noexcept=default
bank & get_bank(std::string_view bankName) const
Read and return a bank from the current event by name.
Sequential reader for HIPO files.
void readDictionary(hipo::dictionary &dict)
Read the schema dictionary from the file header.
void rewind()
Rewind to the beginning of the file.
bool next()
Advance to the next event.
void open(const char *filename)
Open a HIPO file for reading.
Schema definition for a HIPO bank.
Schema definitions and schema dictionary for HIPO banks.
HIPO event container and manipulation interface.
Sequential and random-access reader for HIPO files with event filtering and dictionary support.