fire v0.19.0
Framework for sImulation and Reconstruction of Events
|
Prototype for reading files within fire. More...
#include <Reader.h>
Public Types | |
using | Factory = ::fire::factory::Factory< Reader, std::unique_ptr< Reader >, const std::string & > |
Type of factory used to create readers. | |
Public Member Functions | |
Reader (const std::string &file_name) | |
open the file at the passed location More... | |
virtual | ~Reader ()=default |
virtual destructor so derived classes can be closed | |
virtual void | load_into (BaseData &d)=0 |
Load the current event into the passed data object. More... | |
virtual std::string | name () const =0 |
Return the name of the file. More... | |
virtual std::size_t | entries () const =0 |
Return the number of events in the file. More... | |
virtual std::size_t | runs () const =0 |
Return the number of runs in the file. More... | |
virtual std::vector< std::pair< std::string, std::string > > | availableObjects ()=0 |
Get the event objects available in the file. More... | |
virtual std::pair< std::string, int > | type (const std::string &path)=0 |
Get the type of the input object. More... | |
virtual bool | canCopy () const |
Event::get needs to know if the reader implements a copy that advances the entry index of the data sets being read. More... | |
virtual void | copy (long unsigned int i_entry, const std::string &path, Writer &output) |
Copy the input object into the output file. More... | |
Prototype for reading files within fire.
This is a prototype class in the sense of fire::factory::Factory, derived classes can register themselves and then the fire::Process can use io::Reader::Factory to create readers from their types.
A reader has a lot of responsiblities in fire, so developing a new one should not be taken lightly.
Besides deriving this class, additional io::Data::load methods need to be defined so that the Reader and successfully interact with the in-memory data objects.
|
inline |
open the file at the passed location
[in] | file_name | full path to file to open |
|
pure virtual |
Get the event objects available in the file.
{ obj_name, pass }
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.
|
inlinevirtual |
Event::get needs to know if the reader implements a copy that advances the entry index of the data sets being read.
Reimplemented in fire::io::h5::Reader.
|
inlinevirtual |
Copy the input object into the output file.
[in] | i_entry | the entry index that is being copied from this reader to output |
[in] | path | the full object path that should be copied |
[out] | output | the writer we should write the copy to |
|
pure virtual |
Return the number of events in the file.
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.
|
pure virtual |
Load the current event into the passed data object.
This must be defined in derived classes to be
We require this function so that the different implementations of io::Data::load are correctly called based on the type of the derived reader.
[in] | d | data object to load into |
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.
|
pure virtual |
Return the name of the file.
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.
|
pure virtual |
Return the number of runs in the file.
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.
|
pure virtual |
Get the type of the input object.
Implemented in fire::io::h5::Reader, and fire::io::root::Reader.