AARE
Data analysis library for PSI hybrid detectors
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
aare::FileInterface Class Referenceabstract

FileInterface class to define the interface for file operations. More...

#include <FileInterface.hpp>

Inheritance diagram for aare::FileInterface:
aare::NumpyFile aare::RawFile

Public Member Functions

virtual void write (Frame &frame)=0
 write a frame to the file
 
virtual Frame read ()=0
 write a vector of frames to the file
 
virtual std::vector< Frameread (size_t n_frames)=0
 read n_frames from the file at the current position
 
virtual void read_into (std::byte *image_buf)=0
 read one frame from the file at the current position and store it in the provided buffer
 
virtual void read_into (std::byte *image_buf, size_t n_frames)=0
 read n_frames from the file at the current position and store them in the provided buffer
 
virtual size_t frame_number (size_t frame_index)=0
 get the frame number at the given frame index
 
virtual size_t bytes_per_frame ()=0
 get the size of one frame in bytes
 
virtual size_t pixels ()=0
 get the number of pixels in one frame
 
virtual void seek (size_t frame_number)=0
 seek to the given frame number
 
virtual size_t tell ()=0
 get the current position of the file pointer
 
virtual size_t total_frames () const =0
 get the total number of frames in the file
 
virtual ssize_t rows () const =0
 get the number of rows in the file
 
virtual ssize_t cols () const =0
 get the number of columns in the file
 
virtual ssize_t bitdepth () const =0
 get the bitdepth of the file
 
Frame iread (size_t frame_number)
 read one frame from the file at the given frame number
 
std::vector< Frameiread (size_t frame_number, size_t n_frames)
 read n_frames from the file starting at the given frame number
 
virtual ~FileInterface ()
 

Data Fields

std::string m_mode
 
std::filesystem::path m_fname
 
std::filesystem::path m_base_path
 
std::string m_base_name
 
std::string m_ext
 
int m_findex
 
size_t m_total_frames {}
 
size_t max_frames_per_file {}
 
std::string version
 
DetectorType m_type
 
ssize_t m_rows {}
 
ssize_t m_cols {}
 
ssize_t m_bitdepth {}
 
size_t current_frame {}
 

Detailed Description

FileInterface class to define the interface for file operations.

Note
parent class for NumpyFile and RawFile
all functions are pure virtual and must be implemented by the derived classes

Constructor & Destructor Documentation

◆ ~FileInterface()

virtual aare::FileInterface::~FileInterface ( )
inlinevirtual

Member Function Documentation

◆ bitdepth()

virtual ssize_t aare::FileInterface::bitdepth ( ) const
pure virtual

get the bitdepth of the file

Returns
bitdepth of the file

Implemented in aare::NumpyFile, and aare::RawFile.

◆ bytes_per_frame()

virtual size_t aare::FileInterface::bytes_per_frame ( )
pure virtual

get the size of one frame in bytes

Returns
size of one frame

Implemented in aare::NumpyFile, and aare::RawFile.

◆ cols()

virtual ssize_t aare::FileInterface::cols ( ) const
pure virtual

get the number of columns in the file

Returns
number of columns in the file

Implemented in aare::NumpyFile, and aare::RawFile.

◆ frame_number()

virtual size_t aare::FileInterface::frame_number ( size_t  frame_index)
pure virtual

get the frame number at the given frame index

Parameters
frame_indexindex of the frame
Returns
frame number

Implemented in aare::NumpyFile, and aare::RawFile.

◆ iread() [1/2]

Frame aare::FileInterface::iread ( size_t  frame_number)
inline

read one frame from the file at the given frame number

Parameters
frame_numberframe number to read
Returns
frame

◆ iread() [2/2]

std::vector< Frame > aare::FileInterface::iread ( size_t  frame_number,
size_t  n_frames 
)
inline

read n_frames from the file starting at the given frame number

Parameters
frame_numberframe number to start reading from
n_framesnumber of frames to read
Returns
vector of frames

◆ pixels()

virtual size_t aare::FileInterface::pixels ( )
pure virtual

get the number of pixels in one frame

Returns
number of pixels in one frame

Implemented in aare::NumpyFile, and aare::RawFile.

◆ read() [1/2]

virtual Frame aare::FileInterface::read ( )
pure virtual

write a vector of frames to the file

Parameters
framesvector of frames to write
Returns
void

read one frame from the file at the current position

Returns
Frame

Implemented in aare::NumpyFile, and aare::RawFile.

◆ read() [2/2]

virtual std::vector< Frame > aare::FileInterface::read ( size_t  n_frames)
pure virtual

read n_frames from the file at the current position

Parameters
n_framesnumber of frames to read
Returns
vector of frames

Implemented in aare::NumpyFile, and aare::RawFile.

◆ read_into() [1/2]

virtual void aare::FileInterface::read_into ( std::byte *  image_buf)
pure virtual

read one frame from the file at the current position and store it in the provided buffer

Parameters
image_bufbuffer to store the frame
Returns
void

Implemented in aare::NumpyFile, and aare::RawFile.

◆ read_into() [2/2]

virtual void aare::FileInterface::read_into ( std::byte *  image_buf,
size_t  n_frames 
)
pure virtual

read n_frames from the file at the current position and store them in the provided buffer

Parameters
image_bufbuffer to store the frames
n_framesnumber of frames to read
Returns
void

Implemented in aare::NumpyFile, and aare::RawFile.

◆ rows()

virtual ssize_t aare::FileInterface::rows ( ) const
pure virtual

get the number of rows in the file

Returns
number of rows in the file

Implemented in aare::NumpyFile, and aare::RawFile.

◆ seek()

virtual void aare::FileInterface::seek ( size_t  frame_number)
pure virtual

seek to the given frame number

Parameters
frame_numberframe number to seek to
Returns
void

Implemented in aare::NumpyFile, and aare::RawFile.

◆ tell()

virtual size_t aare::FileInterface::tell ( )
pure virtual

get the current position of the file pointer

Returns
current position of the file pointer

Implemented in aare::NumpyFile, and aare::RawFile.

◆ total_frames()

virtual size_t aare::FileInterface::total_frames ( ) const
pure virtual

get the total number of frames in the file

Returns
total number of frames in the file

Implemented in aare::NumpyFile, and aare::RawFile.

◆ write()

virtual void aare::FileInterface::write ( Frame frame)
pure virtual

write a frame to the file

Parameters
frameframe to write
Returns
void
Exceptions
std::runtime_errorif the function is not implemented

Implemented in aare::NumpyFile, and aare::RawFile.

Field Documentation

◆ current_frame

size_t aare::FileInterface::current_frame {}

◆ m_base_name

std::string aare::FileInterface::m_base_name

◆ m_base_path

std::filesystem::path aare::FileInterface::m_base_path

◆ m_bitdepth

ssize_t aare::FileInterface::m_bitdepth {}

◆ m_cols

ssize_t aare::FileInterface::m_cols {}

◆ m_ext

std::string aare::FileInterface::m_ext

◆ m_findex

int aare::FileInterface::m_findex

◆ m_fname

std::filesystem::path aare::FileInterface::m_fname

◆ m_mode

std::string aare::FileInterface::m_mode

◆ m_rows

ssize_t aare::FileInterface::m_rows {}

◆ m_total_frames

size_t aare::FileInterface::m_total_frames {}

◆ m_type

DetectorType aare::FileInterface::m_type

◆ max_frames_per_file

size_t aare::FileInterface::max_frames_per_file {}

◆ version

std::string aare::FileInterface::version

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