|
HARDT - The Ham Radio DSP Toolkit
|
1 #ifndef __HFILEREADER_H
2 #define __HFILEREADER_H
12 std::ifstream _stream;
13 const std::string _filename;
20 _filename(std::string(filename)),
31 virtual int Read(T* dest,
size_t blocksize)
34 _stream.read((
char*) dest, blocksize *
sizeof(T));
37 if( _probe !=
nullptr ) {
38 _probe->
Write(dest, blocksize *
sizeof(T));
44 HLog(
"At eof. Returning zero read");
54 HLog(
"Trying to open stream for %s", _filename.c_str());
55 _stream.open(_filename.c_str(), std::ios::binary);
56 if( !_stream.is_open())
58 HError(
"Failed to open file %s", _filename.c_str());
61 HLog(
"Stream is open");
68 HLog(
"Closing stream");
76 _stream.seekg(bytes, std::ios::beg);
HFileReader(const std::string filename, HProbe< T > *probe=nullptr)
Definition: hfilereader.h:25
bool Stop()
Definition: hfilereader.h:66
virtual int Read(T *dest, size_t blocksize)
Definition: hfilereader.h:31
Definition: hfilereader.h:8
bool Command(HCommand *command)
Definition: hfilereader.h:80
void Seek(int bytes)
Definition: hfilereader.h:74
HFileReader(const char *filename, HProbe< T > *probe=nullptr)
Definition: hfilereader.h:19
Definition: hcommand.h:81
int Write(T *src, size_t blocksize)
Definition: hprobe.h:40
bool Start()
Definition: hfilereader.h:52