HDTree  0.5.2
HDTree C++ API
hdtree::Writer Class Reference

Write the fire DataSets into a deterministic structure in the output HDF5 data file. More...

#include <Writer.h>

Public Member Functions

 Writer (const std::pair< std::string, std::string > &file_tree_path, bool inplace=false, int rows_per_chunk=10000, bool shuffle=true, int compression_level=6)
 Open the file in write mode. More...
 
 ~Writer ()
 Close up our file, making sure to flush contents to disk.
 
int getRowsPerChunk () const
 get rows per chunk
 
void flush ()
 Flush the data to disk. More...
 
void increment ()
 increment the number of entries in the HDTree
 
const std::string & name () const
 Get the name of this file.
 
void structure (const std::string &branch_name, const std::pair< std::string, int > &type)
 Persist the structure of the event object at the input branch_name. More...
 
HighFive::DataSet createDataSet (const std::string &branch_name, HighFive::DataType data_type)
 
std::size_t entries () const
 Get the number of entries in the file.
 
 Writer (const Writer &)=delete
 don't allow copies of the Writer
 
void operator= (const Writer &)=delete
 don't allow copies of the Writer
 

Private Attributes

HighFive::File file_
 our highfive file
 
HighFive::Group tree_
 handle to the HighFive group we will make be an HDTree
 
HighFive::DataSetCreateProps create_props_
 the creation properties to be used on datasets we are writing
 
HighFive::DataSpace space_
 the dataspace shared amongst all of our datasets
 
std::size_t entries_
 the expected number of entries in this file
 
std::size_t rows_per_chunk_
 number of rows to keep in each chunk
 

Friends

std::ostream & operator<< (std::ostream &s, const Writer &w)
 Stream this writer. More...
 

Detailed Description

Write the fire DataSets into a deterministic structure in the output HDF5 data file.

See also
h5::Reader for where our files are read

Constructor & Destructor Documentation

◆ Writer()

hdtree::Writer::Writer ( const std::pair< std::string, std::string > &  file_tree_path,
bool  inplace = false,
int  rows_per_chunk = 10000,
bool  shuffle = true,
int  compression_level = 6 
)

Open the file in write mode.

Our write mode is the HDF5 TRUNC (overwrite) mode.

Parameters
[in]event_limitMaximum number of events that could end up here
[in]psParameters used to configure the writing of the output file

Member Function Documentation

◆ flush()

void hdtree::Writer::flush ( )

Flush the data to disk.

We flush all buffers and then flush the file.

◆ structure()

void hdtree::Writer::structure ( const std::string &  branch_name,
const std::pair< std::string, int > &  type 
)

Persist the structure of the event object at the input branch_name.

The "structure" is simply the type and the type's version at the correct location within the tree

Note
The save method creates the DataSets so this method should only be called on levels of the hierarchy that DO NOT correspond to HDF5 data sets.
Parameters
[in]branch_namebranch_name to the group
[in]{type,version}pair demangled type name of object and its version number
[in]versionversion number of type

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const Writer w 
)
friend

Stream this writer.

We stream 'Writer' and the name of the file we are writing to

Parameters
[in]sostream to stream into
[in]wwriter to stream
Returns
modified ostream

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