ifw-ccf 5.0.2
Loading...
Searching...
No Matches
procThread.hpp
Go to the documentation of this file.
1
5#ifndef CCF_CONTROL_PROC_THREAD_HPP_H_
6#define CCF_CONTROL_PROC_THREAD_HPP_H_
7
12
13namespace ifw::ccf::control {
14
17 public:
18
20 static void SetStatusAll(const ifw::ccf::ProcStatus status);
21
23 ProcThread(const std::string& thread_name,
24 ifw::ccf::mptk::MessageBus& message_bus,
25 const double period = 0.1);
26
27 virtual ~ProcThread();
28
30 void Initialise();
31
33 virtual void UserLogic();
34
36 void SetInputQ(std::shared_ptr<ifw::ccf::common::FrameQueue>& queue);
37
40
42 void SetOutputQ(std::shared_ptr<ifw::ccf::common::FrameQueue>& queue);
43
46
48 void SetStatus(const ifw::ccf::ProcStatus status);
49
52
53 // TODO: Remove these. Use the repository in ifw::ccf::common::RecipeBase.
54 void AddRecipe(std::shared_ptr<ifw::ccf::common::RecipeBase>& recipe_obj);
55 uint8_t NbOfRecipes() const;
56 const ifw::ccf::common::RecipeBase& GetRecipe(const uint16_t nb);
57
60
62 bool GetPipelineEnabled() const;
63
64 protected:
65
66 private:
67 bool CheckMessageBus(bool& new_data_available,
68 bool& new_setup);
69 void CopyAndReleaseFrameHandle();
70 void ExecuteRecipes();
71 void SubmitAndNotify();
72 void HandleNewSetup();
73
74 bool m_allow_frame_skippping;
75 double m_time_for_last_frame_skipping_log;
76
77 // Names of Publisher Threads associated with this Processing Thread.
78 std::vector<std::string> m_pub_thr_names;
79
80 ifw::ccf::ProcStatus m_proc_thread_status; // Used to avoid updating OLDB/PubSub unnecessarily.
81
82 std::list<std::shared_ptr<ifw::ccf::common::RecipeBase>> m_recipes;
83
84 // Map to find Recipe objects easily by means of the Instance ID.
85 std::map<std::string, std::shared_ptr<ifw::ccf::common::RecipeBase>> m_recipe_map;
86
87 // Note: The queues are allocated and deleted by the ifw::ccf::control::application class.
88 std::shared_ptr<ifw::ccf::common::FrameQueue> m_input_q;
89 std::shared_ptr<ifw::ccf::common::FrameQueue> m_output_q;
90
91 ifw::ccf::mptk::Message m_cur_msg; // Current thread message being handled.
92 ifw::ccf::common::DataFrame m_cur_frame; // Current data frame being handled.
93
95
96 bool m_pipeline_enabled;
97 };
98
99}
100
101#endif // CCF_CONTROL_PROC_THREAD_HPP_H_
Class to be used as parent all CCF classes.
Definition base.hpp:120
Frame class used to store the data and metadata for one frames received from the camera.
Definition dataFrame.hpp:18
The FrameQueue class implements a queue, to manage a set of CCF DataFrame instances as a ring buffer.
Definition frameQueue.hpp:15
Class used by the threads to store info for generating performance statistics.
Definition utilities.hpp:27
Processing Recipe base class. All recipes shall be derived from this class.
Definition recipeBase.hpp:47
Processing Thread MPTK Thread implementation (see also ifw::ccf::mptk::Thread).
Definition procThread.hpp:16
bool GetPipelineEnabled() const
Return the current enabled status of the Pipeline.
Definition procThread.cpp:329
ifw::ccf::ProcStatus GetStatus() const
Return the Processing Status of this Processing Thread.
Definition procThread.cpp:289
void Initialise()
Initialise the thread object.
Definition procThread.cpp:56
uint8_t NbOfRecipes() const
Definition procThread.cpp:308
void AddRecipe(std::shared_ptr< ifw::ccf::common::RecipeBase > &recipe_obj)
Definition procThread.cpp:294
static void SetStatusAll(const ifw::ccf::ProcStatus status)
Set the status of all Processing Threads running.
Definition procThread.cpp:13
void SetOutputQ(std::shared_ptr< ifw::ccf::common::FrameQueue > &queue)
Set reference to the Output Queue of this Processing Thread.
Definition procThread.cpp:264
ProcThread(const std::string &thread_name, ifw::ccf::mptk::MessageBus &message_bus, const double period=0.1)
See ifw::ccf::mptk::Thread.
Definition procThread.cpp:30
ifw::ccf::common::FrameQueue & GetOutputQ()
Get reference to the Output Queue of this Processing Thread.
Definition procThread.cpp:269
virtual void UserLogic()
Implements the user logic, executed periodically.
Definition procThread.cpp:79
void SetStatus(const ifw::ccf::ProcStatus status)
Set the Processing Status of this Processing Thread.
Definition procThread.cpp:277
ifw::ccf::common::FrameStatistics & GetFrameStat()
Get reference to frame handling statistics.
Definition procThread.cpp:324
const ifw::ccf::common::RecipeBase & GetRecipe(const uint16_t nb)
Definition procThread.cpp:313
virtual ~ProcThread()
Definition procThread.cpp:41
void SetInputQ(std::shared_ptr< ifw::ccf::common::FrameQueue > &queue)
Set reference to the Application Input Queue from which the thread gets the frames.
Definition procThread.cpp:251
ifw::ccf::common::FrameQueue & GetInputQ()
Get reference to the Application Input Queue from which the thread gets the frames.
Definition procThread.cpp:256
IFW CTD Multiprocessing Toolkit Message Bus.
Definition messageBus.hpp:91
IFW CTD Multiprocessing Toolkit Message class.
Definition message.hpp:24
IFW CTD Multiprocessing Toolkit Thread base class.
Definition thread.hpp:30
Definition acqThread.cpp:10
ProcStatus
Possible states for a Processing Recipe defined.
Definition base.hpp:196