Commit 17eabb7114746810542d3b7967a90d06665ed362
Merge pull request #214 from biometrics/recursive_property
Implement a method for setting properties after objects have been created
Showing
15 changed files
with
230 additions
and
171 deletions
app/br/br.cpp
| @@ -178,7 +178,7 @@ public: | @@ -178,7 +178,7 @@ public: | ||
| 178 | } else if (!strcmp(fun, "objects")) { | 178 | } else if (!strcmp(fun, "objects")) { |
| 179 | check(parc <= 2, "Incorrect parameter count for 'objects'."); | 179 | check(parc <= 2, "Incorrect parameter count for 'objects'."); |
| 180 | int size = br_objects(NULL, 0, parc >= 1 ? parv[0] : ".*", parc >= 2 ? parv[1] : ".*"); | 180 | int size = br_objects(NULL, 0, parc >= 1 ? parv[0] : ".*", parc >= 2 ? parv[1] : ".*"); |
| 181 | - char * temp = new char[size]; | 181 | + char *temp = new char[size]; |
| 182 | br_objects(temp, size, parc >= 1 ? parv[0] : ".*", parc >= 2 ? parv[1] : ".*"); | 182 | br_objects(temp, size, parc >= 1 ? parv[0] : ".*", parc >= 2 ? parv[1] : ".*"); |
| 183 | printf("%s\n", temp); | 183 | printf("%s\n", temp); |
| 184 | delete [] temp; | 184 | delete [] temp; |
openbr/core/core.cpp
| @@ -49,7 +49,7 @@ struct AlgorithmCore | @@ -49,7 +49,7 @@ struct AlgorithmCore | ||
| 49 | 49 | ||
| 50 | QScopedPointer<Transform> trainingWrapper(Transform::make("DirectStream(readMode=DistributeFrames)", NULL)); | 50 | QScopedPointer<Transform> trainingWrapper(Transform::make("DirectStream(readMode=DistributeFrames)", NULL)); |
| 51 | 51 | ||
| 52 | - CompositeTransform * downcast = dynamic_cast<CompositeTransform *>(trainingWrapper.data()); | 52 | + CompositeTransform *downcast = dynamic_cast<CompositeTransform *>(trainingWrapper.data()); |
| 53 | if (downcast == NULL) | 53 | if (downcast == NULL) |
| 54 | qFatal("downcast failed?"); | 54 | qFatal("downcast failed?"); |
| 55 | downcast->transforms.append(this->transform.data()); | 55 | downcast->transforms.append(this->transform.data()); |
| @@ -144,7 +144,7 @@ struct AlgorithmCore | @@ -144,7 +144,7 @@ struct AlgorithmCore | ||
| 144 | fileExclusion = true; | 144 | fileExclusion = true; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | - Gallery * temp = Gallery::make(input); | 147 | + Gallery *temp = Gallery::make(input); |
| 148 | qint64 total = temp->totalSize(); | 148 | qint64 total = temp->totalSize(); |
| 149 | 149 | ||
| 150 | Globals->currentStep = 0; | 150 | Globals->currentStep = 0; |
| @@ -156,13 +156,13 @@ struct AlgorithmCore | @@ -156,13 +156,13 @@ struct AlgorithmCore | ||
| 156 | 156 | ||
| 157 | if (!multiProcess) { | 157 | if (!multiProcess) { |
| 158 | basePipe.reset(Transform::make(pipeDesc,NULL)); | 158 | basePipe.reset(Transform::make(pipeDesc,NULL)); |
| 159 | - CompositeTransform * downcast = dynamic_cast<CompositeTransform *>(basePipe.data()); | 159 | + CompositeTransform *downcast = dynamic_cast<CompositeTransform *>(basePipe.data()); |
| 160 | 160 | ||
| 161 | if (downcast == NULL) qFatal("downcast failed?"); | 161 | if (downcast == NULL) qFatal("downcast failed?"); |
| 162 | 162 | ||
| 163 | downcast->transforms.prepend(this->transform.data()); | 163 | downcast->transforms.prepend(this->transform.data()); |
| 164 | if (fileExclusion) { | 164 | if (fileExclusion) { |
| 165 | - Transform * temp = Transform::make("FileExclusion(" + gallery.flat() + ")", downcast); | 165 | + Transform *temp = Transform::make("FileExclusion(" + gallery.flat() + ")", downcast); |
| 166 | downcast->transforms.prepend(temp); | 166 | downcast->transforms.prepend(temp); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| @@ -180,7 +180,7 @@ struct AlgorithmCore | @@ -180,7 +180,7 @@ struct AlgorithmCore | ||
| 180 | // Next, we make a Stream (with placeholder transform) | 180 | // Next, we make a Stream (with placeholder transform) |
| 181 | QString streamDesc = "Stream(readMode=StreamGallery)"; | 181 | QString streamDesc = "Stream(readMode=StreamGallery)"; |
| 182 | QScopedPointer<Transform> baseStream(Transform::make(streamDesc, NULL)); | 182 | QScopedPointer<Transform> baseStream(Transform::make(streamDesc, NULL)); |
| 183 | - WrapperTransform * wrapper = dynamic_cast<WrapperTransform *> (baseStream.data()); | 183 | + WrapperTransform *wrapper = dynamic_cast<WrapperTransform *> (baseStream.data()); |
| 184 | 184 | ||
| 185 | // replace that placeholder with the pipe we built | 185 | // replace that placeholder with the pipe we built |
| 186 | wrapper->transform = basePipe.data(); | 186 | wrapper->transform = basePipe.data(); |
| @@ -373,7 +373,7 @@ struct AlgorithmCore | @@ -373,7 +373,7 @@ struct AlgorithmCore | ||
| 373 | File colGallery = targetGallery; | 373 | File colGallery = targetGallery; |
| 374 | qint64 rowSize; | 374 | qint64 rowSize; |
| 375 | 375 | ||
| 376 | - Gallery * temp; | 376 | + Gallery *temp; |
| 377 | if (transposeMode) | 377 | if (transposeMode) |
| 378 | { | 378 | { |
| 379 | rowGallery = targetGallery; | 379 | rowGallery = targetGallery; |
| @@ -456,7 +456,7 @@ struct AlgorithmCore | @@ -456,7 +456,7 @@ struct AlgorithmCore | ||
| 456 | { | 456 | { |
| 457 | compareRegionDesc = compareRegionDesc; | 457 | compareRegionDesc = compareRegionDesc; |
| 458 | compareRegion.reset(Transform::make(compareRegionDesc,NULL)); | 458 | compareRegion.reset(Transform::make(compareRegionDesc,NULL)); |
| 459 | - CompositeTransform * downcast = dynamic_cast<CompositeTransform *> (compareRegion.data()); | 459 | + CompositeTransform *downcast = dynamic_cast<CompositeTransform *> (compareRegion.data()); |
| 460 | if (downcast == NULL) | 460 | if (downcast == NULL) |
| 461 | qFatal("Pipe downcast failed in compare"); | 461 | qFatal("Pipe downcast failed in compare"); |
| 462 | 462 | ||
| @@ -496,7 +496,7 @@ struct AlgorithmCore | @@ -496,7 +496,7 @@ struct AlgorithmCore | ||
| 496 | 496 | ||
| 497 | // Assign the comparison transform we previously built, and the output transform we just built to | 497 | // Assign the comparison transform we previously built, and the output transform we just built to |
| 498 | // two stages of a pipe. | 498 | // two stages of a pipe. |
| 499 | - CompositeTransform * downcast = dynamic_cast<CompositeTransform *> (join.data()); | 499 | + CompositeTransform *downcast = dynamic_cast<CompositeTransform *> (join.data()); |
| 500 | downcast->transforms.append(compareRegion.data()); | 500 | downcast->transforms.append(compareRegion.data()); |
| 501 | downcast->transforms.append(outputTform.data()); | 501 | downcast->transforms.append(outputTform.data()); |
| 502 | 502 | ||
| @@ -508,7 +508,7 @@ struct AlgorithmCore | @@ -508,7 +508,7 @@ struct AlgorithmCore | ||
| 508 | // and pass the transforms it reads through the base algorithm. | 508 | // and pass the transforms it reads through the base algorithm. |
| 509 | QString streamDesc = "Stream(readMode=StreamGallery)"; | 509 | QString streamDesc = "Stream(readMode=StreamGallery)"; |
| 510 | QScopedPointer<Transform> streamBase(Transform::make(streamDesc, NULL)); | 510 | QScopedPointer<Transform> streamBase(Transform::make(streamDesc, NULL)); |
| 511 | - WrapperTransform * streamWrapper = dynamic_cast<WrapperTransform *> (streamBase.data()); | 511 | + WrapperTransform *streamWrapper = dynamic_cast<WrapperTransform *> (streamBase.data()); |
| 512 | streamWrapper->transform = join.data(); | 512 | streamWrapper->transform = join.data(); |
| 513 | 513 | ||
| 514 | // The transform we will use is now complete. | 514 | // The transform we will use is now complete. |
| @@ -687,7 +687,7 @@ void br::Convert(const File &fileType, const File &inputFile, const File &output | @@ -687,7 +687,7 @@ void br::Convert(const File &fileType, const File &inputFile, const File &output | ||
| 687 | 687 | ||
| 688 | if (targetFiles.size() != m.cols) | 688 | if (targetFiles.size() != m.cols) |
| 689 | { | 689 | { |
| 690 | - MatrixOutput * mOut = dynamic_cast<MatrixOutput *>(o.data()); | 690 | + MatrixOutput *mOut = dynamic_cast<MatrixOutput *>(o.data()); |
| 691 | if (mOut) | 691 | if (mOut) |
| 692 | mOut->data.create(queryFiles.size(), 1, CV_32FC1); | 692 | mOut->data.create(queryFiles.size(), 1, CV_32FC1); |
| 693 | } | 693 | } |
| @@ -730,7 +730,7 @@ QSharedPointer<br::Transform> br::Transform::fromAlgorithm(const QString &algori | @@ -730,7 +730,7 @@ QSharedPointer<br::Transform> br::Transform::fromAlgorithm(const QString &algori | ||
| 730 | else { | 730 | else { |
| 731 | QSharedPointer<Transform> orig_tform = AlgorithmManager::getAlgorithm(algorithm)->transform; | 731 | QSharedPointer<Transform> orig_tform = AlgorithmManager::getAlgorithm(algorithm)->transform; |
| 732 | QSharedPointer<Transform> newRoot = QSharedPointer<Transform>(Transform::make("Stream(readMode=DistributeFrames)", NULL)); | 732 | QSharedPointer<Transform> newRoot = QSharedPointer<Transform>(Transform::make("Stream(readMode=DistributeFrames)", NULL)); |
| 733 | - WrapperTransform * downcast = dynamic_cast<WrapperTransform *> (newRoot.data()); | 733 | + WrapperTransform *downcast = dynamic_cast<WrapperTransform *> (newRoot.data()); |
| 734 | downcast->transform = orig_tform.data(); | 734 | downcast->transform = orig_tform.data(); |
| 735 | downcast->init(); | 735 | downcast->init(); |
| 736 | return newRoot; | 736 | return newRoot; |
openbr/core/eval.cpp
| @@ -68,7 +68,7 @@ static float getTAR(const QList<OperatingPoint> &operatingPoints, float FAR) | @@ -68,7 +68,7 @@ static float getTAR(const QList<OperatingPoint> &operatingPoints, float FAR) | ||
| 68 | 68 | ||
| 69 | // Decide whether to construct a normal mask matrix, or a pairwise mask by comparing the dimensions of | 69 | // Decide whether to construct a normal mask matrix, or a pairwise mask by comparing the dimensions of |
| 70 | // scores with the size of the target and query lists | 70 | // scores with the size of the target and query lists |
| 71 | -static cv::Mat constructMatchingMask(const cv::Mat & scores, const FileList & target, const FileList & query, int partition=0) | 71 | +static cv::Mat constructMatchingMask(const cv::Mat &scores, const FileList &target, const FileList &query, int partition=0) |
| 72 | { | 72 | { |
| 73 | // If the dimensions of the score matrix match the sizes of the target and query lists, construct a normal mask matrix | 73 | // If the dimensions of the score matrix match the sizes of the target and query lists, construct a normal mask matrix |
| 74 | if (target.size() == scores.cols && query.size() == scores.rows) | 74 | if (target.size() == scores.cols && query.size() == scores.rows) |
| @@ -288,7 +288,7 @@ struct GenImpCounts | @@ -288,7 +288,7 @@ struct GenImpCounts | ||
| 288 | qint64 impCount; | 288 | qint64 impCount; |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | -float InplaceEval(const QString & simmat, const QString & target, const QString & query, const QString & csv) | 291 | +float InplaceEval(const QString &simmat, const QString &target, const QString &query, const QString &csv) |
| 292 | { | 292 | { |
| 293 | qDebug("Evaluating %s%s%s", | 293 | qDebug("Evaluating %s%s%s", |
| 294 | qPrintable(simmat), | 294 | qPrintable(simmat), |
openbr/openbr_plugin.cpp
| @@ -517,7 +517,7 @@ TemplateList TemplateList::relabel(const TemplateList &tl, const QString &propNa | @@ -517,7 +517,7 @@ TemplateList TemplateList::relabel(const TemplateList &tl, const QString &propNa | ||
| 517 | return result; | 517 | return result; |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | -QList<int> TemplateList::indexProperty(const QString & propName, QHash<QString, int> * valueMap,QHash<int, QVariant> * reverseLookup) const | 520 | +QList<int> TemplateList::indexProperty(const QString &propName, QHash<QString, int> * valueMap,QHash<int, QVariant> * reverseLookup) const |
| 521 | { | 521 | { |
| 522 | QHash<QString, int> dummyForwards; | 522 | QHash<QString, int> dummyForwards; |
| 523 | QHash<int, QVariant> dummyBackwards; | 523 | QHash<int, QVariant> dummyBackwards; |
| @@ -528,13 +528,13 @@ QList<int> TemplateList::indexProperty(const QString & propName, QHash<QString, | @@ -528,13 +528,13 @@ QList<int> TemplateList::indexProperty(const QString & propName, QHash<QString, | ||
| 528 | return indexProperty(propName, *valueMap, *reverseLookup); | 528 | return indexProperty(propName, *valueMap, *reverseLookup); |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | -QList<int> TemplateList::indexProperty(const QString & propName, QHash<QString, int> & valueMap, QHash<int, QVariant> & reverseLookup) const | 531 | +QList<int> TemplateList::indexProperty(const QString &propName, QHash<QString, int> &valueMap, QHash<int, QVariant> &reverseLookup) const |
| 532 | { | 532 | { |
| 533 | valueMap.clear(); | 533 | valueMap.clear(); |
| 534 | reverseLookup.clear(); | 534 | reverseLookup.clear(); |
| 535 | 535 | ||
| 536 | const QList<QVariant> originalLabels = File::values(*this, propName); | 536 | const QList<QVariant> originalLabels = File::values(*this, propName); |
| 537 | - foreach (const QVariant & label, originalLabels) { | 537 | + foreach (const QVariant &label, originalLabels) { |
| 538 | QString labelString = label.toString(); | 538 | QString labelString = label.toString(); |
| 539 | if (!valueMap.contains(labelString)) { | 539 | if (!valueMap.contains(labelString)) { |
| 540 | reverseLookup.insert(valueMap.size(), label); | 540 | reverseLookup.insert(valueMap.size(), label); |
| @@ -717,6 +717,16 @@ void Object::load(QDataStream &stream) | @@ -717,6 +717,16 @@ void Object::load(QDataStream &stream) | ||
| 717 | init(); | 717 | init(); |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | +bool Object::setPropertyRecursive(const QString &name, QVariant value) | ||
| 721 | +{ | ||
| 722 | + if (this->metaObject()->indexOfProperty(qPrintable(name)) == -1) | ||
| 723 | + return false; | ||
| 724 | + | ||
| 725 | + setProperty(name, value); | ||
| 726 | + init(); | ||
| 727 | + return true; | ||
| 728 | +} | ||
| 729 | + | ||
| 720 | void Object::setProperty(const QString &name, QVariant value) | 730 | void Object::setProperty(const QString &name, QVariant value) |
| 721 | { | 731 | { |
| 722 | QString type; | 732 | QString type; |
| @@ -1300,8 +1310,8 @@ QList<Transform *> Transform::getChildren() const | @@ -1300,8 +1310,8 @@ QList<Transform *> Transform::getChildren() const | ||
| 1300 | { | 1310 | { |
| 1301 | QList<Transform *> output; | 1311 | QList<Transform *> output; |
| 1302 | for (int i=0; i < metaObject()->propertyCount(); i++) { | 1312 | for (int i=0; i < metaObject()->propertyCount(); i++) { |
| 1303 | - const char * prop_name = metaObject()->property(i).name(); | ||
| 1304 | - const QVariant & variant = this->property(prop_name); | 1313 | + const char *prop_name = metaObject()->property(i).name(); |
| 1314 | + const QVariant &variant = this->property(prop_name); | ||
| 1305 | 1315 | ||
| 1306 | if (variant.canConvert<Transform *>()) | 1316 | if (variant.canConvert<Transform *>()) |
| 1307 | output.append(variant.value<Transform *>()); | 1317 | output.append(variant.value<Transform *>()); |
| @@ -1311,11 +1321,11 @@ QList<Transform *> Transform::getChildren() const | @@ -1311,11 +1321,11 @@ QList<Transform *> Transform::getChildren() const | ||
| 1311 | return output; | 1321 | return output; |
| 1312 | } | 1322 | } |
| 1313 | 1323 | ||
| 1314 | -TemplateEvent * Transform::getEvent(const QString & name) | 1324 | +TemplateEvent *Transform::getEvent(const QString &name) |
| 1315 | { | 1325 | { |
| 1316 | - foreach(Transform * child, getChildren()) | 1326 | + foreach(Transform *child, getChildren()) |
| 1317 | { | 1327 | { |
| 1318 | - TemplateEvent * probe = child->getEvent(name); | 1328 | + TemplateEvent *probe = child->getEvent(name); |
| 1319 | if (probe) | 1329 | if (probe) |
| 1320 | return probe; | 1330 | return probe; |
| 1321 | } | 1331 | } |
| @@ -1337,7 +1347,7 @@ void Transform::train(const TemplateList &data) | @@ -1337,7 +1347,7 @@ void Transform::train(const TemplateList &data) | ||
| 1337 | void Transform::train(const QList<TemplateList> &data) | 1347 | void Transform::train(const QList<TemplateList> &data) |
| 1338 | { | 1348 | { |
| 1339 | TemplateList combined; | 1349 | TemplateList combined; |
| 1340 | - foreach(const TemplateList & set, data) { | 1350 | + foreach(const TemplateList &set, data) { |
| 1341 | combined.append(set); | 1351 | combined.append(set); |
| 1342 | } | 1352 | } |
| 1343 | train(combined); | 1353 | train(combined); |
openbr/openbr_plugin.h
| @@ -461,9 +461,9 @@ struct TemplateList : public QList<Template> | @@ -461,9 +461,9 @@ struct TemplateList : public QList<Template> | ||
| 461 | /*!< \brief Ensure labels are in the range [0,numClasses-1]. */ | 461 | /*!< \brief Ensure labels are in the range [0,numClasses-1]. */ |
| 462 | BR_EXPORT static TemplateList relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers); | 462 | BR_EXPORT static TemplateList relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers); |
| 463 | 463 | ||
| 464 | - QList<int> indexProperty(const QString & propName, QHash<QString, int> * valueMap=NULL,QHash<int, QVariant> * reverseLookup = NULL) const; | ||
| 465 | - QList<int> indexProperty(const QString & propName, QHash<QString, int> & valueMap, QHash<int, QVariant> & reverseLookup) const; | ||
| 466 | - QList<int> applyIndex(const QString & propName, const QHash<QString, int> & valueMap) const; | 464 | + QList<int> indexProperty(const QString &propName, QHash<QString, int> * valueMap=NULL,QHash<int, QVariant> * reverseLookup = NULL) const; |
| 465 | + QList<int> indexProperty(const QString &propName, QHash<QString, int> &valueMap, QHash<int, QVariant> &reverseLookup) const; | ||
| 466 | + QList<int> applyIndex(const QString &propName, const QHash<QString, int> &valueMap) const; | ||
| 467 | 467 | ||
| 468 | /*! | 468 | /*! |
| 469 | * \brief Returns the total number of bytes in all the templates. | 469 | * \brief Returns the total number of bytes in all the templates. |
| @@ -539,7 +539,7 @@ struct TemplateList : public QList<Template> | @@ -539,7 +539,7 @@ struct TemplateList : public QList<Template> | ||
| 539 | * \brief Returns the number of occurences for each label in the list. | 539 | * \brief Returns the number of occurences for each label in the list. |
| 540 | */ | 540 | */ |
| 541 | template<typename T> | 541 | template<typename T> |
| 542 | - QMap<T,int> countValues(const QString & propName, bool excludeFailures = false) const | 542 | + QMap<T,int> countValues(const QString &propName, bool excludeFailures = false) const |
| 543 | { | 543 | { |
| 544 | QMap<T, int> labelCounts; | 544 | QMap<T, int> labelCounts; |
| 545 | foreach (const File &file, files()) | 545 | foreach (const File &file, files()) |
| @@ -597,6 +597,8 @@ public: | @@ -597,6 +597,8 @@ public: | ||
| 597 | QString argument(int index) const; /*!< \brief A string value for the argument at the specified index. */ | 597 | QString argument(int index) const; /*!< \brief A string value for the argument at the specified index. */ |
| 598 | QString description() const; /*!< \brief Returns a string description of the object. */ | 598 | QString description() const; /*!< \brief Returns a string description of the object. */ |
| 599 | void setProperty(const QString &name, QVariant value); /*!< \brief Overload of QObject::setProperty to handle OpenBR data types. */ | 599 | void setProperty(const QString &name, QVariant value); /*!< \brief Overload of QObject::setProperty to handle OpenBR data types. */ |
| 600 | + virtual bool setPropertyRecursive(const QString &name, QVariant value); /*!< \brief Recursive version of setProperty, try to set the property on this object, or its children, returns true if successful. */ | ||
| 601 | + | ||
| 600 | static QStringList parse(const QString &string, char split = ','); /*!< \brief Splits the string while respecting lexical scoping of <tt>()</tt>, <tt>[]</tt>, <tt>\<\></tt>, and <tt>{}</tt>. */ | 602 | static QStringList parse(const QString &string, char split = ','); /*!< \brief Splits the string while respecting lexical scoping of <tt>()</tt>, <tt>[]</tt>, <tt>\<\></tt>, and <tt>{}</tt>. */ |
| 601 | 603 | ||
| 602 | private: | 604 | private: |
| @@ -1126,13 +1128,13 @@ class TemplateEvent : public QObject | @@ -1126,13 +1128,13 @@ class TemplateEvent : public QObject | ||
| 1126 | Q_OBJECT | 1128 | Q_OBJECT |
| 1127 | 1129 | ||
| 1128 | public: | 1130 | public: |
| 1129 | - void pulseSignal(const Template & output) const | 1131 | + void pulseSignal(const Template &output) const |
| 1130 | { | 1132 | { |
| 1131 | emit theSignal(output); | 1133 | emit theSignal(output); |
| 1132 | } | 1134 | } |
| 1133 | 1135 | ||
| 1134 | signals: | 1136 | signals: |
| 1135 | - void theSignal(const Template & output) const; | 1137 | + void theSignal(const Template &output) const; |
| 1136 | }; | 1138 | }; |
| 1137 | 1139 | ||
| 1138 | /*! | 1140 | /*! |
| @@ -1219,7 +1221,7 @@ public: | @@ -1219,7 +1221,7 @@ public: | ||
| 1219 | * and the transform can emit a final set if templates if it wants. Time-invariant transforms | 1221 | * and the transform can emit a final set if templates if it wants. Time-invariant transforms |
| 1220 | * don't have to do anything. | 1222 | * don't have to do anything. |
| 1221 | */ | 1223 | */ |
| 1222 | - virtual void finalize(TemplateList & output) { output = TemplateList(); } | 1224 | + virtual void finalize(TemplateList &output) { output = TemplateList(); } |
| 1223 | 1225 | ||
| 1224 | /*! | 1226 | /*! |
| 1225 | * \brief Does the transform require the non-const version of project? Can vary for aggregation type transforms | 1227 | * \brief Does the transform require the non-const version of project? Can vary for aggregation type transforms |
| @@ -1256,14 +1258,14 @@ public: | @@ -1256,14 +1258,14 @@ public: | ||
| 1256 | * and copy enough of their state that projectUpdate can safely be called on the original | 1258 | * and copy enough of their state that projectUpdate can safely be called on the original |
| 1257 | * instance, and the copy concurrently. | 1259 | * instance, and the copy concurrently. |
| 1258 | */ | 1260 | */ |
| 1259 | - virtual Transform * smartCopy(bool & newTransform) { newTransform=false; return this;} | 1261 | + virtual Transform *smartCopy(bool &newTransform) { newTransform=false; return this;} |
| 1260 | 1262 | ||
| 1261 | - virtual Transform * smartCopy() {bool junk; return smartCopy(junk);} | 1263 | + virtual Transform *smartCopy() {bool junk; return smartCopy(junk);} |
| 1262 | 1264 | ||
| 1263 | /*! | 1265 | /*! |
| 1264 | * \brief Recursively retrieve a named event, returns NULL if an event is not found. | 1266 | * \brief Recursively retrieve a named event, returns NULL if an event is not found. |
| 1265 | */ | 1267 | */ |
| 1266 | - virtual TemplateEvent * getEvent(const QString & name); | 1268 | + virtual TemplateEvent *getEvent(const QString &name); |
| 1267 | 1269 | ||
| 1268 | /*! | 1270 | /*! |
| 1269 | * \brief Get a list of child transforms of this transform, child transforms are considered to be | 1271 | * \brief Get a list of child transforms of this transform, child transforms are considered to be |
openbr/plugins/draw.cpp
| @@ -163,7 +163,7 @@ class DrawPropertiesPointTransform : public UntrainableTransform | @@ -163,7 +163,7 @@ class DrawPropertiesPointTransform : public UntrainableTransform | ||
| 163 | const Scalar textColor(255, 255, 0); | 163 | const Scalar textColor(255, 255, 0); |
| 164 | 164 | ||
| 165 | std::string outString = ""; | 165 | std::string outString = ""; |
| 166 | - foreach (const QString & propName, propNames) | 166 | + foreach (const QString &propName, propNames) |
| 167 | { | 167 | { |
| 168 | QVariant prop = dst.file.value(propName); | 168 | QVariant prop = dst.file.value(propName); |
| 169 | 169 |
openbr/plugins/gallery.cpp
| @@ -725,7 +725,7 @@ class memGallery : public Gallery | @@ -725,7 +725,7 @@ class memGallery : public Gallery | ||
| 725 | 725 | ||
| 726 | BR_REGISTER(Gallery, memGallery) | 726 | BR_REGISTER(Gallery, memGallery) |
| 727 | 727 | ||
| 728 | -FileList FileList::fromGallery(const File & file, bool cache) | 728 | +FileList FileList::fromGallery(const File &file, bool cache) |
| 729 | { | 729 | { |
| 730 | File targetMeta = file; | 730 | File targetMeta = file; |
| 731 | targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem"; | 731 | targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem"; |
| @@ -1059,7 +1059,7 @@ class xmlGallery : public FileGallery | @@ -1059,7 +1059,7 @@ class xmlGallery : public FileGallery | ||
| 1059 | // a presentation! | 1059 | // a presentation! |
| 1060 | if (signatureToken == QXmlStreamReader::StartElement && reader.name() == "presentation") { | 1060 | if (signatureToken == QXmlStreamReader::StartElement && reader.name() == "presentation") { |
| 1061 | templates.append(Template(File("",currentSignatureName))); | 1061 | templates.append(Template(File("",currentSignatureName))); |
| 1062 | - foreach (const QXmlStreamAttribute & attribute, reader.attributes()) { | 1062 | + foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { |
| 1063 | // file-name is stored directly on file, not as a key/value pair | 1063 | // file-name is stored directly on file, not as a key/value pair |
| 1064 | if (attribute.name() == "file-name") | 1064 | if (attribute.name() == "file-name") |
| 1065 | templates.last().file.name = attribute.value().toString(); | 1065 | templates.last().file.name = attribute.value().toString(); |
openbr/plugins/gui.cpp
| @@ -46,7 +46,7 @@ template<typename T> | @@ -46,7 +46,7 @@ template<typename T> | ||
| 46 | class ActualCreation : public NominalCreation | 46 | class ActualCreation : public NominalCreation |
| 47 | { | 47 | { |
| 48 | public: | 48 | public: |
| 49 | - T * basis; | 49 | + T *basis; |
| 50 | 50 | ||
| 51 | void creation() | 51 | void creation() |
| 52 | { | 52 | { |
| @@ -83,7 +83,7 @@ public: | @@ -83,7 +83,7 @@ public: | ||
| 83 | // the template with the NominalCreation interface, and call worker->creation | 83 | // the template with the NominalCreation interface, and call worker->creation |
| 84 | // in the slot. | 84 | // in the slot. |
| 85 | template<typename T> | 85 | template<typename T> |
| 86 | - T * getItem() | 86 | + T *getItem() |
| 87 | { | 87 | { |
| 88 | // If this is called by the main thread, we can just create the object | 88 | // If this is called by the main thread, we can just create the object |
| 89 | // it's important to check, otherwise we will have problems trying to | 89 | // it's important to check, otherwise we will have problems trying to |
| @@ -103,12 +103,12 @@ public: | @@ -103,12 +103,12 @@ public: | ||
| 103 | emit needCreation(); | 103 | emit needCreation(); |
| 104 | 104 | ||
| 105 | // collect the results, and return. | 105 | // collect the results, and return. |
| 106 | - T * output = actualWorker->basis; | 106 | + T *output = actualWorker->basis; |
| 107 | delete actualWorker; | 107 | delete actualWorker; |
| 108 | return output; | 108 | return output; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | - NominalCreation * worker; | 111 | + NominalCreation *worker; |
| 112 | 112 | ||
| 113 | signals: | 113 | signals: |
| 114 | void needCreation(); | 114 | void needCreation(); |
| @@ -135,7 +135,7 @@ protected: | @@ -135,7 +135,7 @@ protected: | ||
| 135 | 135 | ||
| 136 | public: | 136 | public: |
| 137 | 137 | ||
| 138 | - DisplayWindow(QWidget * parent = NULL) : QLabel(parent) | 138 | + DisplayWindow(QWidget *parent = NULL) : QLabel(parent) |
| 139 | { | 139 | { |
| 140 | setFixedSize(200,200); | 140 | setFixedSize(200,200); |
| 141 | QApplication::instance()->installEventFilter(this); | 141 | QApplication::instance()->installEventFilter(this); |
| @@ -146,7 +146,7 @@ public: | @@ -146,7 +146,7 @@ public: | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | public slots: | 148 | public slots: |
| 149 | - void showImage(const QPixmap & input) | 149 | + void showImage(const QPixmap &input) |
| 150 | { | 150 | { |
| 151 | pixmap = input; | 151 | pixmap = input; |
| 152 | 152 | ||
| @@ -161,7 +161,7 @@ public slots: | @@ -161,7 +161,7 @@ public slots: | ||
| 161 | setFixedSize(temp); | 161 | setFixedSize(temp); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | - bool eventFilter(QObject * obj, QEvent * event) | 164 | + bool eventFilter(QObject *obj, QEvent *event) |
| 165 | { | 165 | { |
| 166 | if (event->type() == QEvent::KeyPress) | 166 | if (event->type() == QEvent::KeyPress) |
| 167 | { | 167 | { |
| @@ -292,7 +292,7 @@ public: | @@ -292,7 +292,7 @@ public: | ||
| 292 | } else { | 292 | } else { |
| 293 | if (event->type() == QEvent::KeyPress) | 293 | if (event->type() == QEvent::KeyPress) |
| 294 | { | 294 | { |
| 295 | - QKeyEvent * kevent = (QKeyEvent *) event; | 295 | + QKeyEvent *kevent = (QKeyEvent *) event; |
| 296 | if (kevent->key() == Qt::Key_Enter || kevent->key() == Qt::Key_Return) { | 296 | if (kevent->key() == Qt::Key_Enter || kevent->key() == Qt::Key_Return) { |
| 297 | event->accept(); | 297 | event->accept(); |
| 298 | return true; | 298 | return true; |
| @@ -315,7 +315,7 @@ public: | @@ -315,7 +315,7 @@ public: | ||
| 315 | return QList<QPointF>(); | 315 | return QList<QPointF>(); |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | - void setKeys(const QStringList & keys) | 318 | + void setKeys(const QStringList &keys) |
| 319 | { | 319 | { |
| 320 | promptKeys = keys; | 320 | promptKeys = keys; |
| 321 | } | 321 | } |
| @@ -370,13 +370,13 @@ private: | @@ -370,13 +370,13 @@ private: | ||
| 370 | 370 | ||
| 371 | class PromptWindow : public DisplayWindow | 371 | class PromptWindow : public DisplayWindow |
| 372 | { | 372 | { |
| 373 | - bool eventFilter(QObject * obj, QEvent * event) | 373 | + bool eventFilter(QObject *obj, QEvent *event) |
| 374 | { | 374 | { |
| 375 | if (event->type() == QEvent::KeyPress) | 375 | if (event->type() == QEvent::KeyPress) |
| 376 | { | 376 | { |
| 377 | event->accept(); | 377 | event->accept(); |
| 378 | 378 | ||
| 379 | - QKeyEvent * key_event = dynamic_cast<QKeyEvent *> (event); | 379 | + QKeyEvent *key_event = dynamic_cast<QKeyEvent *> (event); |
| 380 | if (key_event == NULL) { | 380 | if (key_event == NULL) { |
| 381 | qDebug("failed to donwcast key event"); | 381 | qDebug("failed to donwcast key event"); |
| 382 | return true; | 382 | return true; |
| @@ -419,7 +419,7 @@ class GUIWindow : public QMainWindow | @@ -419,7 +419,7 @@ class GUIWindow : public QMainWindow | ||
| 419 | 419 | ||
| 420 | public: | 420 | public: |
| 421 | 421 | ||
| 422 | - GUIWindow(QWidget * parent = NULL) : QMainWindow(parent) | 422 | + GUIWindow(QWidget *parent = NULL) : QMainWindow(parent) |
| 423 | { | 423 | { |
| 424 | centralWidget = new QWidget(); | 424 | centralWidget = new QWidget(); |
| 425 | layout = new QHBoxLayout(); | 425 | layout = new QHBoxLayout(); |
| @@ -440,7 +440,7 @@ public: | @@ -440,7 +440,7 @@ public: | ||
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | public slots: | 442 | public slots: |
| 443 | - void showImage(const QPixmap & input) | 443 | + void showImage(const QPixmap &input) |
| 444 | { | 444 | { |
| 445 | hide(); | 445 | hide(); |
| 446 | 446 | ||
| @@ -545,11 +545,11 @@ public: | @@ -545,11 +545,11 @@ public: | ||
| 545 | if (src.empty()) | 545 | if (src.empty()) |
| 546 | return; | 546 | return; |
| 547 | 547 | ||
| 548 | - foreach (const Template & t, src) { | 548 | + foreach (const Template &t, src) { |
| 549 | // build label | 549 | // build label |
| 550 | QString newTitle; | 550 | QString newTitle; |
| 551 | 551 | ||
| 552 | - foreach (const QString & s, keys) { | 552 | + foreach (const QString &s, keys) { |
| 553 | if (s.compare("name", Qt::CaseInsensitive) == 0) { | 553 | if (s.compare("name", Qt::CaseInsensitive) == 0) { |
| 554 | newTitle = newTitle + s + ": " + t.file.fileName() + " "; | 554 | newTitle = newTitle + s + ": " + t.file.fileName() + " "; |
| 555 | } else if (t.file.contains(s)) { | 555 | } else if (t.file.contains(s)) { |
| @@ -578,7 +578,7 @@ public: | @@ -578,7 +578,7 @@ public: | ||
| 578 | } | 578 | } |
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | - void finalize(TemplateList & output) | 581 | + void finalize(TemplateList &output) |
| 582 | { | 582 | { |
| 583 | (void) output; | 583 | (void) output; |
| 584 | emit hideWindow(); | 584 | emit hideWindow(); |
| @@ -614,13 +614,13 @@ public: | @@ -614,13 +614,13 @@ public: | ||
| 614 | 614 | ||
| 615 | protected: | 615 | protected: |
| 616 | MainThreadCreator creator; | 616 | MainThreadCreator creator; |
| 617 | - DisplayWindow * window; | 617 | + DisplayWindow *window; |
| 618 | QImage qImageBuffer; | 618 | QImage qImageBuffer; |
| 619 | - QPixmap * displayBuffer; | 619 | + QPixmap *displayBuffer; |
| 620 | 620 | ||
| 621 | signals: | 621 | signals: |
| 622 | - void updateImage(const QPixmap & input); | ||
| 623 | - void changeTitle(const QString & input); | 622 | + void updateImage(const QPixmap &input); |
| 623 | + void changeTitle(const QString &input); | ||
| 624 | void hideWindow(); | 624 | void hideWindow(); |
| 625 | void destroyWindow(); | 625 | void destroyWindow(); |
| 626 | }; | 626 | }; |
| @@ -772,7 +772,7 @@ public: | @@ -772,7 +772,7 @@ public: | ||
| 772 | } | 772 | } |
| 773 | } | 773 | } |
| 774 | } | 774 | } |
| 775 | - RectMarkingWindow * trueWindow; | 775 | + RectMarkingWindow *trueWindow; |
| 776 | void init() | 776 | void init() |
| 777 | { | 777 | { |
| 778 | if (!Globals->useGui) | 778 | if (!Globals->useGui) |
| @@ -812,7 +812,7 @@ public: | @@ -812,7 +812,7 @@ public: | ||
| 812 | 812 | ||
| 813 | void project(const TemplateList &src, TemplateList &dst) const | 813 | void project(const TemplateList &src, TemplateList &dst) const |
| 814 | { | 814 | { |
| 815 | - Transform * non_const = (ElicitTransform *) this; | 815 | + Transform *non_const = (ElicitTransform *) this; |
| 816 | non_const->projectUpdate(src,dst); | 816 | non_const->projectUpdate(src,dst); |
| 817 | } | 817 | } |
| 818 | 818 | ||
| @@ -910,7 +910,7 @@ public: | @@ -910,7 +910,7 @@ public: | ||
| 910 | } | 910 | } |
| 911 | } | 911 | } |
| 912 | } | 912 | } |
| 913 | - PromptWindow * p_window; | 913 | + PromptWindow *p_window; |
| 914 | 914 | ||
| 915 | 915 | ||
| 916 | void init() | 916 | void init() |
| @@ -964,7 +964,7 @@ public: | @@ -964,7 +964,7 @@ public: | ||
| 964 | last_time = timer.elapsed(); | 964 | last_time = timer.elapsed(); |
| 965 | } | 965 | } |
| 966 | 966 | ||
| 967 | - void finalize(TemplateList & output) | 967 | + void finalize(TemplateList &output) |
| 968 | { | 968 | { |
| 969 | (void) output; | 969 | (void) output; |
| 970 | } | 970 | } |
| @@ -1024,7 +1024,7 @@ public: | @@ -1024,7 +1024,7 @@ public: | ||
| 1024 | } | 1024 | } |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | - void finalize(TemplateList & output) | 1027 | + void finalize(TemplateList &output) |
| 1028 | { | 1028 | { |
| 1029 | (void) output; | 1029 | (void) output; |
| 1030 | } | 1030 | } |
openbr/plugins/independent.cpp
| @@ -9,7 +9,7 @@ using namespace cv; | @@ -9,7 +9,7 @@ using namespace cv; | ||
| 9 | namespace br | 9 | namespace br |
| 10 | { | 10 | { |
| 11 | 11 | ||
| 12 | -static TemplateList Downsample(const TemplateList &templates, int classes, int instances, float fraction, const QString & inputVariable, const QStringList &gallery, const QStringList &subjects) | 12 | +static TemplateList Downsample(const TemplateList &templates, int classes, int instances, float fraction, const QString &inputVariable, const QStringList &gallery, const QStringList &subjects) |
| 13 | { | 13 | { |
| 14 | // Return early when no downsampling is required | 14 | // Return early when no downsampling is required |
| 15 | if ((classes == std::numeric_limits<int>::max()) && | 15 | if ((classes == std::numeric_limits<int>::max()) && |
| @@ -29,7 +29,7 @@ static TemplateList Downsample(const TemplateList &templates, int classes, int i | @@ -29,7 +29,7 @@ static TemplateList Downsample(const TemplateList &templates, int classes, int i | ||
| 29 | QMap<QString,int> counts = templates.countValues<QString>(inputVariable, instances != std::numeric_limits<int>::max()); | 29 | QMap<QString,int> counts = templates.countValues<QString>(inputVariable, instances != std::numeric_limits<int>::max()); |
| 30 | 30 | ||
| 31 | if ((instances != std::numeric_limits<int>::max()) && (classes != std::numeric_limits<int>::max())) | 31 | if ((instances != std::numeric_limits<int>::max()) && (classes != std::numeric_limits<int>::max())) |
| 32 | - foreach (const QString & label, counts.keys()) | 32 | + foreach (const QString &label, counts.keys()) |
| 33 | if (counts[label] < instances) | 33 | if (counts[label] < instances) |
| 34 | counts.remove(label); | 34 | counts.remove(label); |
| 35 | 35 | ||
| @@ -94,7 +94,7 @@ class DownsampleTrainingTransform : public Transform | @@ -94,7 +94,7 @@ class DownsampleTrainingTransform : public Transform | ||
| 94 | BR_PROPERTY(QStringList, subjects, QStringList()) | 94 | BR_PROPERTY(QStringList, subjects, QStringList()) |
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | - void project(const Template & src, Template & dst) const | 97 | + void project(const Template &src, Template &dst) const |
| 98 | { | 98 | { |
| 99 | transform->project(src,dst); | 99 | transform->project(src,dst); |
| 100 | } | 100 | } |
| @@ -126,6 +126,21 @@ class IndependentTransform : public MetaTransform | @@ -126,6 +126,21 @@ class IndependentTransform : public MetaTransform | ||
| 126 | 126 | ||
| 127 | QList<Transform*> transforms; | 127 | QList<Transform*> transforms; |
| 128 | 128 | ||
| 129 | + | ||
| 130 | + bool setPropertyRecursive(const QString &name, QVariant value) | ||
| 131 | + { | ||
| 132 | + if (br::Object::setPropertyRecursive(name, value)) | ||
| 133 | + return true; | ||
| 134 | + | ||
| 135 | + if (!transform->setPropertyRecursive(name, value)) | ||
| 136 | + return false; | ||
| 137 | + | ||
| 138 | + for (int i=0;i < transforms.size();i++) | ||
| 139 | + transforms[i]->setPropertyRecursive(name, value); | ||
| 140 | + | ||
| 141 | + return true; | ||
| 142 | + } | ||
| 143 | + | ||
| 129 | void init() | 144 | void init() |
| 130 | { | 145 | { |
| 131 | transforms.clear(); | 146 | transforms.clear(); |
openbr/plugins/meta.cpp
| @@ -149,7 +149,7 @@ class PipeTransform : public CompositeTransform | @@ -149,7 +149,7 @@ class PipeTransform : public CompositeTransform | ||
| 149 | 149 | ||
| 150 | // For time varying transforms, parallel execution over individual templates | 150 | // For time varying transforms, parallel execution over individual templates |
| 151 | // won't work. | 151 | // won't work. |
| 152 | - void projectUpdate(const TemplateList & src, TemplateList & dst) | 152 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 153 | { | 153 | { |
| 154 | dst = src; | 154 | dst = src; |
| 155 | foreach (Transform *f, transforms) | 155 | foreach (Transform *f, transforms) |
| @@ -158,7 +158,7 @@ class PipeTransform : public CompositeTransform | @@ -158,7 +158,7 @@ class PipeTransform : public CompositeTransform | ||
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | - virtual void finalize(TemplateList & output) | 161 | + virtual void finalize(TemplateList &output) |
| 162 | { | 162 | { |
| 163 | output.clear(); | 163 | output.clear(); |
| 164 | // For each transform, | 164 | // For each transform, |
| @@ -185,7 +185,7 @@ class PipeTransform : public CompositeTransform | @@ -185,7 +185,7 @@ class PipeTransform : public CompositeTransform | ||
| 185 | QList<Transform *> flattened; | 185 | QList<Transform *> flattened; |
| 186 | for (int i=0;i < transforms.size(); i++) | 186 | for (int i=0;i < transforms.size(); i++) |
| 187 | { | 187 | { |
| 188 | - PipeTransform * probe = dynamic_cast<PipeTransform *> (transforms[i]); | 188 | + PipeTransform *probe = dynamic_cast<PipeTransform *> (transforms[i]); |
| 189 | if (!probe) { | 189 | if (!probe) { |
| 190 | flattened.append(transforms[i]); | 190 | flattened.append(transforms[i]); |
| 191 | continue; | 191 | continue; |
| @@ -212,7 +212,7 @@ protected: | @@ -212,7 +212,7 @@ protected: | ||
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | // Single template const project, pass the template through each sub-transform, one after the other | 214 | // Single template const project, pass the template through each sub-transform, one after the other |
| 215 | - virtual void _project(const Template & src, Template & dst) const | 215 | + virtual void _project(const Template &src, Template &dst) const |
| 216 | { | 216 | { |
| 217 | dst = src; | 217 | dst = src; |
| 218 | foreach (const Transform *f, transforms) { | 218 | foreach (const Transform *f, transforms) { |
| @@ -247,7 +247,7 @@ class ExpandTransform : public UntrainableMetaTransform | @@ -247,7 +247,7 @@ class ExpandTransform : public UntrainableMetaTransform | ||
| 247 | dst = Expanded(src); | 247 | dst = Expanded(src); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | - virtual void project(const Template & src, Template & dst) const | 250 | + virtual void project(const Template &src, Template &dst) const |
| 251 | { | 251 | { |
| 252 | dst = src; | 252 | dst = src; |
| 253 | qDebug("Called Expand project(Template,Template), nothing will happen"); | 253 | qDebug("Called Expand project(Template,Template), nothing will happen"); |
| @@ -272,11 +272,11 @@ class ContractTransform : public UntrainableMetaTransform | @@ -272,11 +272,11 @@ class ContractTransform : public UntrainableMetaTransform | ||
| 272 | if (src.empty()) return; | 272 | if (src.empty()) return; |
| 273 | Template out; | 273 | Template out; |
| 274 | 274 | ||
| 275 | - foreach (const Template & t, src) { | 275 | + foreach (const Template &t, src) { |
| 276 | out.merge(t); | 276 | out.merge(t); |
| 277 | } | 277 | } |
| 278 | out.file.clearRects(); | 278 | out.file.clearRects(); |
| 279 | - foreach (const Template & t, src) { | 279 | + foreach (const Template &t, src) { |
| 280 | if (!t.file.rects().empty()) | 280 | if (!t.file.rects().empty()) |
| 281 | out.file.appendRects(t.file.rects()); | 281 | out.file.appendRects(t.file.rects()); |
| 282 | } | 282 | } |
| @@ -284,7 +284,7 @@ class ContractTransform : public UntrainableMetaTransform | @@ -284,7 +284,7 @@ class ContractTransform : public UntrainableMetaTransform | ||
| 284 | dst.append(out); | 284 | dst.append(out); |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | - virtual void project(const Template & src, Template & dst) const | 287 | + virtual void project(const Template &src, Template &dst) const |
| 288 | { | 288 | { |
| 289 | qFatal("this has gone bad"); | 289 | qFatal("this has gone bad"); |
| 290 | (void) src; (void) dst; | 290 | (void) src; (void) dst; |
| @@ -316,7 +316,7 @@ class ForkTransform : public CompositeTransform | @@ -316,7 +316,7 @@ class ForkTransform : public CompositeTransform | ||
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | // same as _project, but calls projectUpdate on sub-transforms | 318 | // same as _project, but calls projectUpdate on sub-transforms |
| 319 | - void projectupdate(const Template & src, Template & dst) | 319 | + void projectupdate(const Template &src, Template &dst) |
| 320 | { | 320 | { |
| 321 | foreach (Transform *f, transforms) { | 321 | foreach (Transform *f, transforms) { |
| 322 | try { | 322 | try { |
| @@ -331,7 +331,7 @@ class ForkTransform : public CompositeTransform | @@ -331,7 +331,7 @@ class ForkTransform : public CompositeTransform | ||
| 331 | } | 331 | } |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | - void projectUpdate(const TemplateList & src, TemplateList & dst) | 334 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 335 | { | 335 | { |
| 336 | dst.reserve(src.size()); | 336 | dst.reserve(src.size()); |
| 337 | for (int i=0; i<src.size(); i++) dst.append(Template(src[i].file)); | 337 | for (int i=0; i<src.size(); i++) dst.append(Template(src[i].file)); |
| @@ -345,7 +345,7 @@ class ForkTransform : public CompositeTransform | @@ -345,7 +345,7 @@ class ForkTransform : public CompositeTransform | ||
| 345 | 345 | ||
| 346 | // this is probably going to go bad, fork transform probably won't work well in a variable | 346 | // this is probably going to go bad, fork transform probably won't work well in a variable |
| 347 | // input/output scenario | 347 | // input/output scenario |
| 348 | - virtual void finalize(TemplateList & output) | 348 | + virtual void finalize(TemplateList &output) |
| 349 | { | 349 | { |
| 350 | output.clear(); | 350 | output.clear(); |
| 351 | // For each transform, | 351 | // For each transform, |
| @@ -493,6 +493,12 @@ class LoadStoreTransform : public MetaTransform | @@ -493,6 +493,12 @@ class LoadStoreTransform : public MetaTransform | ||
| 493 | public: | 493 | public: |
| 494 | LoadStoreTransform() : transform(NULL) {} | 494 | LoadStoreTransform() : transform(NULL) {} |
| 495 | 495 | ||
| 496 | + bool setPropertyRecursive(const QString &name, QVariant value) | ||
| 497 | + { | ||
| 498 | + if (br::Object::setPropertyRecursive(name, value)) | ||
| 499 | + return true; | ||
| 500 | + return transform->setPropertyRecursive(name, value); | ||
| 501 | + } | ||
| 496 | private: | 502 | private: |
| 497 | void init() | 503 | void init() |
| 498 | { | 504 | { |
| @@ -543,7 +549,7 @@ private: | @@ -543,7 +549,7 @@ private: | ||
| 543 | transform->projectUpdate(src, dst); | 549 | transform->projectUpdate(src, dst); |
| 544 | } | 550 | } |
| 545 | 551 | ||
| 546 | - void finalize(TemplateList & output) | 552 | + void finalize(TemplateList &output) |
| 547 | { | 553 | { |
| 548 | transform->finalize(output); | 554 | transform->finalize(output); |
| 549 | } | 555 | } |
| @@ -635,7 +641,7 @@ class DistributeTemplateTransform : public MetaTransform | @@ -635,7 +641,7 @@ class DistributeTemplateTransform : public MetaTransform | ||
| 635 | 641 | ||
| 636 | public: | 642 | public: |
| 637 | 643 | ||
| 638 | - Transform * smartCopy(bool & newTransform) | 644 | + Transform *smartCopy(bool &newTransform) |
| 639 | { | 645 | { |
| 640 | if (!transform->timeVarying()) { | 646 | if (!transform->timeVarying()) { |
| 641 | newTransform = false; | 647 | newTransform = false; |
| @@ -643,7 +649,7 @@ public: | @@ -643,7 +649,7 @@ public: | ||
| 643 | } | 649 | } |
| 644 | newTransform = true; | 650 | newTransform = true; |
| 645 | 651 | ||
| 646 | - DistributeTemplateTransform * output = new DistributeTemplateTransform; | 652 | + DistributeTemplateTransform *output = new DistributeTemplateTransform; |
| 647 | bool newChild = false; | 653 | bool newChild = false; |
| 648 | output->transform = transform->smartCopy(newChild); | 654 | output->transform = transform->smartCopy(newChild); |
| 649 | if (newChild) | 655 | if (newChild) |
| @@ -660,8 +666,8 @@ public: | @@ -660,8 +666,8 @@ public: | ||
| 660 | } | 666 | } |
| 661 | 667 | ||
| 662 | QList<TemplateList> separated; | 668 | QList<TemplateList> separated; |
| 663 | - foreach (const TemplateList & list, data) { | ||
| 664 | - foreach(const Template & t, list) { | 669 | + foreach (const TemplateList &list, data) { |
| 670 | + foreach(const Template &t, list) { | ||
| 665 | separated.append(TemplateList()); | 671 | separated.append(TemplateList()); |
| 666 | separated.last().append(t); | 672 | separated.last().append(t); |
| 667 | } | 673 | } |
openbr/plugins/misc.cpp
| @@ -525,7 +525,7 @@ class IncrementalOutputTransform : public TimeVaryingTransform | @@ -525,7 +525,7 @@ class IncrementalOutputTransform : public TimeVaryingTransform | ||
| 525 | 525 | ||
| 526 | dst = src; | 526 | dst = src; |
| 527 | int idx =0; | 527 | int idx =0; |
| 528 | - foreach(const Template & t, src) { | 528 | + foreach(const Template &t, src) { |
| 529 | if (t.empty()) | 529 | if (t.empty()) |
| 530 | continue; | 530 | continue; |
| 531 | 531 | ||
| @@ -546,7 +546,7 @@ class IncrementalOutputTransform : public TimeVaryingTransform | @@ -546,7 +546,7 @@ class IncrementalOutputTransform : public TimeVaryingTransform | ||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | // Drop the current gallery. | 548 | // Drop the current gallery. |
| 549 | - void finalize(TemplateList & data) | 549 | + void finalize(TemplateList &data) |
| 550 | { | 550 | { |
| 551 | (void) data; | 551 | (void) data; |
| 552 | galleryUp = false; | 552 | galleryUp = false; |
| @@ -573,7 +573,7 @@ class EventTransform : public UntrainableMetaTransform | @@ -573,7 +573,7 @@ class EventTransform : public UntrainableMetaTransform | ||
| 573 | event.pulseSignal(dst); | 573 | event.pulseSignal(dst); |
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | - TemplateEvent * getEvent(const QString & name) | 576 | + TemplateEvent *getEvent(const QString &name) |
| 577 | { | 577 | { |
| 578 | return name == eventName ? &event : NULL; | 578 | return name == eventName ? &event : NULL; |
| 579 | } | 579 | } |
| @@ -646,7 +646,7 @@ class ProgressCounterTransform : public TimeVaryingTransform | @@ -646,7 +646,7 @@ class ProgressCounterTransform : public TimeVaryingTransform | ||
| 646 | (void) data; | 646 | (void) data; |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | - void finalize(TemplateList & data) | 649 | + void finalize(TemplateList &data) |
| 650 | { | 650 | { |
| 651 | (void) data; | 651 | (void) data; |
| 652 | float p = br_progress(); | 652 | float p = br_progress(); |
| @@ -692,7 +692,7 @@ class OutputTransform : public TimeVaryingTransform | @@ -692,7 +692,7 @@ class OutputTransform : public TimeVaryingTransform | ||
| 692 | return; | 692 | return; |
| 693 | 693 | ||
| 694 | // we received a template, which is the next row/column in order | 694 | // we received a template, which is the next row/column in order |
| 695 | - foreach(const Template & t, dst) { | 695 | + foreach(const Template &t, dst) { |
| 696 | for (int i=0; i < t.m().cols; i++) | 696 | for (int i=0; i < t.m().cols; i++) |
| 697 | { | 697 | { |
| 698 | output->setRelative(t.m().at<float>(0, i), currentRow, currentCol); | 698 | output->setRelative(t.m().at<float>(0, i), currentRow, currentCol); |
| @@ -819,7 +819,7 @@ class FileExclusionTransform : public UntrainableMetaTransform | @@ -819,7 +819,7 @@ class FileExclusionTransform : public UntrainableMetaTransform | ||
| 819 | 819 | ||
| 820 | void project(const TemplateList &src, TemplateList &dst) const | 820 | void project(const TemplateList &src, TemplateList &dst) const |
| 821 | { | 821 | { |
| 822 | - foreach(const Template & srcTemp, src) | 822 | + foreach(const Template &srcTemp, src) |
| 823 | { | 823 | { |
| 824 | if (!excluded.contains(srcTemp.file)) | 824 | if (!excluded.contains(srcTemp.file)) |
| 825 | dst.append(srcTemp); | 825 | dst.append(srcTemp); |
openbr/plugins/openbr_internal.h
| @@ -48,8 +48,8 @@ protected: | @@ -48,8 +48,8 @@ protected: | ||
| 48 | class TransformCopier : public ResourceMaker<Transform> | 48 | class TransformCopier : public ResourceMaker<Transform> |
| 49 | { | 49 | { |
| 50 | public: | 50 | public: |
| 51 | - Transform * basis; | ||
| 52 | - TransformCopier(Transform * _basis) | 51 | + Transform *basis; |
| 52 | + TransformCopier(Transform *_basis) | ||
| 53 | { | 53 | { |
| 54 | basis = _basis; | 54 | basis = _basis; |
| 55 | } | 55 | } |
| @@ -66,7 +66,7 @@ class TimeInvariantWrapperTransform : public MetaTransform | @@ -66,7 +66,7 @@ class TimeInvariantWrapperTransform : public MetaTransform | ||
| 66 | public: | 66 | public: |
| 67 | Resource<Transform> transformSource; | 67 | Resource<Transform> transformSource; |
| 68 | 68 | ||
| 69 | - TimeInvariantWrapperTransform(Transform * basis) : transformSource(new TransformCopier(basis)) | 69 | + TimeInvariantWrapperTransform(Transform *basis) : transformSource(new TransformCopier(basis)) |
| 70 | { | 70 | { |
| 71 | if (!basis) | 71 | if (!basis) |
| 72 | qFatal("TimeInvariantWrapper created with NULL transform"); | 72 | qFatal("TimeInvariantWrapper created with NULL transform"); |
| @@ -76,14 +76,14 @@ public: | @@ -76,14 +76,14 @@ public: | ||
| 76 | 76 | ||
| 77 | virtual void project(const Template &src, Template &dst) const | 77 | virtual void project(const Template &src, Template &dst) const |
| 78 | { | 78 | { |
| 79 | - Transform * aTransform = transformSource.acquire(); | 79 | + Transform *aTransform = transformSource.acquire(); |
| 80 | aTransform->projectUpdate(src,dst); | 80 | aTransform->projectUpdate(src,dst); |
| 81 | transformSource.release(aTransform); | 81 | transformSource.release(aTransform); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | void project(const TemplateList &src, TemplateList &dst) const | 84 | void project(const TemplateList &src, TemplateList &dst) const |
| 85 | { | 85 | { |
| 86 | - Transform * aTransform = transformSource.acquire(); | 86 | + Transform *aTransform = transformSource.acquire(); |
| 87 | aTransform->projectUpdate(src,dst); | 87 | aTransform->projectUpdate(src,dst); |
| 88 | transformSource.release(aTransform); | 88 | transformSource.release(aTransform); |
| 89 | } | 89 | } |
| @@ -94,7 +94,7 @@ public: | @@ -94,7 +94,7 @@ public: | ||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | private: | 96 | private: |
| 97 | - Transform * baseTransform; | 97 | + Transform *baseTransform; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | /*! | 100 | /*! |
| @@ -120,7 +120,7 @@ public: | @@ -120,7 +120,7 @@ public: | ||
| 120 | 120 | ||
| 121 | // Get a compile failure if this isn't here to go along with the other | 121 | // Get a compile failure if this isn't here to go along with the other |
| 122 | // projectUpdate, no idea why | 122 | // projectUpdate, no idea why |
| 123 | - virtual void projectUpdate(const Template & src, Template & dst) | 123 | + virtual void projectUpdate(const Template &src, Template &dst) |
| 124 | { | 124 | { |
| 125 | (void) src; (void) dst; | 125 | (void) src; (void) dst; |
| 126 | qFatal("do something useful"); | 126 | qFatal("do something useful"); |
| @@ -128,7 +128,7 @@ public: | @@ -128,7 +128,7 @@ public: | ||
| 128 | 128 | ||
| 129 | virtual void projectUpdate(const TemplateList &src, TemplateList &dst) | 129 | virtual void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 130 | { | 130 | { |
| 131 | - foreach (const Template & src_part, src) { | 131 | + foreach (const Template &src_part, src) { |
| 132 | Template out; | 132 | Template out; |
| 133 | projectUpdate(src_part, out); | 133 | projectUpdate(src_part, out); |
| 134 | dst.append(out); | 134 | dst.append(out); |
| @@ -139,7 +139,7 @@ public: | @@ -139,7 +139,7 @@ public: | ||
| 139 | *\brief For transforms that don't do any training, this default implementation | 139 | *\brief For transforms that don't do any training, this default implementation |
| 140 | * which creates a new copy of the Transform from its description string is sufficient. | 140 | * which creates a new copy of the Transform from its description string is sufficient. |
| 141 | */ | 141 | */ |
| 142 | - virtual Transform * smartCopy(bool & newTransform) | 142 | + virtual Transform *smartCopy(bool &newTransform) |
| 143 | { | 143 | { |
| 144 | newTransform = true; | 144 | newTransform = true; |
| 145 | return this->clone(); | 145 | return this->clone(); |
| @@ -180,17 +180,17 @@ public: | @@ -180,17 +180,17 @@ public: | ||
| 180 | { | 180 | { |
| 181 | transform->projectUpdate(src,dst); | 181 | transform->projectUpdate(src,dst); |
| 182 | } | 182 | } |
| 183 | - void projectUpdate(const TemplateList & src, TemplateList & dst) | 183 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 184 | { | 184 | { |
| 185 | transform->projectUpdate(src,dst); | 185 | transform->projectUpdate(src,dst); |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | - void train(const QList<TemplateList> & data) | 188 | + void train(const QList<TemplateList> &data) |
| 189 | { | 189 | { |
| 190 | transform->train(data); | 190 | transform->train(data); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | - virtual void finalize(TemplateList & output) | 193 | + virtual void finalize(TemplateList &output) |
| 194 | { | 194 | { |
| 195 | transform->finalize(output); | 195 | transform->finalize(output); |
| 196 | } | 196 | } |
| @@ -201,6 +201,17 @@ public: | @@ -201,6 +201,17 @@ public: | ||
| 201 | this->trainable = transform->trainable; | 201 | this->trainable = transform->trainable; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | + bool setPropertyRecursive(const QString &name, QVariant value) | ||
| 205 | + { | ||
| 206 | + if (br::Object::setPropertyRecursive(name, value)) | ||
| 207 | + return true; | ||
| 208 | + | ||
| 209 | + if (transform->setPropertyRecursive(name, value)) { | ||
| 210 | + init(); | ||
| 211 | + return true; | ||
| 212 | + } | ||
| 213 | + return false; | ||
| 214 | + } | ||
| 204 | }; | 215 | }; |
| 205 | 216 | ||
| 206 | /*! | 217 | /*! |
| @@ -251,7 +262,7 @@ public: | @@ -251,7 +262,7 @@ public: | ||
| 251 | * it creates a new copy of its own class, and gives that copy the child transforms | 262 | * it creates a new copy of its own class, and gives that copy the child transforms |
| 252 | * returned by calling smartCopy on this transforms children | 263 | * returned by calling smartCopy on this transforms children |
| 253 | */ | 264 | */ |
| 254 | - Transform * smartCopy(bool & newTransform) | 265 | + Transform *smartCopy(bool &newTransform) |
| 255 | { | 266 | { |
| 256 | if (!timeVarying()) { | 267 | if (!timeVarying()) { |
| 257 | newTransform = false; | 268 | newTransform = false; |
| @@ -273,7 +284,7 @@ public: | @@ -273,7 +284,7 @@ public: | ||
| 273 | name += ")"; | 284 | name += ")"; |
| 274 | name.replace("br::",""); | 285 | name.replace("br::",""); |
| 275 | 286 | ||
| 276 | - CompositeTransform * output = dynamic_cast<CompositeTransform *>(Transform::make(name, NULL)); | 287 | + CompositeTransform *output = dynamic_cast<CompositeTransform *>(Transform::make(name, NULL)); |
| 277 | 288 | ||
| 278 | if (output == NULL) | 289 | if (output == NULL) |
| 279 | qFatal("Dynamic cast failed!"); | 290 | qFatal("Dynamic cast failed!"); |
| @@ -281,7 +292,7 @@ public: | @@ -281,7 +292,7 @@ public: | ||
| 281 | foreach(Transform* t, transforms ) | 292 | foreach(Transform* t, transforms ) |
| 282 | { | 293 | { |
| 283 | bool newItem = false; | 294 | bool newItem = false; |
| 284 | - Transform * maybe_copy = t->smartCopy(newItem); | 295 | + Transform *maybe_copy = t->smartCopy(newItem); |
| 285 | if (newItem) | 296 | if (newItem) |
| 286 | maybe_copy->setParent(output); | 297 | maybe_copy->setParent(output); |
| 287 | output->transforms.append(maybe_copy); | 298 | output->transforms.append(maybe_copy); |
| @@ -293,11 +304,26 @@ public: | @@ -293,11 +304,26 @@ public: | ||
| 293 | return output; | 304 | return output; |
| 294 | } | 305 | } |
| 295 | 306 | ||
| 307 | + bool setPropertyRecursive(const QString &name, QVariant value) | ||
| 308 | + { | ||
| 309 | + if (br::Object::setPropertyRecursive(name, value)) | ||
| 310 | + return true; | ||
| 311 | + | ||
| 312 | + for (int i=0; i < this->transforms.size();i++) { | ||
| 313 | + if (transforms[i]->setPropertyRecursive(name, value)) { | ||
| 314 | + init(); | ||
| 315 | + return true; | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + return false; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + | ||
| 296 | protected: | 322 | protected: |
| 297 | bool isTimeVarying; | 323 | bool isTimeVarying; |
| 298 | 324 | ||
| 299 | - virtual void _project(const Template & src, Template & dst) const = 0; | ||
| 300 | - virtual void _project(const TemplateList & src, TemplateList & dst) const = 0; | 325 | + virtual void _project(const Template &src, Template &dst) const = 0; |
| 326 | + virtual void _project(const TemplateList &src, TemplateList &dst) const = 0; | ||
| 301 | 327 | ||
| 302 | CompositeTransform() : TimeVaryingTransform(false) {} | 328 | CompositeTransform() : TimeVaryingTransform(false) {} |
| 303 | }; | 329 | }; |
| @@ -309,7 +335,7 @@ struct WorkerProcess | @@ -309,7 +335,7 @@ struct WorkerProcess | ||
| 309 | { | 335 | { |
| 310 | QString transform; | 336 | QString transform; |
| 311 | QString baseName; | 337 | QString baseName; |
| 312 | - EnrollmentWorker * processInterface; | 338 | + EnrollmentWorker *processInterface; |
| 313 | 339 | ||
| 314 | void mainLoop(); | 340 | void mainLoop(); |
| 315 | }; | 341 | }; |
| @@ -324,7 +350,7 @@ public: | @@ -324,7 +350,7 @@ public: | ||
| 324 | 350 | ||
| 325 | virtual void projectMetadata(const File &src, File &dst) const = 0; | 351 | virtual void projectMetadata(const File &src, File &dst) const = 0; |
| 326 | 352 | ||
| 327 | - void project(const Template & src, Template & dst) const | 353 | + void project(const Template &src, Template &dst) const |
| 328 | { | 354 | { |
| 329 | dst = src; | 355 | dst = src; |
| 330 | projectMetadata(src.file, dst.file); | 356 | projectMetadata(src.file, dst.file); |
openbr/plugins/pp5.cpp
| @@ -220,7 +220,7 @@ class PP5EnrollTransform : public UntrainableMetaTransform | @@ -220,7 +220,7 @@ class PP5EnrollTransform : public UntrainableMetaTransform | ||
| 220 | BR_PROPERTY(bool, detectOnly, false) | 220 | BR_PROPERTY(bool, detectOnly, false) |
| 221 | Resource<PP5Context> contexts; | 221 | Resource<PP5Context> contexts; |
| 222 | 222 | ||
| 223 | - void project(const Template & src, Template & dst) const | 223 | + void project(const Template &src, Template &dst) const |
| 224 | { | 224 | { |
| 225 | if (Globals->enrollAll) | 225 | if (Globals->enrollAll) |
| 226 | qFatal("single template project doesn't support enrollAll"); | 226 | qFatal("single template project doesn't support enrollAll"); |
| @@ -232,7 +232,7 @@ class PP5EnrollTransform : public UntrainableMetaTransform | @@ -232,7 +232,7 @@ class PP5EnrollTransform : public UntrainableMetaTransform | ||
| 232 | dst = dstList.first(); | 232 | dst = dstList.first(); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | - void project(const TemplateList &srcList, TemplateList & dstList) const | 235 | + void project(const TemplateList &srcList, TemplateList &dstList) const |
| 236 | { | 236 | { |
| 237 | // Nothing to do here | 237 | // Nothing to do here |
| 238 | if (srcList.empty()) | 238 | if (srcList.empty()) |
openbr/plugins/slidingwindow.cpp
| @@ -428,9 +428,9 @@ private: | @@ -428,9 +428,9 @@ private: | ||
| 428 | // each input dimension. Each input dimension corresponds to | 428 | // each input dimension. Each input dimension corresponds to |
| 429 | // one of the input rect region. Thus, each eigenvector represents | 429 | // one of the input rect region. Thus, each eigenvector represents |
| 430 | // a set of overlaping regions. | 430 | // a set of overlaping regions. |
| 431 | - float * midX = new float[nRegions]; | ||
| 432 | - float * midY = new float[nRegions]; | ||
| 433 | - float * avgWidth = new float[nRegions]; | 431 | + float *midX = new float[nRegions]; |
| 432 | + float *midY = new float[nRegions]; | ||
| 433 | + float *avgWidth = new float[nRegions]; | ||
| 434 | float *avgHeight = new float[nRegions]; | 434 | float *avgHeight = new float[nRegions]; |
| 435 | float *confs = new float[nRegions]; | 435 | float *confs = new float[nRegions]; |
| 436 | int *cnts = new int[nRegions]; | 436 | int *cnts = new int[nRegions]; |
openbr/plugins/stream.cpp
| @@ -45,10 +45,10 @@ public: | @@ -45,10 +45,10 @@ public: | ||
| 45 | SharedBuffer() {} | 45 | SharedBuffer() {} |
| 46 | virtual ~SharedBuffer() {} | 46 | virtual ~SharedBuffer() {} |
| 47 | 47 | ||
| 48 | - virtual void addItem(FrameData * input)=0; | 48 | + virtual void addItem(FrameData *input)=0; |
| 49 | virtual void reset()=0; | 49 | virtual void reset()=0; |
| 50 | 50 | ||
| 51 | - virtual FrameData * tryGetItem()=0; | 51 | + virtual FrameData *tryGetItem()=0; |
| 52 | virtual int size()=0; | 52 | virtual int size()=0; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| @@ -63,14 +63,14 @@ public: | @@ -63,14 +63,14 @@ public: | ||
| 63 | next_target = 0; | 63 | next_target = 0; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | - void addItem(FrameData * input) | 66 | + void addItem(FrameData *input) |
| 67 | { | 67 | { |
| 68 | QMutexLocker bufferLock(&bufferGuard); | 68 | QMutexLocker bufferLock(&bufferGuard); |
| 69 | 69 | ||
| 70 | buffer.insert(input->sequenceNumber, input); | 70 | buffer.insert(input->sequenceNumber, input); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | - FrameData * tryGetItem() | 73 | + FrameData *tryGetItem() |
| 74 | { | 74 | { |
| 75 | QMutexLocker bufferLock(&bufferGuard); | 75 | QMutexLocker bufferLock(&bufferGuard); |
| 76 | 76 | ||
| @@ -86,7 +86,7 @@ public: | @@ -86,7 +86,7 @@ public: | ||
| 86 | 86 | ||
| 87 | next_target = next_target + 1; | 87 | next_target = next_target + 1; |
| 88 | 88 | ||
| 89 | - FrameData * output = result.value(); | 89 | + FrameData *output = result.value(); |
| 90 | buffer.erase(result); | 90 | buffer.erase(result); |
| 91 | return output; | 91 | return output; |
| 92 | } | 92 | } |
| @@ -134,19 +134,19 @@ public: | @@ -134,19 +134,19 @@ public: | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | // called from the producer thread | 136 | // called from the producer thread |
| 137 | - void addItem(FrameData * input) | 137 | + void addItem(FrameData *input) |
| 138 | { | 138 | { |
| 139 | QReadLocker readLock(&bufferGuard); | 139 | QReadLocker readLock(&bufferGuard); |
| 140 | inputBuffer->append(input); | 140 | inputBuffer->append(input); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | - FrameData * tryGetItem() | 143 | + FrameData *tryGetItem() |
| 144 | { | 144 | { |
| 145 | QReadLocker readLock(&bufferGuard); | 145 | QReadLocker readLock(&bufferGuard); |
| 146 | 146 | ||
| 147 | // There is something for us to get | 147 | // There is something for us to get |
| 148 | if (!outputBuffer->empty()) { | 148 | if (!outputBuffer->empty()) { |
| 149 | - FrameData * output = outputBuffer->first(); | 149 | + FrameData *output = outputBuffer->first(); |
| 150 | outputBuffer->removeFirst(); | 150 | outputBuffer->removeFirst(); |
| 151 | return output; | 151 | return output; |
| 152 | } | 152 | } |
| @@ -165,7 +165,7 @@ public: | @@ -165,7 +165,7 @@ public: | ||
| 165 | std::swap(inputBuffer, outputBuffer); | 165 | std::swap(inputBuffer, outputBuffer); |
| 166 | 166 | ||
| 167 | // Return a frame | 167 | // Return a frame |
| 168 | - FrameData * output = outputBuffer->first(); | 168 | + FrameData *output = outputBuffer->first(); |
| 169 | outputBuffer->removeFirst(); | 169 | outputBuffer->removeFirst(); |
| 170 | return output; | 170 | return output; |
| 171 | } | 171 | } |
| @@ -201,10 +201,10 @@ class TemplateProcessor | @@ -201,10 +201,10 @@ class TemplateProcessor | ||
| 201 | { | 201 | { |
| 202 | public: | 202 | public: |
| 203 | virtual ~TemplateProcessor() {} | 203 | virtual ~TemplateProcessor() {} |
| 204 | - virtual bool open(Template & input)=0; | 204 | + virtual bool open(Template &input)=0; |
| 205 | virtual bool isOpen()=0; | 205 | virtual bool isOpen()=0; |
| 206 | virtual void close()=0; | 206 | virtual void close()=0; |
| 207 | - virtual bool getNextTemplate(Template & output)=0; | 207 | + virtual bool getNextTemplate(Template &output)=0; |
| 208 | protected: | 208 | protected: |
| 209 | Template basis; | 209 | Template basis; |
| 210 | string getAbsolutePath(QString filename) | 210 | string getAbsolutePath(QString filename) |
| @@ -259,7 +259,7 @@ public: | @@ -259,7 +259,7 @@ public: | ||
| 259 | 259 | ||
| 260 | void close() { video.release(); } | 260 | void close() { video.release(); } |
| 261 | 261 | ||
| 262 | - bool getNextTemplate(Template & output) | 262 | + bool getNextTemplate(Template &output) |
| 263 | { | 263 | { |
| 264 | if (!isOpen()) { | 264 | if (!isOpen()) { |
| 265 | qDebug("video source is not open"); | 265 | qDebug("video source is not open"); |
| @@ -320,7 +320,7 @@ struct StreamGallery : public TemplateProcessor | @@ -320,7 +320,7 @@ struct StreamGallery : public TemplateProcessor | ||
| 320 | lastBlock = true; | 320 | lastBlock = true; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | - bool getNextTemplate(Template & output) | 323 | + bool getNextTemplate(Template &output) |
| 324 | { | 324 | { |
| 325 | // If we still have data available, we return one of those | 325 | // If we still have data available, we return one of those |
| 326 | if ((nextIdx >= currentData.size()) && !lastBlock) { | 326 | if ((nextIdx >= currentData.size()) && !lastBlock) { |
| @@ -373,7 +373,7 @@ public: | @@ -373,7 +373,7 @@ public: | ||
| 373 | basis.clear(); | 373 | basis.clear(); |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | - bool getNextTemplate(Template & output) | 376 | + bool getNextTemplate(Template &output) |
| 377 | { | 377 | { |
| 378 | if (!data_ok) | 378 | if (!data_ok) |
| 379 | return false; | 379 | return false; |
| @@ -563,7 +563,7 @@ private: | @@ -563,7 +563,7 @@ private: | ||
| 563 | // apparently the text in seq files is 16 bit characters (UTF-16?) | 563 | // apparently the text in seq files is 16 bit characters (UTF-16?) |
| 564 | // since we don't really need the last byte, snad since it gets interpreted as | 564 | // since we don't really need the last byte, snad since it gets interpreted as |
| 565 | // a terminating char, let's just grab the first byte for storage | 565 | // a terminating char, let's just grab the first byte for storage |
| 566 | - void readText(int bytes, char * buffer) | 566 | + void readText(int bytes, char *buffer) |
| 567 | { | 567 | { |
| 568 | seqFile.read(buffer, bytes); | 568 | seqFile.read(buffer, bytes); |
| 569 | for (int i=0; i<bytes; i+=2) { | 569 | for (int i=0; i<bytes; i+=2) { |
| @@ -601,7 +601,7 @@ public: | @@ -601,7 +601,7 @@ public: | ||
| 601 | { | 601 | { |
| 602 | while (true) | 602 | while (true) |
| 603 | { | 603 | { |
| 604 | - FrameData * frame = allFrames.tryGetItem(); | 604 | + FrameData *frame = allFrames.tryGetItem(); |
| 605 | if (frame == NULL) | 605 | if (frame == NULL) |
| 606 | break; | 606 | break; |
| 607 | delete frame; | 607 | delete frame; |
| @@ -623,7 +623,7 @@ public: | @@ -623,7 +623,7 @@ public: | ||
| 623 | return this->templates.size(); | 623 | return this->templates.size(); |
| 624 | } | 624 | } |
| 625 | 625 | ||
| 626 | - bool open(const TemplateList & input, br::Idiocy::StreamModes _mode) | 626 | + bool open(const TemplateList &input, br::Idiocy::StreamModes _mode) |
| 627 | { | 627 | { |
| 628 | // Set up variables specific to us | 628 | // Set up variables specific to us |
| 629 | current_template_idx = 0; | 629 | current_template_idx = 0; |
| @@ -655,7 +655,7 @@ public: | @@ -655,7 +655,7 @@ public: | ||
| 655 | // Returns a NULL FrameData if too many frames are out, or the | 655 | // Returns a NULL FrameData if too many frames are out, or the |
| 656 | // data source is broken. Sets last_frame to true iff the FrameData | 656 | // data source is broken. Sets last_frame to true iff the FrameData |
| 657 | // returned is the last valid frame, and the data source is now broken. | 657 | // returned is the last valid frame, and the data source is now broken. |
| 658 | - FrameData * tryGetFrame(bool & last_frame) | 658 | + FrameData *tryGetFrame(bool &last_frame) |
| 659 | { | 659 | { |
| 660 | last_frame = false; | 660 | last_frame = false; |
| 661 | 661 | ||
| @@ -665,7 +665,7 @@ public: | @@ -665,7 +665,7 @@ public: | ||
| 665 | 665 | ||
| 666 | // Try to get a FrameData from the pool, if we can't it means too many | 666 | // Try to get a FrameData from the pool, if we can't it means too many |
| 667 | // frames are already out, and we will return NULL to indicate failure | 667 | // frames are already out, and we will return NULL to indicate failure |
| 668 | - FrameData * aFrame = allFrames.tryGetItem(); | 668 | + FrameData *aFrame = allFrames.tryGetItem(); |
| 669 | if (aFrame == NULL) | 669 | if (aFrame == NULL) |
| 670 | return NULL; | 670 | return NULL; |
| 671 | 671 | ||
| @@ -691,7 +691,7 @@ public: | @@ -691,7 +691,7 @@ public: | ||
| 691 | 691 | ||
| 692 | // Return a frame to the pool, returns true if the frame returned was the last | 692 | // Return a frame to the pool, returns true if the frame returned was the last |
| 693 | // frame issued, false otherwise | 693 | // frame issued, false otherwise |
| 694 | - bool returnFrame(FrameData * inputFrame) | 694 | + bool returnFrame(FrameData *inputFrame) |
| 695 | { | 695 | { |
| 696 | int frameNumber = inputFrame->sequenceNumber; | 696 | int frameNumber = inputFrame->sequenceNumber; |
| 697 | 697 | ||
| @@ -786,7 +786,7 @@ protected: | @@ -786,7 +786,7 @@ protected: | ||
| 786 | return true; | 786 | return true; |
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | - bool getNextFrame(FrameData & output) | 789 | + bool getNextFrame(FrameData &output) |
| 790 | { | 790 | { |
| 791 | bool got_frame = false; | 791 | bool got_frame = false; |
| 792 | 792 | ||
| @@ -832,7 +832,7 @@ protected: | @@ -832,7 +832,7 @@ protected: | ||
| 832 | TemplateList templates; | 832 | TemplateList templates; |
| 833 | 833 | ||
| 834 | // processor for the current template | 834 | // processor for the current template |
| 835 | - TemplateProcessor * frameSource; | 835 | + TemplateProcessor *frameSource; |
| 836 | 836 | ||
| 837 | int next_sequence_number; | 837 | int next_sequence_number; |
| 838 | int final_frame; | 838 | int final_frame; |
| @@ -859,7 +859,7 @@ public: | @@ -859,7 +859,7 @@ public: | ||
| 859 | 859 | ||
| 860 | QList<ProcessingStage *> * stages; | 860 | QList<ProcessingStage *> * stages; |
| 861 | int start_idx; | 861 | int start_idx; |
| 862 | - FrameData * startItem; | 862 | + FrameData *startItem; |
| 863 | }; | 863 | }; |
| 864 | 864 | ||
| 865 | class ProcessingStage | 865 | class ProcessingStage |
| @@ -873,9 +873,9 @@ public: | @@ -873,9 +873,9 @@ public: | ||
| 873 | } | 873 | } |
| 874 | virtual ~ProcessingStage() {} | 874 | virtual ~ProcessingStage() {} |
| 875 | 875 | ||
| 876 | - virtual FrameData* run(FrameData * input, bool & should_continue, bool & final)=0; | 876 | + virtual FrameData* run(FrameData *input, bool &should_continue, bool &final)=0; |
| 877 | 877 | ||
| 878 | - virtual bool tryAcquireNextStage(FrameData *& input, bool & final)=0; | 878 | + virtual bool tryAcquireNextStage(FrameData *& input, bool &final)=0; |
| 879 | 879 | ||
| 880 | int stage_id; | 880 | int stage_id; |
| 881 | 881 | ||
| @@ -886,11 +886,11 @@ public: | @@ -886,11 +886,11 @@ public: | ||
| 886 | protected: | 886 | protected: |
| 887 | int thread_count; | 887 | int thread_count; |
| 888 | 888 | ||
| 889 | - SharedBuffer * inputBuffer; | ||
| 890 | - ProcessingStage * nextStage; | 889 | + SharedBuffer *inputBuffer; |
| 890 | + ProcessingStage *nextStage; | ||
| 891 | QList<ProcessingStage *> * stages; | 891 | QList<ProcessingStage *> * stages; |
| 892 | - QThreadPool * threads; | ||
| 893 | - Transform * transform; | 892 | + QThreadPool *threads; |
| 893 | + Transform *transform; | ||
| 894 | 894 | ||
| 895 | }; | 895 | }; |
| 896 | 896 | ||
| @@ -901,7 +901,7 @@ public: | @@ -901,7 +901,7 @@ public: | ||
| 901 | 901 | ||
| 902 | // Not much to worry about here, we will project the input | 902 | // Not much to worry about here, we will project the input |
| 903 | // and try to continue to the next stage. | 903 | // and try to continue to the next stage. |
| 904 | - FrameData * run(FrameData * input, bool & should_continue, bool & final) | 904 | + FrameData *run(FrameData *input, bool &should_continue, bool &final) |
| 905 | { | 905 | { |
| 906 | if (input == NULL) { | 906 | if (input == NULL) { |
| 907 | qFatal("null input to multi-thread stage"); | 907 | qFatal("null input to multi-thread stage"); |
| @@ -916,7 +916,7 @@ public: | @@ -916,7 +916,7 @@ public: | ||
| 916 | 916 | ||
| 917 | // Called from a different thread than run. Nothing to worry about | 917 | // Called from a different thread than run. Nothing to worry about |
| 918 | // we offer no restrictions on when loops may enter this stage. | 918 | // we offer no restrictions on when loops may enter this stage. |
| 919 | - virtual bool tryAcquireNextStage(FrameData *& input, bool & final) | 919 | + virtual bool tryAcquireNextStage(FrameData *& input, bool &final) |
| 920 | { | 920 | { |
| 921 | (void) input; | 921 | (void) input; |
| 922 | final = false; | 922 | final = false; |
| @@ -974,7 +974,7 @@ public: | @@ -974,7 +974,7 @@ public: | ||
| 974 | QReadWriteLock statusLock; | 974 | QReadWriteLock statusLock; |
| 975 | Status currentStatus; | 975 | Status currentStatus; |
| 976 | 976 | ||
| 977 | - FrameData * run(FrameData * input, bool & should_continue, bool & final) | 977 | + FrameData *run(FrameData *input, bool &should_continue, bool &final) |
| 978 | { | 978 | { |
| 979 | if (input == NULL) | 979 | if (input == NULL) |
| 980 | qFatal("NULL input to stage %d", this->stage_id); | 980 | qFatal("NULL input to stage %d", this->stage_id); |
| @@ -995,7 +995,7 @@ public: | @@ -995,7 +995,7 @@ public: | ||
| 995 | 995 | ||
| 996 | // Is there anything on our input buffer? If so we should start a thread with that. | 996 | // Is there anything on our input buffer? If so we should start a thread with that. |
| 997 | QWriteLocker lock(&statusLock); | 997 | QWriteLocker lock(&statusLock); |
| 998 | - FrameData * newItem = inputBuffer->tryGetItem(); | 998 | + FrameData *newItem = inputBuffer->tryGetItem(); |
| 999 | if (!newItem) | 999 | if (!newItem) |
| 1000 | { | 1000 | { |
| 1001 | this->currentStatus = STOPPING; | 1001 | this->currentStatus = STOPPING; |
| @@ -1008,9 +1008,9 @@ public: | @@ -1008,9 +1008,9 @@ public: | ||
| 1008 | return input; | 1008 | return input; |
| 1009 | } | 1009 | } |
| 1010 | 1010 | ||
| 1011 | - void startThread(br::FrameData * newItem) | 1011 | + void startThread(br::FrameData *newItem) |
| 1012 | { | 1012 | { |
| 1013 | - BasicLoop * next = new BasicLoop(); | 1013 | + BasicLoop *next = new BasicLoop(); |
| 1014 | next->stages = stages; | 1014 | next->stages = stages; |
| 1015 | next->start_idx = this->stage_id; | 1015 | next->start_idx = this->stage_id; |
| 1016 | next->startItem = newItem; | 1016 | next->startItem = newItem; |
| @@ -1025,7 +1025,7 @@ public: | @@ -1025,7 +1025,7 @@ public: | ||
| 1025 | 1025 | ||
| 1026 | 1026 | ||
| 1027 | // Calledfrom a different thread than run. | 1027 | // Calledfrom a different thread than run. |
| 1028 | - bool tryAcquireNextStage(FrameData *& input, bool & final) | 1028 | + bool tryAcquireNextStage(FrameData *& input, bool &final) |
| 1029 | { | 1029 | { |
| 1030 | final = false; | 1030 | final = false; |
| 1031 | inputBuffer->addItem(input); | 1031 | inputBuffer->addItem(input); |
| @@ -1078,7 +1078,7 @@ public: | @@ -1078,7 +1078,7 @@ public: | ||
| 1078 | sets.append(src); | 1078 | sets.append(src); |
| 1079 | } | 1079 | } |
| 1080 | 1080 | ||
| 1081 | - void train(const TemplateList & data) | 1081 | + void train(const TemplateList &data) |
| 1082 | { | 1082 | { |
| 1083 | (void) data; | 1083 | (void) data; |
| 1084 | } | 1084 | } |
| @@ -1099,7 +1099,7 @@ public: | @@ -1099,7 +1099,7 @@ public: | ||
| 1099 | SingleThreadStage::reset(); | 1099 | SingleThreadStage::reset(); |
| 1100 | } | 1100 | } |
| 1101 | 1101 | ||
| 1102 | - FrameData * run(FrameData * input, bool & should_continue, bool & final) | 1102 | + FrameData *run(FrameData *input, bool &should_continue, bool &final) |
| 1103 | { | 1103 | { |
| 1104 | if (input == NULL) | 1104 | if (input == NULL) |
| 1105 | qFatal("NULL frame in input stage"); | 1105 | qFatal("NULL frame in input stage"); |
| @@ -1112,7 +1112,7 @@ public: | @@ -1112,7 +1112,7 @@ public: | ||
| 1112 | // frame if a frame is currently available. | 1112 | // frame if a frame is currently available. |
| 1113 | QWriteLocker lock(&statusLock); | 1113 | QWriteLocker lock(&statusLock); |
| 1114 | bool last_frame = false; | 1114 | bool last_frame = false; |
| 1115 | - FrameData * newFrame = dataSource.tryGetFrame(last_frame); | 1115 | + FrameData *newFrame = dataSource.tryGetFrame(last_frame); |
| 1116 | 1116 | ||
| 1117 | // Were we able to get a frame? | 1117 | // Were we able to get a frame? |
| 1118 | if (newFrame) startThread(newFrame); | 1118 | if (newFrame) startThread(newFrame); |
| @@ -1127,7 +1127,7 @@ public: | @@ -1127,7 +1127,7 @@ public: | ||
| 1127 | } | 1127 | } |
| 1128 | 1128 | ||
| 1129 | // The last stage, trying to access the first stage | 1129 | // The last stage, trying to access the first stage |
| 1130 | - bool tryAcquireNextStage(FrameData *& input, bool & final) | 1130 | + bool tryAcquireNextStage(FrameData *& input, bool &final) |
| 1131 | { | 1131 | { |
| 1132 | // Return the frame, was it the last one? | 1132 | // Return the frame, was it the last one? |
| 1133 | final = dataSource.returnFrame(input); | 1133 | final = dataSource.returnFrame(input); |
| @@ -1180,7 +1180,7 @@ public: | @@ -1180,7 +1180,7 @@ public: | ||
| 1180 | void BasicLoop::run() | 1180 | void BasicLoop::run() |
| 1181 | { | 1181 | { |
| 1182 | int current_idx = start_idx; | 1182 | int current_idx = start_idx; |
| 1183 | - FrameData * target_item = startItem; | 1183 | + FrameData *target_item = startItem; |
| 1184 | bool should_continue = true; | 1184 | bool should_continue = true; |
| 1185 | bool the_end = false; | 1185 | bool the_end = false; |
| 1186 | forever | 1186 | forever |
| @@ -1212,7 +1212,7 @@ public: | @@ -1212,7 +1212,7 @@ public: | ||
| 1212 | 1212 | ||
| 1213 | friend class StreamTransfrom; | 1213 | friend class StreamTransfrom; |
| 1214 | 1214 | ||
| 1215 | - void subProject(QList<TemplateList> & data, int end_idx) | 1215 | + void subProject(QList<TemplateList> &data, int end_idx) |
| 1216 | { | 1216 | { |
| 1217 | if (end_idx == 0) | 1217 | if (end_idx == 0) |
| 1218 | return; | 1218 | return; |
| @@ -1239,15 +1239,15 @@ public: | @@ -1239,15 +1239,15 @@ public: | ||
| 1239 | transforms = backup; | 1239 | transforms = backup; |
| 1240 | } | 1240 | } |
| 1241 | 1241 | ||
| 1242 | - void train(const QList<TemplateList> & data) | 1242 | + void train(const QList<TemplateList> &data) |
| 1243 | { | 1243 | { |
| 1244 | if (!trainable) { | 1244 | if (!trainable) { |
| 1245 | qWarning("Attempted to train untrainable transform, nothing will happen."); | 1245 | qWarning("Attempted to train untrainable transform, nothing will happen."); |
| 1246 | return; | 1246 | return; |
| 1247 | } | 1247 | } |
| 1248 | QList<TemplateList> separated; | 1248 | QList<TemplateList> separated; |
| 1249 | - foreach (const TemplateList & list, data) { | ||
| 1250 | - foreach(const Template & t, list) { | 1249 | + foreach (const TemplateList &list, data) { |
| 1250 | + foreach(const Template &t, list) { | ||
| 1251 | separated.append(TemplateList()); | 1251 | separated.append(TemplateList()); |
| 1252 | separated.last().append(t); | 1252 | separated.last().append(t); |
| 1253 | } | 1253 | } |
| @@ -1292,7 +1292,7 @@ public: | @@ -1292,7 +1292,7 @@ public: | ||
| 1292 | } | 1292 | } |
| 1293 | 1293 | ||
| 1294 | 1294 | ||
| 1295 | - virtual void finalize(TemplateList & output) | 1295 | + virtual void finalize(TemplateList &output) |
| 1296 | { | 1296 | { |
| 1297 | (void) output; | 1297 | (void) output; |
| 1298 | // Nothing in particular to do here, stream calls finalize | 1298 | // Nothing in particular to do here, stream calls finalize |
| @@ -1301,7 +1301,7 @@ public: | @@ -1301,7 +1301,7 @@ public: | ||
| 1301 | 1301 | ||
| 1302 | // start processing, consider all templates in src a continuous | 1302 | // start processing, consider all templates in src a continuous |
| 1303 | // 'video' | 1303 | // 'video' |
| 1304 | - void projectUpdate(const TemplateList & src, TemplateList & dst) | 1304 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 1305 | { | 1305 | { |
| 1306 | dst = src; | 1306 | dst = src; |
| 1307 | if (src.empty()) | 1307 | if (src.empty()) |
| @@ -1319,7 +1319,7 @@ public: | @@ -1319,7 +1319,7 @@ public: | ||
| 1319 | 1319 | ||
| 1320 | // We have to get a frame before starting the thread | 1320 | // We have to get a frame before starting the thread |
| 1321 | bool last_frame = false; | 1321 | bool last_frame = false; |
| 1322 | - FrameData * firstFrame = readStage->dataSource.tryGetFrame(last_frame); | 1322 | + FrameData *firstFrame = readStage->dataSource.tryGetFrame(last_frame); |
| 1323 | if (firstFrame == NULL) | 1323 | if (firstFrame == NULL) |
| 1324 | qFatal("Failed to read first frame of video"); | 1324 | qFatal("Failed to read first frame of video"); |
| 1325 | 1325 | ||
| @@ -1355,14 +1355,14 @@ public: | @@ -1355,14 +1355,14 @@ public: | ||
| 1355 | 1355 | ||
| 1356 | // dst is set to all output received by the final stage, along | 1356 | // dst is set to all output received by the final stage, along |
| 1357 | // with anything output via the calls to finalize. | 1357 | // with anything output via the calls to finalize. |
| 1358 | - foreach(const TemplateList & list, collector->sets) { | 1358 | + foreach(const TemplateList &list, collector->sets) { |
| 1359 | dst.append(list); | 1359 | dst.append(list); |
| 1360 | } | 1360 | } |
| 1361 | collector->sets.clear(); | 1361 | collector->sets.clear(); |
| 1362 | 1362 | ||
| 1363 | dst.append(final_output); | 1363 | dst.append(final_output); |
| 1364 | 1364 | ||
| 1365 | - foreach(ProcessingStage * stage, processingStages) { | 1365 | + foreach(ProcessingStage *stage, processingStages) { |
| 1366 | stage->reset(); | 1366 | stage->reset(); |
| 1367 | } | 1367 | } |
| 1368 | } | 1368 | } |
| @@ -1474,8 +1474,8 @@ public: | @@ -1474,8 +1474,8 @@ public: | ||
| 1474 | protected: | 1474 | protected: |
| 1475 | QList<bool> stage_variance; | 1475 | QList<bool> stage_variance; |
| 1476 | 1476 | ||
| 1477 | - ReadStage * readStage; | ||
| 1478 | - SingleThreadStage * collectionStage; | 1477 | + ReadStage *readStage; |
| 1478 | + SingleThreadStage *collectionStage; | ||
| 1479 | QSharedPointer<CollectSets> collector; | 1479 | QSharedPointer<CollectSets> collector; |
| 1480 | 1480 | ||
| 1481 | QList<ProcessingStage *> processingStages; | 1481 | QList<ProcessingStage *> processingStages; |
| @@ -1497,14 +1497,14 @@ protected: | @@ -1497,14 +1497,14 @@ protected: | ||
| 1497 | // number of jobs. | 1497 | // number of jobs. |
| 1498 | static QHash<QObject *, QThreadPool *> pools; | 1498 | static QHash<QObject *, QThreadPool *> pools; |
| 1499 | static QMutex poolsAccess; | 1499 | static QMutex poolsAccess; |
| 1500 | - QThreadPool * threads; | 1500 | + QThreadPool *threads; |
| 1501 | 1501 | ||
| 1502 | void _project(const Template &src, Template &dst) const | 1502 | void _project(const Template &src, Template &dst) const |
| 1503 | { | 1503 | { |
| 1504 | (void) src; (void) dst; | 1504 | (void) src; (void) dst; |
| 1505 | qFatal("nope"); | 1505 | qFatal("nope"); |
| 1506 | } | 1506 | } |
| 1507 | - void _project(const TemplateList & src, TemplateList & dst) const | 1507 | + void _project(const TemplateList &src, TemplateList &dst) const |
| 1508 | { | 1508 | { |
| 1509 | (void) src; (void) dst; | 1509 | (void) src; (void) dst; |
| 1510 | qFatal("nope"); | 1510 | qFatal("nope"); |
| @@ -1542,17 +1542,17 @@ public: | @@ -1542,17 +1542,17 @@ public: | ||
| 1542 | { | 1542 | { |
| 1543 | basis.projectUpdate(src,dst); | 1543 | basis.projectUpdate(src,dst); |
| 1544 | } | 1544 | } |
| 1545 | - void projectUpdate(const TemplateList & src, TemplateList & dst) | 1545 | + void projectUpdate(const TemplateList &src, TemplateList &dst) |
| 1546 | { | 1546 | { |
| 1547 | basis.projectUpdate(src,dst); | 1547 | basis.projectUpdate(src,dst); |
| 1548 | } | 1548 | } |
| 1549 | 1549 | ||
| 1550 | - void train(const QList<TemplateList> & data) | 1550 | + void train(const QList<TemplateList> &data) |
| 1551 | { | 1551 | { |
| 1552 | basis.train(data); | 1552 | basis.train(data); |
| 1553 | } | 1553 | } |
| 1554 | 1554 | ||
| 1555 | - virtual void finalize(TemplateList & output) | 1555 | + virtual void finalize(TemplateList &output) |
| 1556 | { | 1556 | { |
| 1557 | (void) output; | 1557 | (void) output; |
| 1558 | // Nothing in particular to do here, stream calls finalize | 1558 | // Nothing in particular to do here, stream calls finalize |
| @@ -1573,7 +1573,7 @@ public: | @@ -1573,7 +1573,7 @@ public: | ||
| 1573 | basis.readMode = this->readMode; | 1573 | basis.readMode = this->readMode; |
| 1574 | 1574 | ||
| 1575 | // We need at least a CompositeTransform * to acess transform's children. | 1575 | // We need at least a CompositeTransform * to acess transform's children. |
| 1576 | - CompositeTransform * downcast = dynamic_cast<CompositeTransform *> (transform); | 1576 | + CompositeTransform *downcast = dynamic_cast<CompositeTransform *> (transform); |
| 1577 | 1577 | ||
| 1578 | // If this isn't even a composite transform, or it's not a pipe, just set up | 1578 | // If this isn't even a composite transform, or it's not a pipe, just set up |
| 1579 | // basis with 1 stage. | 1579 | // basis with 1 stage. |
| @@ -1627,7 +1627,7 @@ public: | @@ -1627,7 +1627,7 @@ public: | ||
| 1627 | } | 1627 | } |
| 1628 | //otherwise we build a pipe | 1628 | //otherwise we build a pipe |
| 1629 | else { | 1629 | else { |
| 1630 | - CompositeTransform * pipe = dynamic_cast<CompositeTransform *>(Transform::make("Pipe([])", this)); | 1630 | + CompositeTransform *pipe = dynamic_cast<CompositeTransform *>(Transform::make("Pipe([])", this)); |
| 1631 | pipe->transforms = sets[i]; | 1631 | pipe->transforms = sets[i]; |
| 1632 | pipe->init(); | 1632 | pipe->init(); |
| 1633 | transform_set.append(pipe); | 1633 | transform_set.append(pipe); |
| @@ -1638,10 +1638,10 @@ public: | @@ -1638,10 +1638,10 @@ public: | ||
| 1638 | basis.init(); | 1638 | basis.init(); |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | - Transform * smartCopy(bool & newTransform) | 1641 | + Transform *smartCopy(bool &newTransform) |
| 1642 | { | 1642 | { |
| 1643 | // We just want the DirectStream to begin with, so just return a copy of that. | 1643 | // We just want the DirectStream to begin with, so just return a copy of that. |
| 1644 | - DirectStreamTransform * res = (DirectStreamTransform *) basis.smartCopy(newTransform); | 1644 | + DirectStreamTransform *res = (DirectStreamTransform *) basis.smartCopy(newTransform); |
| 1645 | res->activeFrames = this->activeFrames; | 1645 | res->activeFrames = this->activeFrames; |
| 1646 | return res; | 1646 | return res; |
| 1647 | } | 1647 | } |