SourceXtractorPlusPlus  0.15
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Partition.cpp
Go to the documentation of this file.
1 
24 
25 namespace SourceXtractor {
26 
28  : m_steps(std::move(steps)) {
29 }
30 
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) {
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
void notifyObservers(const std::shared_ptr< SourceInterface > &message) const
Definition: Observable.h:71
T end(T...args)
std::vector< std::shared_ptr< PartitionStep > > m_steps
Definition: Partition.h:73
Partition(std::vector< std::shared_ptr< PartitionStep >> steps)
Constructor - takes a vector of PartitionSteps to be applied in order.
Definition: Partition.cpp:27
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
T move(T...args)
T insert(T...args)
STL class.