SourceXtractorPlusPlus  0.13
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
39 
40  size_t flush() override {
41  if (!m_rows.empty()) {
43  m_table_handler(table);
44  }
46  m_rows.clear();
47  return m_total_rows_written;
48  }
49 
50  TableOutput(SourceToRowConverter source_to_row, TableHandler table_handler, SourceHandler source_handler,
51  size_t flush_size)
52  : m_source_to_row(source_to_row), m_table_handler(table_handler), m_source_handler(source_handler),
53  m_flush_size(flush_size), m_total_rows_written(0) {
54  }
55 
56  void outputSource(const SourceInterface& source) override {
57  if (m_source_handler)
58  m_source_handler(source);
60  if (m_flush_size > 0 && m_rows.size() % m_flush_size == 0) {
61  flush();
62  }
63  }
64 
65 private:
70  size_t m_flush_size;
72 };
73 
74 } /* namespace SourceXtractor */
75 
76 #endif /* _SEIMPLEMENTATION_TABLEOUTPUT_H */
77 
T empty(T...args)
size_t flush() override
Definition: TableOutput.h:40
SourceToRowConverter m_source_to_row
Definition: TableOutput.h:66
TableHandler m_table_handler
Definition: TableOutput.h:67
void outputSource(const SourceInterface &source) override
Definition: TableOutput.h:56
TableOutput(SourceToRowConverter source_to_row, TableHandler table_handler, SourceHandler source_handler, size_t flush_size)
Definition: TableOutput.h:50
std::vector< Euclid::Table::Row > m_rows
Definition: TableOutput.h:69
T clear(T...args)
T size(T...args)
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.
SourceHandler m_source_handler
Definition: TableOutput.h:68
T emplace_back(T...args)