SourceXtractorPlusPlus 0.19
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SourceGrouping.h
Go to the documentation of this file.
1
23#ifndef _SEFRAMEWORK_PIPELINE_SOURCEGROUPING_H
24#define _SEFRAMEWORK_PIPELINE_SOURCEGROUPING_H
25
26#include <list>
27#include <memory>
28
33
34namespace SourceXtractor {
35
42public:
46 virtual ~SelectionCriteria() = default;
47
49 virtual bool mustBeProcessed(const SourceInterface& source) const = 0;
50};
51
58public:
59 bool mustBeProcessed(const SourceInterface& ) const override {
60 return true;
61 }
62};
63
70public:
74 virtual ~GroupingCriteria() = default;
75
77 virtual bool shouldGroup(const SourceInterface& first, const SourceInterface& second) const = 0;
78
80 virtual std::set<PropertyId> requiredProperties() const { return {}; }
81};
82
90class SourceGrouping : public PipelineEmitter<SourceGroupInterface>, public PipelineReceiver<SourceInterface> {
91public:
92
96 virtual ~SourceGrouping() = default;
97
100 unsigned int hard_limit);
101
104
107
109 void receiveProcessSignal(const ProcessSourcesEvent& event) override;
110
111private:
115 unsigned int m_hard_limit;
116
117}; /* End of SourceGrouping class */
118
119
120} /* namespace SourceXtractor */
121
122
123#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.
SourceGrouping takes Source, groups them together according to its GroupingCriteria and stores them....
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
Returns the set of required properties to compute the grouping.
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.
Definition: PipelineStage.h:33