Pottu
Public Member Functions | List of all members
pottu::TDRFile Class Reference

Readonly access to a tdr file with some helpers. More...

#include <TDRFile.hpp>

Public Member Functions

 TDRFile (const std::string &path)
 Sets the filename. More...
 
void open ()
 Opens the file and sets file information. More...
 
void close ()
 Closes the file. More...
 
size_t readBlock (uint8_t *buf)
 Reads next block. More...
 
const GZFilegetGZFile () const noexcept
 
bool isOpen () const noexcept
 
bool isEof () const noexcept
 
bool isZipped () const noexcept
 
bool isWordSwapRequired () const noexcept
 
uint32_t getBlocksize () const noexcept
 
int64_t getFilesize () const noexcept
 
const std::string & getPath () const noexcept
 
const ebyedataheader_tgetLastHeader () const noexcept
 

Detailed Description

Readonly access to a tdr file with some helpers.

Constructor & Destructor Documentation

◆ TDRFile()

pottu::TDRFile::TDRFile ( const std::string &  path)
inline

Sets the filename.

This will not open the file. Only filename is set. No check is made if the file is there.

Member Function Documentation

◆ close()

void pottu::TDRFile::close ( )
inline

Closes the file.

File is closed if it is open. isZipped and isWordSwapRequired and getBlocksize methods will still be valid and remember their values.

◆ open()

void pottu::TDRFile::open ( )
inline

Opens the file and sets file information.

Will throw std::runtime_error if file cannot be opened or if the file is not valid tdrfile.

If file is not open currently this will open the file and set blocksize, numOfBlocks (if not gzipped).

◆ readBlock()

size_t pottu::TDRFile::readBlock ( uint8_t *  buf)
inline

Reads next block.

Parameters
bufPointer to a buffer. Size must
Returns
number of data read excluding the header

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