SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
34 namespace SourceXtractor {
35 
42 public:
46  virtual ~SelectionCriteria() = default;
47 
49  virtual bool mustBeProcessed(const SourceInterface& source) const = 0;
50 };
51 
58 public:
59  bool mustBeProcessed(const SourceInterface& ) const override {
60  return true;
61  }
62 };
63 
70 public:
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 
90 class SourceGrouping : public PipelineEmitter<SourceGroupInterface>, public PipelineReceiver<SourceInterface> {
91 public:
92 
96  virtual ~SourceGrouping() = default;
97 
100  unsigned int hard_limit);
101 
104 
106  void receiveSource(std::unique_ptr<SourceInterface> source) override;
107 
109  void receiveProcessSignal(const ProcessSourcesEvent& event) override;
110 
111 private:
115  unsigned int m_hard_limit;
116 
117 }; /* End of SourceGrouping class */
118 
119 
120 } /* namespace SourceXtractor */
121 
122 
123 #endif
SourceGrouping(std::shared_ptr< GroupingCriteria > grouping_criteria, std::shared_ptr< SourceGroupFactory > group_factory, unsigned int hard_limit)
std::shared_ptr< SourceGroupFactory > m_group_factory
virtual bool shouldGroup(const SourceInterface &first, const SourceInterface &second) const =0
Determines if the two sources should be grouped together.
virtual ~SourceGrouping()=default
Destructor.
Used to determine if a Source is selected for processing.
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition: PipelineStage.h:33
void receiveSource(std::unique_ptr< SourceInterface > source) override
Handles a new Source.
void receiveProcessSignal(const ProcessSourcesEvent &event) override
Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGroupi...
virtual ~SelectionCriteria()=default
Destructor.
bool mustBeProcessed(const SourceInterface &) const override
Determines if the given Source must be processed or not.
std::shared_ptr< GroupingCriteria > m_grouping_criteria
SourceGrouping takes Source, groups them together according to its GroupingCriteria and stores them...
STL class.
Criteria used by SourceGrouping to determine if two sources should be grouped together.
std::set< PropertyId > requiredProperties() const
Returns the set of required properties to compute the grouping.
STL class.
STL class.
virtual bool mustBeProcessed(const SourceInterface &source) const =0
Determines if the given Source must be processed or not.
std::list< std::unique_ptr< SourceGroupInterface > > m_source_groups
constexpr double second
virtual ~GroupingCriteria()=default
Destructor.
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.
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.