AARE
Data analysis library for PSI hybrid detectors
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Attributes
aare::SubFile Class Reference

Class to read a subfile from a RawFile. More...

#include <SubFile.hpp>

Public Member Functions

 SubFile (std::filesystem::path fname, DetectorType detector, ssize_t rows, ssize_t cols, uint16_t bitdepth)
 SubFile constructor.
 
size_t read_impl_normal (std::byte *buffer)
 read the subfile into a buffer
 
template<typename DataType >
size_t read_impl_flip (std::byte *buffer)
 read the subfile into a buffer with the bytes flipped
 
template<typename DataType >
size_t read_impl_reorder (std::byte *buffer)
 read the subfile into a buffer with the bytes reordered
 
size_t get_part (std::byte *buffer, int frame_number)
 read the subfile into a buffer with the bytes reordered and flipped
 
size_t frame_number (int frame_index)
 
size_t bytes_per_part ()
 
size_t pixels_per_part ()
 

Protected Types

using pfunc = size_t(SubFile::*)(std::byte *)
 type of the read_impl function pointer
 

Protected Attributes

pfunc read_impl = nullptr
 
std::map< std::pair< DetectorType, int >, pfuncread_impl_map
 map to store the read_impl functions for different detectors
 
FILE * fp = nullptr
 
ssize_t m_bitdepth
 
std::filesystem::path m_fname
 
ssize_t m_rows {}
 
ssize_t m_cols {}
 
ssize_t n_frames {}
 
int m_sub_file_index_ {}
 

Detailed Description

Class to read a subfile from a RawFile.

Member Typedef Documentation

◆ pfunc

using aare::SubFile::pfunc = size_t (SubFile::*)(std::byte *)
protected

type of the read_impl function pointer

Parameters
bufferpointer to the buffer to read the data into
Returns
number of bytes read

Constructor & Destructor Documentation

◆ SubFile()

aare::SubFile::SubFile ( std::filesystem::path  fname,
DetectorType  detector,
ssize_t  rows,
ssize_t  cols,
uint16_t  bitdepth 
)

SubFile constructor.

Parameters
fnamepath to the subfile
detectordetector type
rowsnumber of rows in the subfile
colsnumber of columns in the subfile
bitdepthbitdepth of the subfile
Exceptions
std::invalid_argumentif the detector,type pair is not supported

Member Function Documentation

◆ bytes_per_part()

size_t aare::SubFile::bytes_per_part ( )
inline

◆ frame_number()

size_t aare::SubFile::frame_number ( int  frame_index)

◆ get_part()

size_t aare::SubFile::get_part ( std::byte *  buffer,
int  frame_number 
)

read the subfile into a buffer with the bytes reordered and flipped

Parameters
bufferpointer to the buffer to read the data into
frame_numberframe number to read
Returns
number of bytes read

◆ pixels_per_part()

size_t aare::SubFile::pixels_per_part ( )
inline

◆ read_impl_flip()

template<typename DataType >
size_t aare::SubFile::read_impl_flip ( std::byte *  buffer)

read the subfile into a buffer with the bytes flipped

Parameters
bufferpointer to the buffer to read the data into
Returns
number of bytes read

◆ read_impl_normal()

size_t aare::SubFile::read_impl_normal ( std::byte *  buffer)

read the subfile into a buffer

Parameters
bufferpointer to the buffer to read the data into
Returns
number of bytes read

◆ read_impl_reorder()

template<typename DataType >
size_t aare::SubFile::read_impl_reorder ( std::byte *  buffer)

read the subfile into a buffer with the bytes reordered

Parameters
bufferpointer to the buffer to read the data into
Returns
number of bytes read

Field Documentation

◆ fp

FILE* aare::SubFile::fp = nullptr
protected

◆ m_bitdepth

ssize_t aare::SubFile::m_bitdepth
protected

◆ m_cols

ssize_t aare::SubFile::m_cols {}
protected

◆ m_fname

std::filesystem::path aare::SubFile::m_fname
protected

◆ m_rows

ssize_t aare::SubFile::m_rows {}
protected

◆ m_sub_file_index_

int aare::SubFile::m_sub_file_index_ {}
protected

◆ n_frames

ssize_t aare::SubFile::n_frames {}
protected

◆ read_impl

pfunc aare::SubFile::read_impl = nullptr
protected

◆ read_impl_map

std::map<std::pair<DetectorType, int>, pfunc> aare::SubFile::read_impl_map
protected
Initial value:

map to store the read_impl functions for different detectors

Note
the key is a pair of DetectorType and bitdepth
the value is a pointer to the read_impl function specific for the detector
the read_impl function will be set to the appropriate function in the constructor

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