fire v0.19.0
Framework for sImulation and Reconstruction of Events
fire::io::Data< std::vector< ContentType > > Class Template Reference

Our wrapper around std::vector. More...

#include <Data.h>

Inheritance diagram for fire::io::Data< std::vector< ContentType > >:
[legend]
Collaboration diagram for fire::io::Data< std::vector< ContentType > >:
[legend]

Public Member Functions

 Data (const std::string &path, Reader *input_file=nullptr, std::vector< ContentType > *handle=nullptr)
 We create two child data sets, one to hold the successive sizes of the vectors and one to hold all of the data in all of the vectors serially. More...
 
void load (h5::Reader &f) final override
 Load a vector from the input file. More...
 
void save (Writer &f) final override
 Save a vector to the output file. More...
 
void structure (Writer &f) final override
 pure virtual method for saving structure More...
 
- Public Member Functions inherited from fire::io::AbstractData< std::vector< ContentType > >
 AbstractData (const std::string &path, Reader *input_file=nullptr, std::vector< ContentType > *handle=nullptr)
 Define the dataset path and provide an optional handle. More...
 
virtual ~AbstractData ()
 Delete our object if we own it, otherwise do nothing. More...
 
virtual void clear ()
 Define the clear function here to handle the most common cases. More...
 
virtual const std::vector< ContentType > & get () const
 Get the current in-memory data. More...
 
int version () const
 Get the version number for the type we are loading from. More...
 
virtual void update (const std::vector< ContentType > &val)
 Update the in-memory data object with the passed value. More...
 
- Public Member Functions inherited from fire::io::BaseData
 BaseData (const std::string &path)
 Define the full in-file path to the data set of this data. More...
 
virtual ~BaseData ()=default
 virtual destructor so inherited classes can be properly destructed.
 

Private Member Functions

 fire_class_version (1)
 

Private Attributes

Data< std::size_tsize_
 the data set of sizes of the vectors
 
Data< ContentType > data_
 the data set holding the content of all the vectors
 

Additional Inherited Members

- Protected Attributes inherited from fire::io::AbstractData< std::vector< ContentType > >
std::optional< std::pair< std::string, int > > load_type_
 type this data is loading from
 
std::pair< std::string, int > save_type_
 type this data that is being used to write
 
std::vector< ContentType > * handle_
 handle on current object in memory
 
bool owner_
 we own the object in memory
 
- Protected Attributes inherited from fire::io::BaseData
std::string path_
 path of data set
 

Detailed Description

template<typename ContentType>
class fire::io::Data< std::vector< ContentType > >

Our wrapper around std::vector.

Note
We assume that the load/save is done sequentially. This assumption is made because (1) it is how fire is designed and (2) it allows us to not have to store as much metadata about the vectors.
Template Parameters
ContentTypetype of object stored within the std::vector

Constructor & Destructor Documentation

◆ Data()

template<typename ContentType >
fire::io::Data< std::vector< ContentType > >::Data ( const std::string path,
Reader input_file = nullptr,
std::vector< ContentType > *  handle = nullptr 
)
inlineexplicit

We create two child data sets, one to hold the successive sizes of the vectors and one to hold all of the data in all of the vectors serially.

Parameters
[in]pathfull in-file path to set holding this data
[in]handlepointer to object already constructed (optional)

Member Function Documentation

◆ load()

template<typename ContentType >
void fire::io::Data< std::vector< ContentType > >::load ( h5::Reader f)
inlinefinaloverridevirtual

Load a vector from the input file.

Note
We assume that the loads are done sequentially.

We read the next size and then read that many items from the content data set into the vector handle.

Parameters
[in]fh5::Reader to load from

Implements fire::io::AbstractData< std::vector< ContentType > >.

◆ save()

template<typename ContentType >
void fire::io::Data< std::vector< ContentType > >::save ( Writer f)
inlinefinaloverridevirtual

Save a vector to the output file.

Note
We assume that the saves are done sequentially.

We write the size and the content onto the end of their data sets.

Parameters
[in]fio::Writer to save to

Implements fire::io::AbstractData< std::vector< ContentType > >.

◆ structure()

template<typename ContentType >
void fire::io::Data< std::vector< ContentType > >::structure ( Writer f)
inlinefinaloverridevirtual

pure virtual method for saving structure

Parameters
[in]fWriter to write to

Implements fire::io::AbstractData< std::vector< ContentType > >.


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