SourceXtractorPlusPlus
0.12
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEFramework
SEFramework
Pipeline
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 <memory>
27
#include <list>
28
29
#include "
SEUtils/Observable.h
"
30
31
#include "
SEFramework/Source/SourceInterface.h
"
32
#include "
SEFramework/Source/SourceGroupInterface.h
"
33
#include "
SEFramework/Source/SourceGroupFactory.h
"
34
35
namespace
SourceXtractor {
36
42
class
SelectionCriteria
{
43
public
:
47
virtual
~SelectionCriteria
() =
default
;
48
50
virtual
bool
mustBeProcessed
(
const
SourceInterface
& source)
const
= 0;
51
};
52
58
class
SelectAllCriteria
:
public
SelectionCriteria
{
59
public
:
60
virtual
bool
mustBeProcessed
(
const
SourceInterface
& )
const override
{
61
return
true
;
62
}
63
};
64
65
71
struct
ProcessSourcesEvent
{
72
73
const
SelectionCriteria
&
m_selection_criteria
;
// Used to identify the Sources to process
74
75
ProcessSourcesEvent
(
const
SelectionCriteria
& selection_criteria) :
m_selection_criteria
(selection_criteria) {}
76
};
77
83
class
GroupingCriteria
{
84
public
:
88
virtual
~GroupingCriteria
() =
default
;
89
91
virtual
bool
shouldGroup
(
const
SourceInterface
& first,
const
SourceInterface
&
second
)
const
= 0;
92
};
93
101
class
SourceGrouping
:
public
Observer
<std::shared_ptr<SourceInterface>>,
102
public
Observer
<ProcessSourcesEvent>,
public
Observable
<std::shared_ptr<SourceGroupInterface>> {
103
public
:
104
108
virtual
~SourceGrouping
() =
default
;
109
110
SourceGrouping
(
std::shared_ptr<GroupingCriteria>
grouping_criteria,
111
std::shared_ptr<SourceGroupFactory>
group_factory);
112
114
virtual
void
handleMessage
(
const
std::shared_ptr<SourceInterface>
& source)
override
;
115
116
// Handles a ProcessSourcesEvent to trigger the processing of some of the Sources stored in SourceGrouping
117
virtual
void
handleMessage
(
const
ProcessSourcesEvent
& source)
override
;
118
119
private
:
120
121
std::shared_ptr<GroupingCriteria>
m_grouping_criteria
;
122
std::shared_ptr<SourceGroupFactory>
m_group_factory
;
123
std::list<std::shared_ptr<SourceGroupInterface>
>
m_source_groups
;
124
125
};
/* End of SourceGrouping class */
126
127
128
}
/* namespace SourceXtractor */
129
130
131
#endif
SourceXtractor::SourceGrouping::m_group_factory
std::shared_ptr< SourceGroupFactory > m_group_factory
Definition:
SourceGrouping.h:122
SourceXtractor::GroupingCriteria::shouldGroup
virtual bool shouldGroup(const SourceInterface &first, const SourceInterface &second) const =0
Determines if the two sources should be grouped together.
std::shared_ptr
SourceXtractor::SourceGrouping::~SourceGrouping
virtual ~SourceGrouping()=default
Destructor.
second
constexpr double second
SourceXtractor::SourceGrouping::handleMessage
virtual void handleMessage(const std::shared_ptr< SourceInterface > &source) override
Handles a new Source.
Definition:
SourceGrouping.cpp:33
SourceXtractor::SelectionCriteria
Used to determine if a Source is selected for processing.
Definition:
SourceGrouping.h:42
SourceXtractor::SelectAllCriteria::mustBeProcessed
virtual bool mustBeProcessed(const SourceInterface &) const override
Determines if the given Source must be processed or not.
Definition:
SourceGrouping.h:60
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition:
SourceGrouping.h:71
Observable.h
SourceXtractor::ProcessSourcesEvent::m_selection_criteria
const SelectionCriteria & m_selection_criteria
Definition:
SourceGrouping.h:73
SourceXtractor::SelectionCriteria::~SelectionCriteria
virtual ~SelectionCriteria()=default
Destructor.
SourceGroupInterface.h
SourceXtractor::SourceGrouping::m_source_groups
std::list< std::shared_ptr< SourceGroupInterface > > m_source_groups
Definition:
SourceGrouping.h:123
SourceXtractor::Observable
Implements the Observer pattern. Notifications will be made using a message of type T...
Definition:
Observable.h:51
SourceXtractor::SourceGrouping::SourceGrouping
SourceGrouping(std::shared_ptr< GroupingCriteria > grouping_criteria, std::shared_ptr< SourceGroupFactory > group_factory)
Definition:
SourceGrouping.cpp:28
SourceXtractor::SourceGrouping::m_grouping_criteria
std::shared_ptr< GroupingCriteria > m_grouping_criteria
Definition:
SourceGrouping.h:121
SourceXtractor::SourceGrouping
SourceGrouping takes Source, groups them together according to its GroupingCriteria and stores them...
Definition:
SourceGrouping.h:101
std::list
STL class.
SourceXtractor::GroupingCriteria
Criteria used by SourceGrouping to determine if two sources should be grouped together.
Definition:
SourceGrouping.h:83
SourceInterface.h
SourceXtractor::SelectionCriteria::mustBeProcessed
virtual bool mustBeProcessed(const SourceInterface &source) const =0
Determines if the given Source must be processed or not.
SourceGroupFactory.h
SourceXtractor::Observer
Observer interface to be used with Observable to implement the Observer pattern.
Definition:
Observable.h:38
SourceXtractor::ProcessSourcesEvent::ProcessSourcesEvent
ProcessSourcesEvent(const SelectionCriteria &selection_criteria)
Definition:
SourceGrouping.h:75
SourceXtractor::GroupingCriteria::~GroupingCriteria
virtual ~GroupingCriteria()=default
Destructor.
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition:
SourceInterface.h:46
SourceXtractor::SelectAllCriteria
An implementation of SelectionCriteria that just marks all Sources as selected.
Definition:
SourceGrouping.h:58
Generated by
1.8.5