 |
Fledge
An open source edge computing platform for industrial users
|
1 #ifndef _FILTER_PIPELINE_H
2 #define _FILTER_PIPELINE_H
13 #include <plugin_manager.h>
14 #include <config_category.h>
15 #include <management_client.h>
16 #include <plugin_data.h>
17 #include <reading_set.h>
18 #include <filter_plugin.h>
19 #include <service_handler.h>
20 #include <pipeline_element.h>
21 typedef void (*filterReadingSetFn)(OUTPUT_HANDLE *outHandle,
READINGSET* readings);
34 std::string serviceName);
38 return (m_filters.begin() == m_filters.end()) ?
39 NULL : *(m_filters.begin());
41 unsigned int getFilterCount() {
return m_filters.size(); }
42 void configChange(
const std::string&,
const std::string&);
50 void *useFilteredData,
53 bool isReady() {
return m_ready; };
54 bool hasChanged(
const std::string pipeline)
const {
return m_pipeline != pipeline; }
55 bool isShuttingDown() {
return m_shutdown; };
56 void setShuttingDown() { m_shutdown =
true; }
70 PLUGIN_HANDLE loadFilterPlugin(
const std::string& filterName);
71 void loadPipeline(
const rapidjson::Value& filters, std::vector<PipelineElement *>& pipeline);
72 bool attachDebugger(
const std::vector<PipelineElement *>& pipeline);
73 void detachDebugger(
const std::vector<PipelineElement *>& pipeline);
74 void setDebuggerBuffer(
const std::vector<PipelineElement *>& pipeline,
unsigned int size);
76 std::string readingsToJSON(std::vector<std::shared_ptr<Reading>> readings);
81 std::string serviceName;
82 std::vector<PipelineElement *>
84 std::map<std::string, PipelineElement *>
86 std::string m_pipeline;
92 std::condition_variable m_branchActivations;
void startBranch()
A new branch has started in the pipeline.
Definition: filter_pipeline.cpp:395
void execute()
Called when we pass the data into the pipeline.
Definition: filter_pipeline.cpp:374
std::string getDebuggerBuffer()
Get the debugger buffer contents for all the pipeline elements.
Definition: filter_pipeline.cpp:520
bool attachDebugger()
Attach the debugger to the pipeline elements.
Definition: filter_pipeline.cpp:419
void setDebuggerBuffer(unsigned int size)
Set the debugger buffer size to the pipeline elements.
Definition: filter_pipeline.cpp:491
void cleanupFilters(const std::string &categoryName)
Cleanup all the loaded filters.
Definition: filter_pipeline.cpp:325
void detachDebugger()
Detach the debugger from the pipeline elements.
Definition: filter_pipeline.cpp:463
~FilterPipeline()
FilterPipeline destructor.
Definition: filter_pipeline.cpp:39
The FilterPipeline class is used to represent a pipeline of filters applicable to a task/service.
Definition: filter_pipeline.h:28
Reading set class.
Definition: reading_set.h:26
void awaitCompletion()
Wait for all active branches of the pipeline to complete.
Definition: filter_pipeline.cpp:383
void completeBranch()
A branch in the pipeline has completed.
Definition: filter_pipeline.cpp:404
The management client class used by services and tasks to communicate with the management API of the ...
Definition: management_client.h:43
bool setupFiltersPipeline(void *passToOnwardFilter, void *useFilteredData, void *ingest)
Set the filter pipeline.
Definition: filter_pipeline.cpp:242
Client for accessing the storage service.
Definition: storage_client.h:43
FilterPipeline(ManagementClient *mgtClient, StorageClient &storage, std::string serviceName)
FilterPipeline class constructor.
Definition: filter_pipeline.cpp:31
bool loadFilters(const std::string &categoryName)
Load all filter plugins in the pipeline.
Definition: filter_pipeline.cpp:78
The base pipeline element class.
Definition: pipeline_element.h:29
void replayDebugger()
Replay the data in the first saved buffer to the filter pipeline.
Definition: filter_pipeline.cpp:612
void configChange(const std::string &, const std::string &)
Configuration change for one of the filters.
Definition: filter_pipeline.cpp:361
ServiceHandler abstract class - the interface that services using the management API must provide.
Definition: service_handler.h:20