fire v0.19.0
Framework for sImulation and Reconstruction of Events
fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > > Class Template Reference

Data wrapper for atomic types. More...

#include <Data.h>

Inheritance diagram for fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >:
[legend]
Collaboration diagram for fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >:
[legend]

Public Member Functions

 Data (const std::string &path, Reader *input_file=nullptr, AtomicType *handle=nullptr)
 We don't do any more initialization except which is handled by the AbstractData. More...
 
void load (h5::Reader &f) final override
 Down to a type that h5::Reader can handle. More...
 
void save (Writer &f) final override
 Down to a type that io::Writer can handle. More...
 
void structure (Writer &f) final override
 do NOT persist any structure for atomic types More...
 
- Public Member Functions inherited from fire::io::AbstractData< AtomicType >
 AbstractData (const std::string &path, Reader *input_file=nullptr, AtomicType *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 AtomicType & 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 AtomicType &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.
 

Additional Inherited Members

- Protected Attributes inherited from fire::io::AbstractData< AtomicType >
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
 
AtomicType * 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 AtomicType>
class fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >

Data wrapper for atomic types.

See also
io::is_atomic for how we deduce if a type is atomic

Once we finally recurse down to actual fundamental ("atomic") types, we can start actually calling the file load and save methods.

Constructor & Destructor Documentation

◆ Data()

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

We don't do any more initialization except which is handled by the AbstractData.

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

Member Function Documentation

◆ load()

template<typename AtomicType >
void fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >::load ( h5::Reader f)
inlinefinaloverridevirtual

Down to a type that h5::Reader can handle.

See also
h5::Reader::load for how we read data from the file at the input path to our handle.
Parameters
[in]fh5::Reader to load from

Implements fire::io::AbstractData< AtomicType >.

◆ save()

template<typename AtomicType >
void fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >::save ( Writer f)
inlinefinaloverridevirtual

Down to a type that io::Writer can handle.

See also
io::Writer::save for how we write data to the file at the input path from our handle.
Parameters
[in]fio::Writer to save to

Implements fire::io::AbstractData< AtomicType >.

◆ structure()

template<typename AtomicType >
void fire::io::Data< AtomicType, std::enable_if_t< is_atomic_v< AtomicType > > >::structure ( Writer f)
inlinefinaloverridevirtual

do NOT persist any structure for atomic types

The atomic types are translated into H5 DataSets in Writer::save where the types are persisted as well.

Implements fire::io::AbstractData< AtomicType >.


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