Commit 35109e1dd8b594414f827bead8162269a2c93895

Authored by Charles Otto
1 parent 101231ab

Some formatting updates

openbr/core/core.cpp
@@ -52,7 +52,7 @@ struct AlgorithmCore @@ -52,7 +52,7 @@ struct AlgorithmCore
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(transform.data());
56 56
57 downcast->init(); 57 downcast->init();
58 58
@@ -149,7 +149,7 @@ struct AlgorithmCore @@ -149,7 +149,7 @@ struct AlgorithmCore
149 Gallery *temp = Gallery::make(input); 149 Gallery *temp = Gallery::make(input);
150 qint64 total = temp->totalSize(); 150 qint64 total = temp->totalSize();
151 151
152 - Transform * enroll = this->transform.data(); 152 + Transform *enroll = transform.data();
153 if (multiProcess) 153 if (multiProcess)
154 enroll = wrapTransform(enroll, "ProcessWrapper"); 154 enroll = wrapTransform(enroll, "ProcessWrapper");
155 155
@@ -430,7 +430,7 @@ struct AlgorithmCore @@ -430,7 +430,7 @@ struct AlgorithmCore
430 if (needEnrollRows) 430 if (needEnrollRows)
431 enrollCompare.prepend(this->transform.data()); 431 enrollCompare.prepend(this->transform.data());
432 432
433 - Transform * compareRegionBase = pipeTransforms(enrollCompare); 433 + Transform *compareRegionBase = pipeTransforms(enrollCompare);
434 // If in multi-process mode, wrap the enroll+compare structure in a ProcessWrapper. 434 // If in multi-process mode, wrap the enroll+compare structure in a ProcessWrapper.
435 if (multiProcess) 435 if (multiProcess)
436 compareRegionBase = wrapTransform(compareRegionBase, "ProcessWrapper"); 436 compareRegionBase = wrapTransform(compareRegionBase, "ProcessWrapper");
@@ -460,7 +460,7 @@ struct AlgorithmCore @@ -460,7 +460,7 @@ struct AlgorithmCore
460 460
461 // With this, we have set up a transform which (optionally) enrolls templates, compares them 461 // With this, we have set up a transform which (optionally) enrolls templates, compares them
462 // against a gallery, and outputs them. 462 // against a gallery, and outputs them.
463 - Transform * pipeline = br::pipeTransforms(compareOutput); 463 + Transform *pipeline = br::pipeTransforms(compareOutput);
464 464
465 // Now, we will give that base transform to a stream, which will incrementally read the row gallery 465 // Now, we will give that base transform to a stream, which will incrementally read the row gallery
466 // and pass the transforms it reads through the base algorithm. 466 // and pass the transforms it reads through the base algorithm.
openbr/core/qtutils.cpp
@@ -105,7 +105,7 @@ void writeFile(const QString &amp;file, const QStringList &amp;lines) @@ -105,7 +105,7 @@ void writeFile(const QString &amp;file, const QStringList &amp;lines)
105 if (!f.open(QFile::WriteOnly)) 105 if (!f.open(QFile::WriteOnly))
106 qFatal("Failed to open %s for writing.", qPrintable(file)); 106 qFatal("Failed to open %s for writing.", qPrintable(file));
107 107
108 - foreach (const QString & line, lines) 108 + foreach (const QString &line, lines)
109 f.write((line+"\n").toLocal8Bit() ); 109 f.write((line+"\n").toLocal8Bit() );
110 110
111 f.close(); 111 f.close();
openbr/openbr.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 28
29 using namespace br; 29 using namespace br;
30 30
31 -static int partialCopy(const QString & string, char * buffer, int buffer_length) 31 +static int partialCopy(const QString &string, char *buffer, int buffer_length)
32 { 32 {
33 33
34 QByteArray byteArray = string.toLocal8Bit(); 34 QByteArray byteArray = string.toLocal8Bit();
@@ -109,7 +109,7 @@ float br_eval(const char *simmat, const char *mask, const char *csv) @@ -109,7 +109,7 @@ float br_eval(const char *simmat, const char *mask, const char *csv)
109 return Evaluate(simmat, mask, csv); 109 return Evaluate(simmat, mask, csv);
110 } 110 }
111 111
112 -float br_inplace_eval(const char * simmat, const char *target, const char *query, const char *csv) 112 +float br_inplace_eval(const char *simmat, const char *target, const char *query, const char *csv)
113 { 113 {
114 return InplaceEval(simmat, target, query, csv); 114 return InplaceEval(simmat, target, query, csv);
115 } 115 }
@@ -119,7 +119,7 @@ void br_eval_classification(const char *predicted_gallery, const char *truth_gal @@ -119,7 +119,7 @@ void br_eval_classification(const char *predicted_gallery, const char *truth_gal
119 EvalClassification(predicted_gallery, truth_gallery, predicted_property, truth_property); 119 EvalClassification(predicted_gallery, truth_gallery, predicted_property, truth_property);
120 } 120 }
121 121
122 -void br_eval_clustering(const char *csv, const char *gallery, const char * truth_property) 122 +void br_eval_clustering(const char *csv, const char *gallery, const char *truth_property)
123 { 123 {
124 EvalClustering(csv, gallery, truth_property); 124 EvalClustering(csv, gallery, truth_property);
125 } 125 }
@@ -178,12 +178,12 @@ void br_make_pairwise_mask(const char *target_input, const char *query_input, co @@ -178,12 +178,12 @@ void br_make_pairwise_mask(const char *target_input, const char *query_input, co
178 BEE::makePairwiseMask(target_input, query_input, mask); 178 BEE::makePairwiseMask(target_input, query_input, mask);
179 } 179 }
180 180
181 -int br_most_recent_message(char * buffer, int buffer_length) 181 +int br_most_recent_message(char *buffer, int buffer_length)
182 { 182 {
183 return partialCopy(Globals->mostRecentMessage, buffer, buffer_length); 183 return partialCopy(Globals->mostRecentMessage, buffer, buffer_length);
184 } 184 }
185 185
186 -int br_objects(char * buffer, int buffer_length, const char *abstractions, const char *implementations, bool parameters) 186 +int br_objects(char *buffer, int buffer_length, const char *abstractions, const char *implementations, bool parameters)
187 { 187 {
188 return partialCopy(br::Context::objects(abstractions, implementations, parameters).join('\n'), buffer, buffer_length); 188 return partialCopy(br::Context::objects(abstractions, implementations, parameters).join('\n'), buffer, buffer_length);
189 } 189 }
@@ -240,7 +240,7 @@ void br_read_pipe(const char *pipe, int *argc, char ***argv) @@ -240,7 +240,7 @@ void br_read_pipe(const char *pipe, int *argc, char ***argv)
240 *argv = rawCharArrayList.data(); 240 *argv = rawCharArrayList.data();
241 } 241 }
242 242
243 -int br_scratch_path(char * buffer, int buffer_length) 243 +int br_scratch_path(char *buffer, int buffer_length)
244 { 244 {
245 return partialCopy(Context::scratchPath(), buffer, buffer_length); 245 return partialCopy(Context::scratchPath(), buffer, buffer_length);
246 } 246 }
@@ -298,9 +298,9 @@ const char *br_version() @@ -298,9 +298,9 @@ const char *br_version()
298 return version.data(); 298 return version.data();
299 } 299 }
300 300
301 -void br_slave_process(const char * baseName) 301 +void br_slave_process(const char *baseName)
302 { 302 {
303 - WorkerProcess * worker = new WorkerProcess; 303 + WorkerProcess *worker = new WorkerProcess;
304 worker->transform = Globals->algorithm; 304 worker->transform = Globals->algorithm;
305 worker->baseName = baseName; 305 worker->baseName = baseName;
306 worker->mainLoop(); 306 worker->mainLoop();
@@ -371,7 +371,7 @@ bool br_img_is_empty(br_template tmpl) @@ -371,7 +371,7 @@ bool br_img_is_empty(br_template tmpl)
371 return t->m().empty(); 371 return t->m().empty();
372 } 372 }
373 373
374 -int br_get_filename(char * buffer, int buffer_length, br_template tmpl) 374 +int br_get_filename(char *buffer, int buffer_length, br_template tmpl)
375 { 375 {
376 return partialCopy(reinterpret_cast<Template*>(tmpl)->file.name, buffer, buffer_length); 376 return partialCopy(reinterpret_cast<Template*>(tmpl)->file.name, buffer, buffer_length);
377 } 377 }
@@ -382,7 +382,7 @@ void br_set_filename(br_template tmpl, const char *filename) @@ -382,7 +382,7 @@ void br_set_filename(br_template tmpl, const char *filename)
382 t->file.name = filename; 382 t->file.name = filename;
383 } 383 }
384 384
385 -int br_get_metadata_string(char * buffer, int buffer_length, br_template tmpl, const char *key) 385 +int br_get_metadata_string(char *buffer, int buffer_length, br_template tmpl, const char *key)
386 { 386 {
387 Template *t = reinterpret_cast<Template*>(tmpl); 387 Template *t = reinterpret_cast<Template*>(tmpl);
388 QVariant qvar = t->file.value(key); 388 QVariant qvar = t->file.value(key);
openbr/openbr_plugin.cpp
@@ -1303,7 +1303,7 @@ Transform *Transform::make(QString str, QObject *parent) @@ -1303,7 +1303,7 @@ Transform *Transform::make(QString str, QObject *parent)
1303 1303
1304 Transform *Transform::clone() const 1304 Transform *Transform::clone() const
1305 { 1305 {
1306 - Transform * temp = (Transform *) this; 1306 + Transform *temp = (Transform *) this;
1307 Transform *clone = Factory<Transform>::make("."+temp->description(false)); 1307 Transform *clone = Factory<Transform>::make("."+temp->description(false));
1308 return clone; 1308 return clone;
1309 } 1309 }
openbr/openbr_plugin.h
@@ -592,7 +592,7 @@ public: @@ -592,7 +592,7 @@ public:
592 virtual void store(QDataStream &stream, bool force = false) const; /*!< \brief Serialize the object. */ 592 virtual void store(QDataStream &stream, bool force = false) const; /*!< \brief Serialize the object. */
593 virtual void load(QDataStream &stream); /*!< \brief Deserialize the object. Default implementation calls init() after deserialization. */ 593 virtual void load(QDataStream &stream); /*!< \brief Deserialize the object. Default implementation calls init() after deserialization. */
594 594
595 - virtual void serialize(QDataStream & stream, bool force) 595 + virtual void serialize(QDataStream &stream, bool force)
596 { 596 {
597 stream << description(force); 597 stream << description(force);
598 store(stream, force); 598 store(stream, force);
@@ -1315,7 +1315,7 @@ inline TemplateList &amp;operator&gt;&gt;(TemplateList &amp;srcdst, const Transform &amp;f) @@ -1315,7 +1315,7 @@ inline TemplateList &amp;operator&gt;&gt;(TemplateList &amp;srcdst, const Transform &amp;f)
1315 /*! 1315 /*!
1316 * \brief Convenience function equivalent to store(). 1316 * \brief Convenience function equivalent to store().
1317 */ 1317 */
1318 -inline QDataStream &operator<<(QDataStream &stream, const Transform &f) 1318 +inline QDataStream &operator<<(QDataStream &stream, Transform &f)
1319 { 1319 {
1320 f.store(stream); 1320 f.store(stream);
1321 return stream; 1321 return stream;
openbr/plugins/distance.cpp
@@ -483,7 +483,7 @@ class GalleryCompareTransform : public Transform @@ -483,7 +483,7 @@ class GalleryCompareTransform : public Transform
483 gallery = TemplateList::fromGallery(galleryName); 483 gallery = TemplateList::fromGallery(galleryName);
484 } 484 }
485 485
486 - void train(const TemplateList & data) 486 + void train(const TemplateList &data)
487 { 487 {
488 gallery = data; 488 gallery = data;
489 } 489 }
openbr/plugins/frames.cpp
@@ -37,7 +37,7 @@ private: @@ -37,7 +37,7 @@ private:
37 dst.append(out); 37 dst.append(out);
38 } 38 }
39 39
40 - void finalize(TemplateList & output) 40 + void finalize(TemplateList &output)
41 { 41 {
42 (void) output; 42 (void) output;
43 buffer.clear(); 43 buffer.clear();
openbr/plugins/openbr_internal.h
@@ -213,7 +213,7 @@ public: @@ -213,7 +213,7 @@ public:
213 return false; 213 return false;
214 } 214 }
215 215
216 - Transform * smartCopy(bool & newTransform) 216 + Transform *smartCopy(bool &newTransform)
217 { 217 {
218 if (!timeVarying()) { 218 if (!timeVarying()) {
219 newTransform = false; 219 newTransform = false;
@@ -240,7 +240,7 @@ public: @@ -240,7 +240,7 @@ public:
240 qFatal("Dynamic cast failed!"); 240 qFatal("Dynamic cast failed!");
241 241
242 bool newItem = false; 242 bool newItem = false;
243 - Transform * maybe_copy = transform->smartCopy(newItem); 243 + Transform *maybe_copy = transform->smartCopy(newItem);
244 if (newItem) 244 if (newItem)
245 maybe_copy->setParent(output); 245 maybe_copy->setParent(output);
246 output->transform = maybe_copy; 246 output->transform = maybe_copy;
openbr/plugins/pp5.cpp
@@ -452,7 +452,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform @@ -452,7 +452,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform
452 QList<int> targetIDs; 452 QList<int> targetIDs;
453 TemplateList gallery; 453 TemplateList gallery;
454 454
455 - void project(const Template & src, Template & dst) const 455 + void project(const Template &src, Template &dst) const
456 { 456 {
457 TemplateList temp, output; 457 TemplateList temp, output;
458 temp.append(src); 458 temp.append(src);
@@ -461,7 +461,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform @@ -461,7 +461,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform
461 dst = output[0]; 461 dst = output[0];
462 } 462 }
463 463
464 - void project(const TemplateList & src, TemplateList & dst) const 464 + void project(const TemplateList &src, TemplateList &dst) const
465 { 465 {
466 dst.clear(); 466 dst.clear();
467 QList<int> queryIDs; 467 QList<int> queryIDs;
@@ -505,7 +505,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform @@ -505,7 +505,7 @@ class PP5GalleryTransform: public UntrainableMetaTransform
505 } 505 }
506 } 506 }
507 507
508 - void train(const TemplateList & data) 508 + void train(const TemplateList &data)
509 { 509 {
510 gallery = data; 510 gallery = data;
511 } 511 }
openbr/plugins/process.cpp
@@ -21,7 +21,7 @@ class CommunicationManager : public QObject @@ -21,7 +21,7 @@ class CommunicationManager : public QObject
21 { 21 {
22 Q_OBJECT 22 Q_OBJECT
23 public: 23 public:
24 - QThread * basis; 24 + QThread *basis;
25 CommunicationManager() 25 CommunicationManager()
26 { 26 {
27 basis = new QThread; 27 basis = new QThread;
@@ -294,7 +294,7 @@ public: @@ -294,7 +294,7 @@ public:
294 QString serverName; 294 QString serverName;
295 QString remoteName; 295 QString remoteName;
296 296
297 - QLocalSocket * inbound; 297 + QLocalSocket *inbound;
298 QLocalSocket outbound; 298 QLocalSocket outbound;
299 QLocalServer server; 299 QLocalServer server;
300 300
@@ -309,7 +309,7 @@ public: @@ -309,7 +309,7 @@ public:
309 } 309 }
310 } 310 }
311 311
312 - void connectToRemote(const QString & remoteName) 312 + void connectToRemote(const QString &remoteName)
313 { 313 {
314 emit pulseOutboundConnect(remoteName); 314 emit pulseOutboundConnect(remoteName);
315 315
@@ -328,7 +328,7 @@ public: @@ -328,7 +328,7 @@ public:
328 328
329 329
330 template<typename T> 330 template<typename T>
331 - bool readData(T & input) 331 + bool readData(T &input)
332 { 332 {
333 emit pulseReadSerialized(); 333 emit pulseReadSerialized();
334 QDataStream deserializer(readArray); 334 QDataStream deserializer(readArray);
@@ -336,18 +336,18 @@ public: @@ -336,18 +336,18 @@ public:
336 return true; 336 return true;
337 } 337 }
338 338
339 - Transform * readTForm() 339 + Transform *readTForm()
340 { 340 {
341 emit pulseReadSerialized(); 341 emit pulseReadSerialized();
342 342
343 QByteArray data = readArray; 343 QByteArray data = readArray;
344 QDataStream deserializer(data); 344 QDataStream deserializer(data);
345 - Transform * res = Transform::deserialize(deserializer); 345 + Transform *res = Transform::deserialize(deserializer);
346 return res; 346 return res;
347 } 347 }
348 348
349 template<typename T> 349 template<typename T>
350 - bool sendData(const T & output) 350 + bool sendData(const T &output)
351 { 351 {
352 QBuffer buffer; 352 QBuffer buffer;
353 buffer.open(QBuffer::ReadWrite); 353 buffer.open(QBuffer::ReadWrite);
@@ -386,7 +386,7 @@ class EnrollmentWorker : public QObject @@ -386,7 +386,7 @@ class EnrollmentWorker : public QObject
386 { 386 {
387 Q_OBJECT 387 Q_OBJECT
388 public: 388 public:
389 - CommunicationManager * comm; 389 + CommunicationManager *comm;
390 QString name; 390 QString name;
391 391
392 ~EnrollmentWorker() 392 ~EnrollmentWorker()
@@ -397,10 +397,10 @@ public: @@ -397,10 +397,10 @@ public:
397 delete comm; 397 delete comm;
398 } 398 }
399 399
400 - br::Transform * transform; 400 + br::Transform *transform;
401 401
402 public: 402 public:
403 - void connections(const QString & baseName) 403 + void connections(const QString &baseName)
404 { 404 {
405 comm = new CommunicationManager(); 405 comm = new CommunicationManager();
406 name = baseName; 406 name = baseName;
@@ -521,7 +521,7 @@ class ProcessWrapperTransform : public WrapperTransform @@ -521,7 +521,7 @@ class ProcessWrapperTransform : public WrapperTransform
521 521
522 Resource<ProcessData> processes; 522 Resource<ProcessData> processes;
523 523
524 - Transform * smartCopy(bool & newTransform) 524 + Transform *smartCopy(bool &newTransform)
525 { 525 {
526 newTransform = false; 526 newTransform = false;
527 return this; 527 return this;
@@ -536,7 +536,7 @@ class ProcessWrapperTransform : public WrapperTransform @@ -536,7 +536,7 @@ class ProcessWrapperTransform : public WrapperTransform
536 if (!data->initialized) 536 if (!data->initialized)
537 activateProcess(data); 537 activateProcess(data);
538 538
539 - CommunicationManager * localComm = &(data->comm); 539 + CommunicationManager *localComm = &(data->comm);
540 localComm->sendSignal(CommunicationManager::INPUT_AVAILABLE); 540 localComm->sendSignal(CommunicationManager::INPUT_AVAILABLE);
541 541
542 localComm->sendData(src); 542 localComm->sendData(src);
@@ -560,7 +560,7 @@ class ProcessWrapperTransform : public WrapperTransform @@ -560,7 +560,7 @@ class ProcessWrapperTransform : public WrapperTransform
560 } 560 }
561 561
562 QByteArray serialized; 562 QByteArray serialized;
563 - void transmitTForm(CommunicationManager * localComm) const 563 + void transmitTForm(CommunicationManager *localComm) const
564 { 564 {
565 if (serialized.isEmpty() ) 565 if (serialized.isEmpty() )
566 qFatal("Trying to transmit empty transform!"); 566 qFatal("Trying to transmit empty transform!");
@@ -569,7 +569,7 @@ class ProcessWrapperTransform : public WrapperTransform @@ -569,7 +569,7 @@ class ProcessWrapperTransform : public WrapperTransform
569 emit localComm->pulseSendSerialized(); 569 emit localComm->pulseSendSerialized();
570 } 570 }
571 571
572 - void activateProcess(ProcessData * data) const 572 + void activateProcess(ProcessData *data) const
573 { 573 {
574 data->initialized = true; 574 data->initialized = true;
575 // generate a uuid for our local servers 575 // generate a uuid for our local servers
openbr/plugins/validate.cpp
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 namespace br 7 namespace br
8 { 8 {
9 9
10 -static void _train(Transform * transform, TemplateList data) // think data has to be a copy -cao 10 +static void _train(Transform *transform, TemplateList data) // think data has to be a copy -cao
11 { 11 {
12 transform->train(data); 12 transform->train(data);
13 } 13 }