ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dfe::NamedTupleNumpyWriter< NamedTuple > Class Template Reference

#include <acts/blob/master/thirdparty/dfelibs/dfe/dfe_io_numpy.hpp>

+ Collaboration diagram for dfe::NamedTupleNumpyWriter< NamedTuple >:

Public Member Functions

 NamedTupleNumpyWriter ()=delete
 
 NamedTupleNumpyWriter (const NamedTupleNumpyWriter &)=delete
 
 NamedTupleNumpyWriter (NamedTupleNumpyWriter &&)=default
 
 ~NamedTupleNumpyWriter ()
 
NamedTupleNumpyWriteroperator= (const NamedTupleNumpyWriter &)=delete
 
NamedTupleNumpyWriteroperator= (NamedTupleNumpyWriter &&)=default
 
 NamedTupleNumpyWriter (const std::string &path)
 Create a npy file at the given path. Overwrites existing data.
 
void append (const NamedTuple &record)
 Append a record to the end of the file.
 

Private Types

using Tuple = typename NamedTuple::Tuple
 

Private Member Functions

void write_header (std::size_t num_tuples)
 
template<std::size_t... I>
void write_record (const NamedTuple &record, std::index_sequence< I...>)
 
template<typename T >
void write_bytes (const T *ptr)
 

Private Attributes

std::ofstream m_file
 
std::size_t m_fixed_header_length
 
std::size_t m_num_tuples
 

Detailed Description

template<typename NamedTuple>
class dfe::NamedTupleNumpyWriter< NamedTuple >

Write records into a binary NumPy-compatible .npy file.

See https://docs.scipy.org/doc/numpy/reference/generated/numpy.lib.format.html for an explanation of the file format.

Definition at line 44 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 44 of file dfe_io_numpy.hpp

Member Typedef Documentation

template<typename NamedTuple >
using dfe::NamedTupleNumpyWriter< NamedTuple >::Tuple = typename NamedTuple::Tuple
private

Definition at line 61 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 61 of file dfe_io_numpy.hpp

Constructor & Destructor Documentation

template<typename NamedTuple >
dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter ( )
delete
template<typename NamedTuple >
dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter ( const NamedTupleNumpyWriter< NamedTuple > &  )
delete
template<typename NamedTuple >
dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter ( NamedTupleNumpyWriter< NamedTuple > &&  )
default
template<typename NamedTuple >
dfe::NamedTupleNumpyWriter< NamedTuple >::~NamedTupleNumpyWriter ( )
inline

Definition at line 169 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 169 of file dfe_io_numpy.hpp

template<typename NamedTuple >
dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter ( const std::string &  path)
inline

Create a npy file at the given path. Overwrites existing data.

Definition at line 154 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 154 of file dfe_io_numpy.hpp

References dfe::NamedTupleNumpyWriter< NamedTuple >::m_file, and dfe::NamedTupleNumpyWriter< NamedTuple >::write_header().

+ Here is the call graph for this function:

Member Function Documentation

template<typename NamedTuple >
void dfe::NamedTupleNumpyWriter< NamedTuple >::append ( const NamedTuple &  record)
inline

Append a record to the end of the file.

Definition at line 179 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 179 of file dfe_io_numpy.hpp

template<typename NamedTuple >
NamedTupleNumpyWriter& dfe::NamedTupleNumpyWriter< NamedTuple >::operator= ( const NamedTupleNumpyWriter< NamedTuple > &  )
delete
template<typename NamedTuple >
NamedTupleNumpyWriter& dfe::NamedTupleNumpyWriter< NamedTuple >::operator= ( NamedTupleNumpyWriter< NamedTuple > &&  )
default
template<typename NamedTuple >
template<typename T >
void dfe::NamedTupleNumpyWriter< NamedTuple >::write_bytes ( const T ptr)
inlineprivate

Definition at line 241 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 241 of file dfe_io_numpy.hpp

References T.

template<typename NamedTuple >
void dfe::NamedTupleNumpyWriter< NamedTuple >::write_header ( std::size_t  num_tuples)
inlineprivate

Definition at line 187 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 187 of file dfe_io_numpy.hpp

References dfe::io_npy_impl::dtypes_description(), and nlohmann::to_string().

Referenced by dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename NamedTuple >
template<std::size_t... I>
void dfe::NamedTupleNumpyWriter< NamedTuple >::write_record ( const NamedTuple &  record,
std::index_sequence< I...>   
)
inlineprivate

Definition at line 230 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 230 of file dfe_io_numpy.hpp

References nlohmann::detail::get(), and void().

+ Here is the call graph for this function:

Member Data Documentation

template<typename NamedTuple >
std::ofstream dfe::NamedTupleNumpyWriter< NamedTuple >::m_file
private

Definition at line 63 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 63 of file dfe_io_numpy.hpp

Referenced by dfe::NamedTupleNumpyWriter< NamedTuple >::NamedTupleNumpyWriter().

template<typename NamedTuple >
std::size_t dfe::NamedTupleNumpyWriter< NamedTuple >::m_fixed_header_length
private

Definition at line 64 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 64 of file dfe_io_numpy.hpp

template<typename NamedTuple >
std::size_t dfe::NamedTupleNumpyWriter< NamedTuple >::m_num_tuples
private

Definition at line 65 of file dfe_io_numpy.hpp.

View newest version in sPHENIX GitHub at line 65 of file dfe_io_numpy.hpp


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