ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
procThread.hpp
Go to the documentation of this file.
1
6
7#ifndef CCF_CONTROL_PROC_THREAD_HPP_H_
8#define CCF_CONTROL_PROC_THREAD_HPP_H_
9
14
15namespace ifw::ccf::control {
16
19 public:
20
22 static void SetStatusAll(const ifw::ccf::ProcStatus status);
23
25 ProcThread(const std::string& thread_name,
26 ifw::ccf::mptk::MessageBus& message_bus,
27 const double period = 0.1);
28
29 virtual ~ProcThread();
30
32 void Initialise();
33
35 virtual void UserLogic();
36
38 void SetInputQ(std::shared_ptr<ifw::ccf::common::FrameQueue>& queue);
39
42
44 void SetOutputQ(std::shared_ptr<ifw::ccf::common::FrameQueue>& queue);
45
48
50 void SetStatus(const ifw::ccf::ProcStatus status);
51
54
55 // TODO: Remove these. Use the repository in ifw::ccf::common::RecipeBase.
56 void AddRecipe(std::shared_ptr<ifw::ccf::common::RecipeBase>& recipe_obj);
57 uint8_t NbOfRecipes() const;
58 const ifw::ccf::common::RecipeBase& GetRecipe(const uint16_t nb);
59
62
64 bool GetPipelineEnabled() const;
65
66 protected:
67
68 private:
69 bool CheckMessageBus(bool& new_data_available,
70 bool& new_setup);
71 void CopyAndReleaseFrameHandle();
72 void ExecuteRecipes();
73 void SubmitAndNotify();
74 void HandleNewSetup();
75
76 bool m_allow_frame_skippping;
77 double m_time_for_last_frame_skipping_log;
78
79 // Names of Publisher Threads associated with this Processing Thread.
80 std::vector<std::string> m_pub_thr_names;
81
82 ifw::ccf::ProcStatus m_proc_thread_status; // Used to avoid updating OLDB/PubSub unnecessarily.
83
84 std::list<std::shared_ptr<ifw::ccf::common::RecipeBase>> m_recipes;
85
86 // Map to find Recipe objects easily by means of the Instance ID.
87 std::map<std::string, std::shared_ptr<ifw::ccf::common::RecipeBase>> m_recipe_map;
88
89 // Note: The queues are allocated and deleted by the ifw::ccf::control::application class.
90 std::shared_ptr<ifw::ccf::common::FrameQueue> m_input_q;
91 std::shared_ptr<ifw::ccf::common::FrameQueue> m_output_q;
92
93 ifw::ccf::mptk::Message m_cur_msg; // Current thread message being handled.
94 ifw::ccf::common::DataFrame m_cur_frame; // Current data frame being handled.
95
97
98 bool m_pipeline_enabled;
99 };
100
101}
102
103#endif // CCF_CONTROL_PROC_THREAD_HPP_H_
Class to be used as parent all CCF classes.
Definition base.hpp:122
Frame class used to store the data and metadata for one frames received from the camera.
Definition dataFrame.hpp:20
The FrameQueue class implements a queue, to manage a set of CCF DataFrame instances as a ring buffer.
Definition frameQueue.hpp:17
Class used by the threads to store info for generating performance statistics.
Definition utilities.hpp:29
Processing Recipe base class. All recipes shall be derived from this class.
Definition recipeBase.hpp:49
bool GetPipelineEnabled() const
Return the current enabled status of the Pipeline.
Definition procThread.cpp:335
ifw::ccf::ProcStatus GetStatus() const
Return the Processing Status of this Processing Thread.
Definition procThread.cpp:295
void Initialise()
Initialise the thread object.
Definition procThread.cpp:57
uint8_t NbOfRecipes() const
Definition procThread.cpp:314
void AddRecipe(std::shared_ptr< ifw::ccf::common::RecipeBase > &recipe_obj)
Definition procThread.cpp:300
static void SetStatusAll(const ifw::ccf::ProcStatus status)
Set the status of all Processing Threads running.
Definition procThread.cpp:14
void SetOutputQ(std::shared_ptr< ifw::ccf::common::FrameQueue > &queue)
Set reference to the Output Queue of this Processing Thread.
Definition procThread.cpp:270
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:31
ifw::ccf::common::FrameQueue & GetOutputQ()
Get reference to the Output Queue of this Processing Thread.
Definition procThread.cpp:275
virtual void UserLogic()
Implements the user logic, executed periodically.
Definition procThread.cpp:80
void SetStatus(const ifw::ccf::ProcStatus status)
Set the Processing Status of this Processing Thread.
Definition procThread.cpp:283
ifw::ccf::common::FrameStatistics & GetFrameStat()
Get reference to frame handling statistics.
Definition procThread.cpp:330
const ifw::ccf::common::RecipeBase & GetRecipe(const uint16_t nb)
Definition procThread.cpp:319
virtual ~ProcThread()
Definition procThread.cpp:42
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:257
ifw::ccf::common::FrameQueue & GetInputQ()
Get reference to the Application Input Queue from which the thread gets the frames.
Definition procThread.cpp:262
IFW CTD Multiprocessing Toolkit Message Bus.
Definition messageBus.hpp:92
IFW CTD Multiprocessing Toolkit Message class.
Definition message.hpp:25
IFW CTD Multiprocessing Toolkit Thread base class.
Definition thread.hpp:31
Definition acqThread.cpp:11
ProcStatus
Possible states for a Processing Recipe defined.
Definition base.hpp:198