Helios++
Helios software for LiDAR simulations
BaseFullWaveformWriter.h
1 #ifndef _HELIOS_FILEMS_BASE_FULLWAVEFORM_WRITER_H_
2 #define _HELIOS_FILEMS_BASE_FULLWAVEFORM_WRITER_H_
3 
4 #include <filems/write/core/HeliosWriter.h>
5 
6 #include <string>
7 #include <memory>
8 #include <unordered_map>
9 
10 namespace helios { namespace filems{
11 
12 using std::string;
13 using std::shared_ptr;
14 using std::unordered_map;
15 
16 template <typename ... WriteArgs>
17 class BaseFullWaveformWriter : public HeliosWriter<WriteArgs ...>{
18 protected:
19  // *** USING *** //
20  // *************** //
21  using HeliosWriter<WriteArgs ...>::sfw;
22 public:
23  using HeliosWriter<WriteArgs ...>::isZipOutput;
24  using HeliosWriter<WriteArgs ...>::isLasOutput;
25  using HeliosWriter<WriteArgs ...>::isLas10;
26  using HeliosWriter<WriteArgs ...>::getLasScale;
27  using HeliosWriter<WriteArgs ...>::getOutputPath;
28 protected:
29  // *** ATTRIBUTES *** //
30  // ******************** //
35  unordered_map<string, shared_ptr<SyncFileWriter<WriteArgs ...>>> writers{};
36 
37 public:
38  // *** CONSTRUCTION / DESTRUCTION *** //
39  // ************************************ //
44  virtual ~BaseFullWaveformWriter() = default;
45 
46  // *** M E T H O D S *** //
47  // ************************* //
55  virtual void configure(
56  string const &parent,
57  string const &prefix,
58  bool const computeWaveform
59  );
69  virtual shared_ptr<SyncFileWriter<WriteArgs ...>> makeWriter(
70  string const &path
71  ) const = 0;
72 
73  // *** HELIOS WRITER METHODS *** //
74  // ******************************* //
80  void finish() override;
81 
82  // *** GETTERs and SETTERs *** //
83  // ***************************** //
88  void setOutputFilePath(string const &path);
94  fs::path getOutputFilePath() const {return fs::path(getOutputPath());}
98  string getOutputPath() const {return sfw->getPath();}
99 };
100 
101 #include <filems/write/core/BaseFullWaveformWriter.tpp>
102 
103 }}
104 
105 #endif
Definition: BaseFullWaveformWriter.h:17
virtual shared_ptr< SyncFileWriter< WriteArgs ... > > makeWriter(string const &path) const =0
Make a SyncFileWriter that is suitable to be used by the base full waveform writer.
void setOutputFilePath(string const &path)
Set the path to output file.
BaseFullWaveformWriter()=default
Default constructor for base full waveform writer.
fs::path getOutputFilePath() const
Get the path to the output file.
Definition: BaseFullWaveformWriter.h:94
string getOutputPath() const
Definition: BaseFullWaveformWriter.h:98
void finish() override
Finishes all writers.
unordered_map< string, shared_ptr< SyncFileWriter< WriteArgs ... > > > writers
Map of writers. This map allows to reuse writers for legs grouped in the same strip.
Definition: BaseFullWaveformWriter.h:35
virtual void configure(string const &parent, string const &prefix, bool const computeWaveform)
Configure the output path for the full waveform writer.
Alberto M. Esmoris Pena.
Definition: HeliosWriter.h:25
bool isZipOutput() const
Get the zip output flag.
Definition: HeliosWriter.h:120
shared_ptr< SyncFileWriter< WriteArgs ... > > sfw
Synchronous file writer.
Definition: HeliosWriter.h:33
bool isLasOutput() const
Get the LAS output flag.
Definition: HeliosWriter.h:99
double getLasScale() const
Obtain the LAS scale of the measurement writer.
Definition: HeliosWriter.h:131
bool isLas10() const
Get the LAS 10 specification flag.
Definition: HeliosWriter.h:110
Abstract class defining common behavior for all synchronous file writers.
Definition: SyncFileWriter.h:18