SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEFramework
src
lib
Pipeline
Partition.cpp
Go to the documentation of this file.
1
23
#include "
SEFramework/Pipeline/Partition.h
"
24
25
namespace
SourceXtractor
{
26
27
Partition::Partition
(
std::vector
<
std::shared_ptr<PartitionStep>
> steps)
28
: m_steps(
std
::
move
(steps)) {
29
}
30
31
void
Partition::handleMessage
(
const
std::shared_ptr<SourceInterface>
& source) {
32
// The input of the current step
33
std::vector<std::shared_ptr<SourceInterface>
> step_input_sources { source };
34
35
// Applies all the steps
36
for
(
const
auto
& step :
m_steps
) {
37
std::vector<std::shared_ptr<SourceInterface>
> step_output_sources;
38
// For each Source in pour input list
39
for
(
const
auto
& source : step_input_sources) {
40
// applies the current step
41
const
auto
partition_output = step->partition(source);
42
// then merges the result
43
step_output_sources.
insert
(step_output_sources.
end
(), partition_output.begin(), partition_output.end());
44
}
45
46
// the output of that step is then used as the input of the next
47
step_input_sources =
std::move
(step_output_sources);
48
}
49
50
// Observers are then notified of the output of the last step
51
for
(
const
auto
& source : step_input_sources) {
52
notifyObservers
(source);
53
}
54
}
55
56
}
// SEFramework namespace
Partition.h
SourceXtractor::Observable< std::shared_ptr< SourceInterface > >::notifyObservers
void notifyObservers(const std::shared_ptr< SourceInterface > &message) const
Definition:
Observable.h:71
SourceXtractor::Partition::handleMessage
virtual void handleMessage(const std::shared_ptr< SourceInterface > &source) override
Handles a Source (applies PartitionSteps) and notifies the Observers for every Source in the final re...
Definition:
Partition.cpp:31
SourceXtractor::Partition::m_steps
std::vector< std::shared_ptr< PartitionStep > > m_steps
Definition:
Partition.h:73
SourceXtractor::Partition::Partition
Partition(std::vector< std::shared_ptr< PartitionStep >> steps)
Constructor - takes a vector of PartitionSteps to be applied in order.
Definition:
Partition.cpp:27
std::vector::end
T end(T... args)
std::vector::insert
T insert(T... args)
std::move
T move(T... args)
SourceXtractor
Definition:
Aperture.h:30
std
STL namespace.
std::shared_ptr
std::vector
Generated by
1.9.1