Commit 331bf830fba550344faa728467bf923299269c2b

Authored by Charles Otto
1 parent 298a68aa

A little cleanup

Move implmeentation of getEvents to the .cpp file, make getChildren const and
public.
openbr/openbr_plugin.cpp
@@ -1192,7 +1192,7 @@ void Transform::backProject(const TemplateList &dst, TemplateList &src) const @@ -1192,7 +1192,7 @@ void Transform::backProject(const TemplateList &dst, TemplateList &src) const
1192 futures.waitForFinished(); 1192 futures.waitForFinished();
1193 } 1193 }
1194 1194
1195 -QList<Transform *> Transform::getChildren() 1195 +QList<Transform *> Transform::getChildren() const
1196 { 1196 {
1197 QList<Transform *> output; 1197 QList<Transform *> output;
1198 for (int i=0; i < metaObject()->propertyCount(); i++) { 1198 for (int i=0; i < metaObject()->propertyCount(); i++) {
@@ -1207,6 +1207,18 @@ QList&lt;Transform *&gt; Transform::getChildren() @@ -1207,6 +1207,18 @@ QList&lt;Transform *&gt; Transform::getChildren()
1207 return output; 1207 return output;
1208 } 1208 }
1209 1209
  1210 +TemplateEvent * Transform::getEvent(const QString & name)
  1211 +{
  1212 + foreach(Transform * child, getChildren())
  1213 + {
  1214 + TemplateEvent * probe = child->getEvent(name);
  1215 + if (probe)
  1216 + return probe;
  1217 + }
  1218 +
  1219 + return NULL;
  1220 +}
  1221 +
1210 /* Distance - public methods */ 1222 /* Distance - public methods */
1211 Distance *Distance::make(QString str, QObject *parent) 1223 Distance *Distance::make(QString str, QObject *parent)
1212 { 1224 {
openbr/openbr_plugin.h
@@ -1162,21 +1162,15 @@ public: @@ -1162,21 +1162,15 @@ public:
1162 /*! 1162 /*!
1163 * \brief Recursively retrieve a named event, returns NULL if an event is not found. 1163 * \brief Recursively retrieve a named event, returns NULL if an event is not found.
1164 */ 1164 */
1165 - virtual TemplateEvent * getEvent(const QString & name)  
1166 - {  
1167 - foreach(Transform * child, getChildren())  
1168 - {  
1169 - TemplateEvent * probe = child->getEvent(name);  
1170 - if (probe)  
1171 - return probe;  
1172 - } 1165 + virtual TemplateEvent * getEvent(const QString & name);
1173 1166
1174 - return NULL;  
1175 - } 1167 + /*!
  1168 + * \brief Get a list of child transforms of this transform, child transforms are considered to be
  1169 + * any transforms stored as properties of this transform.
  1170 + */
  1171 + QList<Transform *> getChildren() const;
1176 1172
1177 protected: 1173 protected:
1178 - QList<Transform *> getChildren();  
1179 -  
1180 Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */ 1174 Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */
1181 inline Transform *make(const QString &description) { return make(description, this); } /*!< \brief Make a subtransform. */ 1175 inline Transform *make(const QString &description) { return make(description, this); } /*!< \brief Make a subtransform. */
1182 }; 1176 };