Xmipp  v3.23.11-Nereus
Protected Member Functions | List of all members
Rerunable Class Referenceabstract

#include <rerunable_program.h>

Inheritance diagram for Rerunable:
Inheritance graph
[legend]

Protected Member Functions

 Rerunable (const FileName &fn)
 
virtual void createWorkFiles (bool resume, MetaData *md)
 
virtual std::vector< MDLabelgetLabelsForEmpty ()=0
 
const FileNamegetFileName () const
 
void setFileName (const FileName &fn)
 

Detailed Description

This class adds rerun functionality to Xmipp program. Program is expected to store the progres in the MetaData file stored in the file system. In case of failure or interruption, this file can be loaded and the program will automatically pick up where it left.

Definition at line 38 of file rerunable_program.h.

Constructor & Destructor Documentation

◆ Rerunable()

Rerunable::Rerunable ( const FileName fn)
inlineprotected

Definition at line 43 of file rerunable_program.h.

43 : fnDone(fn) {}

Member Function Documentation

◆ createWorkFiles()

virtual void Rerunable::createWorkFiles ( bool  resume,
MetaData md 
)
inlineprotectedvirtual

This method will fill remove processed records from the md. Md will not be changed if no data has been processed.

Definition at line 49 of file rerunable_program.h.

49  {
50  if (nullptr == md) {
52  "Null pointer passed. "
53  "If you can reproduce this, please contact developers.");
54  }
55  if (resume && fnDone.exists()) {
56  MetaDataDb done(fnDone);
57  auto *toDo = dynamic_cast<MetaDataDb *>(md);
58  if (nullptr == toDo) {
59  MetaDataDb tmp(*md);
60  tmp.subtraction(done, MDL_IMAGE);
61  *md = tmp;
62  } else {
63  toDo->subtraction(done, MDL_IMAGE);
64  }
65  } else // if not exists create metadata only with headers
66  {
67  MetaDataVec mdDone;
68  for (const auto &l : this->getLabelsForEmpty()) {
69  mdDone.addLabel(l);
70  }
71  mdDone.write(fnDone);
72  }
73  }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
MetaData error.
Definition: xmipp_error.h:154
bool exists() const
bool addLabel(const MDLabel label, int pos=-1) override
virtual std::vector< MDLabel > getLabelsForEmpty()=0
Name of an image (std::string)

◆ getFileName()

const FileName& Rerunable::getFileName ( ) const
inlineprotected

Definition at line 80 of file rerunable_program.h.

80 { return this->fnDone; }

◆ getLabelsForEmpty()

virtual std::vector<MDLabel> Rerunable::getLabelsForEmpty ( )
protectedpure virtual

Returns labels to be used in the empty progres MetaData file

◆ setFileName()

void Rerunable::setFileName ( const FileName fn)
inlineprotected

Definition at line 82 of file rerunable_program.h.

82 { fnDone = fn; }

The documentation for this class was generated from the following file: