From c47b18193d8fa193962f9196a40585a35cbc4b4f Mon Sep 17 00:00:00 2001 From: Joan Sola <jsola@iri.upc.edu> Date: Wed, 27 Apr 2022 22:06:18 +0200 Subject: [PATCH] Add findProcessor(processor name) --- include/core/problem/problem.h | 4 ++++ src/problem/problem.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index d85a6503b..08a7ab52f 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -152,6 +152,10 @@ class Problem : public std::enable_shared_from_this<Problem> * \param _sensor_name The sensor name, as it was installed with installSensor() */ SensorBasePtr findSensor(const std::string& _sensor_name) const; + /** \brief get a processor pointer by its name + * \param _processor_name The processor name, as it was installed with installProcessor() + */ + ProcessorBasePtr findProcessor(const std::string& _processor_name) const; /** \brief Factory method to install (create, and add to sensor) processors only from its properties * diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 3c731dc3e..d80dafb51 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -350,6 +350,16 @@ SensorBasePtr Problem::findSensor(const std::string& _sensor_name) const return (*sen_it); } +ProcessorBasePtr Problem::findProcessor(const std::string& _processor_name) const +{ + for (const auto& sensor : getHardware()->getSensorList()) + for (const auto& processor : sensor->getProcessorList()) + if (processor->getName() == _processor_name) + return processor; + return nullptr; +} + + FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // const StateStructure& _frame_structure, // const SizeEigen _dim, // -- GitLab