SourceXtractorPlusPlus  0.10
Please provide a description of the project.
TableOutput.h
Go to the documentation of this file.
1 
17 /*
18  * @file TableOutput.h
19  * @author nikoapos
20  */
21 
22 #ifndef _SEIMPLEMENTATION_TABLEOUTPUT_H
23 #define _SEIMPLEMENTATION_TABLEOUTPUT_H
24 
25 #include "Table/Table.h"
26 #include "Table/CastVisitor.h"
27 
29 
30 namespace SourceXtractor {
31 
32 class TableOutput : public Output {
33 
34 public:
35 
38 
39  size_t flush() override {
40  if (!m_rows.empty()) {
42  m_table_handler(table);
43  }
45  m_rows.clear();
46  return m_total_rows_written;
47  }
48 
49  TableOutput(SourceToRowConverter source_to_row, TableHandler table_handler, size_t flush_size)
50  : m_source_to_row(source_to_row), m_table_handler(table_handler),
51  m_flush_size(flush_size), m_total_rows_written(0) {
52  }
53 
54  void outputSource(const SourceInterface& source) override {
56  if (m_flush_size > 0 && m_rows.size() % m_flush_size == 0) {
57  flush();
58  }
59  }
60 
61 private:
65  size_t m_flush_size;
67 };
68 
69 } /* namespace SourceXtractor */
70 
71 #endif /* _SEIMPLEMENTATION_TABLEOUTPUT_H */
72 
T empty(T... args)
size_t flush() override
Definition: TableOutput.h:39
SourceToRowConverter m_source_to_row
Definition: TableOutput.h:62
TableHandler m_table_handler
Definition: TableOutput.h:63
void outputSource(const SourceInterface &source) override
Definition: TableOutput.h:54
std::vector< Euclid::Table::Row > m_rows
Definition: TableOutput.h:64
TableOutput(SourceToRowConverter source_to_row, TableHandler table_handler, size_t flush_size)
Definition: TableOutput.h:49
T clear(T... args)
T size(T... args)
The SourceInterface is an abstract "source" that has properties attached to it.
T emplace_back(T... args)