Skip to content
Snippets Groups Projects
Commit 088258a6 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Merge branch 'get_constraint_of' into 'master'

add getConstraintOf

See merge request mobile_robotics/wolf!135
parents 94b9ebf5 8a0b1d89
No related branches found
No related tags found
1 merge request!135add getConstraintOf
...@@ -137,6 +137,9 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase ...@@ -137,6 +137,9 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase
CaptureBaseList getCapturesOf(const SensorBasePtr _sensor_ptr); CaptureBaseList getCapturesOf(const SensorBasePtr _sensor_ptr);
void unlinkCapture(CaptureBasePtr _cap_ptr); void unlinkCapture(CaptureBasePtr _cap_ptr);
ConstraintBasePtr getConstraintOf(const ProcessorBasePtr _processor_ptr);
ConstraintBasePtr getConstraintOf(const ProcessorBasePtr _processor_ptr, const std::string& type);
void getConstraintList(ConstraintBaseList& _ctr_list); void getConstraintList(ConstraintBaseList& _ctr_list);
virtual ConstraintBasePtr addConstrainedBy(ConstraintBasePtr _ctr_ptr); virtual ConstraintBasePtr addConstrainedBy(ConstraintBasePtr _ctr_ptr);
unsigned int getHits() const; unsigned int getHits() const;
...@@ -346,6 +349,25 @@ inline void FrameBase::unlinkCapture(CaptureBasePtr _cap_ptr) ...@@ -346,6 +349,25 @@ inline void FrameBase::unlinkCapture(CaptureBasePtr _cap_ptr)
capture_list_.remove(_cap_ptr); capture_list_.remove(_cap_ptr);
} }
inline ConstraintBasePtr
FrameBase::getConstraintOf(const ProcessorBasePtr _processor_ptr)
{
for (const ConstraintBasePtr& constaint_ptr : getConstrainedByList())
if (constaint_ptr->getProcessor() == _processor_ptr)
return constaint_ptr;
return nullptr;
}
inline ConstraintBasePtr
FrameBase::getConstraintOf(const ProcessorBasePtr _processor_ptr, const std::string& type)
{
for (const ConstraintBasePtr& constaint_ptr : getConstrainedByList())
if (constaint_ptr->getProcessor() == _processor_ptr &&
constaint_ptr->getType() == type)
return constaint_ptr;
return nullptr;
}
inline void FrameBase::getConstraintList(ConstraintBaseList& _ctr_list) inline void FrameBase::getConstraintList(ConstraintBaseList& _ctr_list)
{ {
for (auto c_ptr : getCaptureList()) for (auto c_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