From 331bf830fba550344faa728467bf923299269c2b Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Wed, 17 Jul 2013 12:03:22 -0400 Subject: [PATCH] A little cleanup --- openbr/openbr_plugin.cpp | 14 +++++++++++++- openbr/openbr_plugin.h | 18 ++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index d33a297..e157eaf 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -1192,7 +1192,7 @@ void Transform::backProject(const TemplateList &dst, TemplateList &src) const futures.waitForFinished(); } -QList Transform::getChildren() +QList Transform::getChildren() const { QList output; for (int i=0; i < metaObject()->propertyCount(); i++) { @@ -1207,6 +1207,18 @@ QList Transform::getChildren() return output; } +TemplateEvent * Transform::getEvent(const QString & name) +{ + foreach(Transform * child, getChildren()) + { + TemplateEvent * probe = child->getEvent(name); + if (probe) + return probe; + } + + return NULL; +} + /* Distance - public methods */ Distance *Distance::make(QString str, QObject *parent) { diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 702614e..0ecf867 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -1162,21 +1162,15 @@ public: /*! * \brief Recursively retrieve a named event, returns NULL if an event is not found. */ - virtual TemplateEvent * getEvent(const QString & name) - { - foreach(Transform * child, getChildren()) - { - TemplateEvent * probe = child->getEvent(name); - if (probe) - return probe; - } + virtual TemplateEvent * getEvent(const QString & name); - return NULL; - } + /*! + * \brief Get a list of child transforms of this transform, child transforms are considered to be + * any transforms stored as properties of this transform. + */ + QList getChildren() const; protected: - QList getChildren(); - Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */ inline Transform *make(const QString &description) { return make(description, this); } /*!< \brief Make a subtransform. */ }; -- libgit2 0.21.4