Helios++
Helios software for LiDAR simulations
BinaryFileReader.h
1 #pragma once
2 
3 #include <filems/read/comps/SimpleFileReader.h>
4 #include <filems/read/strategies/BinaryReadingStrategy.h>
5 
6 #include <memory>
7 
8 namespace helios { namespace filems{
9 
10 using std::make_shared;
11 using std::ios_base;
12 
19 class BinaryFileReader : public SimpleFileReader<int>{
20 protected:
21  // *** USING *** //
22  // *************** //
24 
25 public:
26  // *** CONSTRUCTION / DESTRUCTION *** //
27  // ************************************ //
33  string const &path,
34  ios_base::openmode openMode = ios_base::in
35  ) :
36  SimpleFileReader<int>(path, in)
37  {makeStrategy();}
38  virtual ~BinaryFileReader() = default;
39 
40 protected:
41  // *** INNER METHODS *** //
42  // *********************** //
47  void makeStrategy() override
48  {readingStrategy = make_shared<BinaryReadingStrategy>(ifs);}
49 };
50 
51 }}
Class for byte by byte reading of binary files.
Definition: BinaryFileReader.h:19
BinaryFileReader(string const &path, ios_base::openmode openMode=ios_base::in)
Default constructor for binary file reader.
Definition: BinaryFileReader.h:32
void makeStrategy() override
Build a binary reading strategy for the binary file reader.
Definition: BinaryFileReader.h:47
shared_ptr< ReadingStrategy< ReadType > > readingStrategy
The reading strategy to be used by the file reader.
Definition: FileReader.h:32
string path
Path to the file to be read.
Definition: FileReader.h:27
Abstract class defining the fundamental of any file reader that uses standard file input stream as re...
Definition: SimpleFileReader.h:25
ifstream ifs
The input file stream to read from.
Definition: SimpleFileReader.h:37
ios_base::openmode openMode
The open mode flags for the input file stream.
Definition: SimpleFileReader.h:42