Commit 5ffd5dc387160b536b191eceeda4bdfe6e8d9633

Authored by Charles Otto
1 parent 33ec0cdc

Rename emptyRead FileList::fromGallery, default caching to off.

openbr/core/core.cpp
@@ -350,8 +350,8 @@ struct AlgorithmCore @@ -350,8 +350,8 @@ struct AlgorithmCore
350 FileList queryMetadata; 350 FileList queryMetadata;
351 351
352 // Emptyread reads a gallery, and discards any matrices present, keeping only the metadata. 352 // Emptyread reads a gallery, and discards any matrices present, keeping only the metadata.
353 - emptyRead(targetGallery, targetMetadata);  
354 - emptyRead(queryGallery, queryMetadata); 353 + targetMetadata = FileList::fromGallery(targetGallery, true);
  354 + queryMetadata = FileList::fromGallery(queryGallery, true);
355 355
356 356
357 // Is the target or query set larger? We will use the larger as the rows of our comparison matrix (and transpose the output if necessary) 357 // Is the target or query set larger? We will use the larger as the rows of our comparison matrix (and transpose the output if necessary)
openbr/openbr_plugin.h
@@ -369,6 +369,8 @@ struct BR_EXPORT FileList : public QList<File> @@ -369,6 +369,8 @@ struct BR_EXPORT FileList : public QList<File>
369 369
370 QList<int> crossValidationPartitions() const; /*!< \brief Returns the cross-validation partition (default=0) for each file in the list. */ 370 QList<int> crossValidationPartitions() const; /*!< \brief Returns the cross-validation partition (default=0) for each file in the list. */
371 int failures() const; /*!< \brief Returns the number of files with br::File::failed(). */ 371 int failures() const; /*!< \brief Returns the number of files with br::File::failed(). */
  372 +
  373 + static FileList fromGallery(const File &gallery, bool cache = false); /*!< \brief Create a file list from a br::Gallery. */
372 }; 374 };
373 375
374 /*! 376 /*!
openbr/plugins/gallery.cpp
@@ -393,16 +393,17 @@ class memGallery : public Gallery @@ -393,16 +393,17 @@ class memGallery : public Gallery
393 393
394 BR_REGISTER(Gallery, memGallery) 394 BR_REGISTER(Gallery, memGallery)
395 395
396 -void emptyRead(const File & file, FileList & fileData, bool cache) 396 +FileList FileList::fromGallery(const File & file, bool cache)
397 { 397 {
398 File targetMeta = file; 398 File targetMeta = file;
399 targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem"; 399 targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem";
400 400
  401 + FileList fileData;
  402 +
401 // Did we already read the data? 403 // Did we already read the data?
402 if (MemoryGalleries::galleries.contains(targetMeta)) 404 if (MemoryGalleries::galleries.contains(targetMeta))
403 { 405 {
404 - fileData = MemoryGalleries::galleries[targetMeta].files();  
405 - return; 406 + return MemoryGalleries::galleries[targetMeta].files();
406 } 407 }
407 408
408 TemplateList templates; 409 TemplateList templates;
@@ -434,6 +435,7 @@ void emptyRead(const File &amp; file, FileList &amp; fileData, bool cache) @@ -434,6 +435,7 @@ void emptyRead(const File &amp; file, FileList &amp; fileData, bool cache)
434 memOutput->writeBlock(templates); 435 memOutput->writeBlock(templates);
435 } 436 }
436 fileData = templates.files(); 437 fileData = templates.files();
  438 + return fileData;
437 } 439 }
438 440
439 /*! 441 /*!
openbr/plugins/misc.cpp
@@ -636,10 +636,8 @@ class OutputTransform : public TimeVaryingTransform @@ -636,10 +636,8 @@ class OutputTransform : public TimeVaryingTransform
636 if (targetName.isEmpty() || queryName.isEmpty() || outputString.isEmpty()) 636 if (targetName.isEmpty() || queryName.isEmpty() || outputString.isEmpty())
637 return; 637 return;
638 638
639 - FileList targetFiles;  
640 - FileList queryFiles;  
641 - emptyRead(targetName, targetFiles, false);  
642 - emptyRead(queryName, queryFiles, false); 639 + FileList targetFiles = FileList::fromGallery(targetName);
  640 + FileList queryFiles = FileList::fromGallery(queryName);
643 641
644 currentBlockRow = 0; 642 currentBlockRow = 0;
645 currentBlockCol = 0; 643 currentBlockCol = 0;
openbr/plugins/openbr_internal.h
@@ -314,11 +314,6 @@ struct WorkerProcess @@ -314,11 +314,6 @@ struct WorkerProcess
314 void mainLoop(); 314 void mainLoop();
315 }; 315 };
316 316
317 -  
318 -// Read metadata for all templates stored in the specified gallery, return the read  
319 -// TeamplateList. If the gallery contains matrices, they are dropped.  
320 -void emptyRead(const File & file, FileList & templates, bool cache = true);  
321 -  
322 } 317 }
323 318
324 #endif // OPENBR_INTERNAL_H 319 #endif // OPENBR_INTERNAL_H