SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
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
Observable.h
SourceInterface.h
Elements::Exception
SourceXtractor::Observable
Implements the Observer pattern. Notifications will be made using a message of type T.
Definition
Observable.h:51
SourceXtractor::Observable::notifyObservers
void notifyObservers(const T &message) const
Definition
Observable.h:71
SourceXtractor::PipelineEmitter
Definition
PipelineStage.h:68
SourceXtractor::PipelineEmitter::m_next_stage
std::shared_ptr< PipelineReceiver< T > > m_next_stage
Definition
PipelineStage.h:99
SourceXtractor::PipelineEmitter::sendProcessSignal
void sendProcessSignal(const ProcessSourcesEvent &event) const
Definition
PipelineStage.h:92
SourceXtractor::PipelineEmitter::sendSource
void sendSource(std::unique_ptr< T > source) const
Definition
PipelineStage.h:85
SourceXtractor::PipelineEmitter::~PipelineEmitter
~PipelineEmitter() override=default
SourceXtractor::PipelineEmitter::setNextStage
void setNextStage(std::shared_ptr< PipelineReceiver< T > > next)
Definition
PipelineStage.h:77
SourceXtractor::PipelineReceiver
Definition
PipelineStage.h:46
SourceXtractor::PipelineReceiver::receiveProcessSignal
virtual void receiveProcessSignal(const ProcessSourcesEvent &event)=0
SourceXtractor::PipelineReceiver::~PipelineReceiver
virtual ~PipelineReceiver()=default
SourceXtractor::PipelineReceiver::receiveSource
virtual void receiveSource(std::unique_ptr< T > source)=0
std::function
std::move
T move(T... args)
SourceXtractor
Definition
Aperture.h:30
std
STL namespace.
std::next
T next(T... args)
std::shared_ptr
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored.
Definition
PipelineStage.h:33
SourceXtractor::ProcessSourcesEvent::ProcessSourcesEvent
ProcessSourcesEvent(std::shared_ptr< SelectionCriteria > selection_criteria)
Definition
PipelineStage.h:37
SourceXtractor::ProcessSourcesEvent::m_selection_criteria
const std::shared_ptr< SelectionCriteria > m_selection_criteria
Definition
PipelineStage.h:35
Generated by
1.10.0