SourceXtractorPlusPlus
0.19
SourceXtractor++, the next generation SExtractor
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
PipelineStage.h
Go to the documentation of this file.
1
18
#ifndef _SEFRAMEWORK_PIPELINE_PIPELINESTAGE_H
19
#define _SEFRAMEWORK_PIPELINE_PIPELINESTAGE_H
20
21
#include "
SEFramework/Source/SourceInterface.h
"
22
#include "
SEUtils/Observable.h
"
23
24
namespace
SourceXtractor {
25
26
class
SelectionCriteria;
27
33
struct
ProcessSourcesEvent
{
34
35
const
std::shared_ptr<SelectionCriteria>
m_selection_criteria
;
// Used to identify the Sources to process
36
37
explicit
ProcessSourcesEvent
(
std::shared_ptr<SelectionCriteria>
selection_criteria)
38
:
m_selection_criteria
(std::
move
(selection_criteria)) {}
39
};
40
45
template
<
typename
T>
46
class
PipelineReceiver
{
47
public
:
48
virtual
~PipelineReceiver
() =
default
;
49
54
virtual
void
receiveSource
(
std::unique_ptr<T>
source) = 0;
55
60
virtual
void
receiveProcessSignal
(
const
ProcessSourcesEvent
& event) = 0;
61
};
62
67
template
<
typename
T>
68
class
PipelineEmitter
:
public
Observable
<T> {
69
public
:
70
~PipelineEmitter
()
override
=
default
;
71
77
void
setNextStage
(
std::shared_ptr
<
PipelineReceiver<T>
> next) {
78
if
(
m_next_stage
) {
79
throw
Elements::Exception
() <<
"Next stage already set"
;
80
}
81
m_next_stage
=
std::move
(
next
);
82
}
83
84
protected
:
85
void
sendSource
(
std::unique_ptr<T>
source)
const
{
86
Observable<T>::notifyObservers
(*source);
87
if
(
m_next_stage
) {
88
m_next_stage
->receiveSource(
std::move
(source));
89
}
90
}
91
92
void
sendProcessSignal
(
const
ProcessSourcesEvent
& event)
const
{
93
if
(
m_next_stage
) {
94
m_next_stage
->receiveProcessSignal(event);
95
}
96
}
97
98
private
:
99
std::shared_ptr<PipelineReceiver<T>
>
m_next_stage
;
100
};
101
102
}
// namespace SourceXtractor
103
104
#endif // _SEFRAMEWORK_PIPELINE_PIPELINESTAGE_H
std::shared_ptr
SourceXtractor::ProcessSourcesEvent::m_selection_criteria
const std::shared_ptr< SelectionCriteria > m_selection_criteria
Definition:
PipelineStage.h:35
SourceXtractor::PipelineEmitter::sendProcessSignal
void sendProcessSignal(const ProcessSourcesEvent &event) const
Definition:
PipelineStage.h:92
SourceXtractor::Observable::notifyObservers
void notifyObservers(const T &message) const
Definition:
Observable.h:71
SourceXtractor::PipelineEmitter::~PipelineEmitter
~PipelineEmitter() override=default
SourceXtractor::ProcessSourcesEvent::ProcessSourcesEvent
ProcessSourcesEvent(std::shared_ptr< SelectionCriteria > selection_criteria)
Definition:
PipelineStage.h:37
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition:
PipelineStage.h:33
Observable.h
SourceXtractor::PipelineReceiver
Definition:
PipelineStage.h:46
SourceXtractor::PipelineEmitter::setNextStage
void setNextStage(std::shared_ptr< PipelineReceiver< T >> next)
Definition:
PipelineStage.h:77
SourceXtractor::Observable
Implements the Observer pattern. Notifications will be made using a message of type T...
Definition:
Observable.h:51
std::next
T next(T...args)
SourceXtractor::PipelineReceiver::receiveSource
virtual void receiveSource(std::unique_ptr< T > source)=0
std::move
T move(T...args)
SourceInterface.h
std::unique_ptr
STL class.
Elements::Exception
SourceXtractor::PipelineReceiver::receiveProcessSignal
virtual void receiveProcessSignal(const ProcessSourcesEvent &event)=0
SourceXtractor::PipelineReceiver::~PipelineReceiver
virtual ~PipelineReceiver()=default
SourceXtractor::PipelineEmitter::m_next_stage
std::shared_ptr< PipelineReceiver< T > > m_next_stage
Definition:
PipelineStage.h:99
SourceXtractor::PipelineEmitter::sendSource
void sendSource(std::unique_ptr< T > source) const
Definition:
PipelineStage.h:85
SourceXtractor::PipelineEmitter
Definition:
PipelineStage.h:68
Generated by
1.8.5