Skip to content
Snippets Groups Projects
Commit 8f05890c authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

new methods getCapture(s)OfType

parent 050f2a38
No related branches found
No related tags found
No related merge requests found
Pipeline #6930 passed
...@@ -102,6 +102,12 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha ...@@ -102,6 +102,12 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha
FrameBasePtr getNextFrame() const; FrameBasePtr getNextFrame() const;
const CaptureBasePtrList& getCaptureList() const; const CaptureBasePtrList& getCaptureList() const;
template <class C>
CaptureBasePtr getCaptureOfType() const;
CaptureBasePtr getCaptureOfType(const std::string& type) const;
template <class C>
CaptureBasePtrList getCapturesOfType() const;
CaptureBasePtrList getCapturesOfType(const std::string& type) const;
CaptureBasePtr getCaptureOf(const SensorBaseConstPtr _sensor_ptr) const; CaptureBasePtr getCaptureOf(const SensorBaseConstPtr _sensor_ptr) const;
CaptureBasePtr getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type) const; CaptureBasePtr getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type) const;
CaptureBasePtrList getCapturesOf(const SensorBasePtr _sensor_ptr) const; CaptureBasePtrList getCapturesOf(const SensorBasePtr _sensor_ptr) const;
...@@ -208,6 +214,25 @@ inline void FrameBase::setTrajectory(TrajectoryBasePtr _trj_ptr) ...@@ -208,6 +214,25 @@ inline void FrameBase::setTrajectory(TrajectoryBasePtr _trj_ptr)
trajectory_ptr_ = _trj_ptr; trajectory_ptr_ = _trj_ptr;
} }
template <class C>
inline CaptureBasePtr FrameBase::getCaptureOfType() const
{
for (CaptureBasePtr capture_ptr : getCaptureList())
if (std::dynamic_pointer_cast<C>(capture_ptr) != nullptr)
return capture_ptr;
return nullptr;
}
template <class C>
inline CaptureBasePtrList FrameBase::getCapturesOfType() const
{
CaptureBasePtrList captures;
for (CaptureBasePtr capture_ptr : getCaptureList())
if (std::dynamic_pointer_cast<C>(capture_ptr) != nullptr)
captures.push_back(capture_ptr);
return captures;
}
} // namespace wolf } // namespace wolf
#endif #endif
...@@ -175,6 +175,23 @@ void FrameBase::removeCapture(CaptureBasePtr _capt_ptr) ...@@ -175,6 +175,23 @@ void FrameBase::removeCapture(CaptureBasePtr _capt_ptr)
capture_list_.remove(_capt_ptr); capture_list_.remove(_capt_ptr);
} }
CaptureBasePtr FrameBase::getCaptureOfType(const std::string& type) const
{
for (CaptureBasePtr capture_ptr : getCaptureList())
if (capture_ptr->getType() == type)
return capture_ptr;
return nullptr;
}
CaptureBasePtrList FrameBase::getCapturesOfType(const std::string& type) const
{
CaptureBasePtrList captures;
for (CaptureBasePtr capture_ptr : getCaptureList())
if (capture_ptr->getType() == type)
captures.push_back(capture_ptr);
return captures;
}
CaptureBasePtr FrameBase::getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type) const CaptureBasePtr FrameBase::getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type) const
{ {
for (CaptureBasePtr capture_ptr : getCaptureList()) for (CaptureBasePtr capture_ptr : getCaptureList())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment