SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceGrouping.h
Go to the documentation of this file.
1
22
23#ifndef _SEFRAMEWORK_PIPELINE_SOURCEGROUPING_H
24#define _SEFRAMEWORK_PIPELINE_SOURCEGROUPING_H
25
26#include <list>
27#include <memory>
28#include <set>
29
35
36namespace SourceXtractor {
37
44public:
48 virtual ~SelectionCriteria() = default;
49
51 virtual bool mustBeProcessed(const SourceInterface& source) const = 0;
52};
53
60public:
61 bool mustBeProcessed(const SourceInterface& ) const override {
62 return true;
63 }
64};
65
72public:
76 virtual ~GroupingCriteria() = default;
77
79 virtual bool shouldGroup(const SourceInterface& first, const SourceInterface& second) const = 0;
80
82 virtual std::set<PropertyId> requiredProperties() const { return {}; }
83};
84
85class SourceGroupingInterface : public PipelineEmitter<SourceGroupInterface>, public PipelineReceiver<SourceInterface> {
86public:
89};
90
99public:
100
104 virtual ~SourceGrouping() = default;
105
108 unsigned int hard_limit);
109
112
115
117 void receiveProcessSignal(const ProcessSourcesEvent& event) override;
118
119private:
123 unsigned int m_hard_limit;
124
125}; /* End of SourceGrouping class */
126
127
128} /* namespace SourceXtractor */
129
130
131#endif
Criteria used by SourceGrouping to determine if two sources should be grouped together.
virtual ~GroupingCriteria()=default
Destructor.
virtual bool shouldGroup(const SourceInterface &first, const SourceInterface &second) const =0
Determines if the two sources should be grouped together.
virtual std::set< PropertyId > requiredProperties() const
Return a set of used properties so they can be pre-fetched.
An implementation of SelectionCriteria that just marks all Sources as selected.
bool mustBeProcessed(const SourceInterface &) const override
Determines if the given Source must be processed or not.
Used to determine if a Source is selected for processing.
virtual ~SelectionCriteria()=default
Destructor.
virtual bool mustBeProcessed(const SourceInterface &source) const =0
Determines if the given Source must be processed or not.
virtual std::set< PropertyId > requiredProperties() const =0
Returns the set of required properties to compute the grouping.
std::shared_ptr< SourceGroupFactory > m_group_factory
std::list< std::unique_ptr< SourceGroupInterface > > m_source_groups
virtual ~SourceGrouping()=default
Destructor.
void receiveSource(std::unique_ptr< SourceInterface > source) override
Handles a new Source.
std::set< PropertyId > requiredProperties() const override
Returns the set of required properties to compute the grouping.
SourceGrouping(std::shared_ptr< GroupingCriteria > grouping_criteria, std::shared_ptr< SourceGroupFactory > group_factory, unsigned int hard_limit)
std::shared_ptr< GroupingCriteria > m_grouping_criteria
void receiveProcessSignal(const ProcessSourcesEvent &event) override
Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGroupi...
The SourceInterface is an abstract "source" that has properties attached to it.
Event received by SourceGrouping to request the processing of some of the Sources stored.