SourceXtractorPlusPlus
0.10
Please provide a description of the project.
SEImplementation
SEImplementation
Output
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
28
#include "
SEFramework/Output/Output.h
"
29
30
namespace
SourceXtractor
{
31
32
class
TableOutput
:
public
Output
{
33
34
public
:
35
36
using
SourceToRowConverter
=
std::function
<
Euclid::Table::Row
(
const
SourceInterface
&)>;
37
using
TableHandler
=
std::function
<void(
const
Euclid::Table::Table
&)>;
38
39
size_t
flush
()
override
{
40
if
(!
m_rows
.
empty
()) {
41
Euclid::Table::Table
table {
m_rows
};
42
m_table_handler
(table);
43
}
44
m_total_rows_written
+=
m_rows
.
size
();
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
{
55
m_rows
.
emplace_back
(
m_source_to_row
(source));
56
if
(
m_flush_size
> 0 &&
m_rows
.
size
() %
m_flush_size
== 0) {
57
flush
();
58
}
59
}
60
61
private
:
62
SourceToRowConverter
m_source_to_row
;
63
TableHandler
m_table_handler
;
64
std::vector<Euclid::Table::Row>
m_rows
{};
65
size_t
m_flush_size
;
66
size_t
m_total_rows_written
;
67
};
68
69
}
/* namespace SourceXtractor */
70
71
#endif
/* _SEIMPLEMENTATION_TABLEOUTPUT_H */
72
SourceXtractor::TableOutput::flush
size_t flush() override
Definition:
TableOutput.h:39
SourceXtractor::TableOutput
Definition:
TableOutput.h:32
SourceXtractor::TableOutput::m_total_rows_written
size_t m_total_rows_written
Definition:
TableOutput.h:66
SourceXtractor::TableOutput::outputSource
void outputSource(const SourceInterface &source) override
Definition:
TableOutput.h:54
std::vector< Euclid::Table::Row >
std::vector::size
T size(T... args)
Table.h
CastVisitor.h
SourceXtractor::TableOutput::m_flush_size
size_t m_flush_size
Definition:
TableOutput.h:65
SourceXtractor::TableOutput::m_table_handler
TableHandler m_table_handler
Definition:
TableOutput.h:63
std::function< Euclid::Table::Row(const SourceInterface &)>
std::vector::clear
T clear(T... args)
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::TableOutput::TableOutput
TableOutput(SourceToRowConverter source_to_row, TableHandler table_handler, size_t flush_size)
Definition:
TableOutput.h:49
SourceXtractor::TableOutput::m_rows
std::vector< Euclid::Table::Row > m_rows
Definition:
TableOutput.h:64
Output.h
std::vector::emplace_back
T emplace_back(T... args)
Euclid::Table::Table
std::vector::empty
T empty(T... args)
Euclid::Table::Row
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition:
SourceInterface.h:46
SourceXtractor::Output
Definition:
Output.h:33
SourceXtractor::TableOutput::m_source_to_row
SourceToRowConverter m_source_to_row
Definition:
TableOutput.h:62
Generated by
1.8.17