Batch Class Reference

#include <Batch.h>

List of all members.

Public Member Functions

 Batch (wxFrame *parent, wxString path)
 Main constructor.
void AddAppToBatch (wxString app)
 Adds an application entry in the batch list.
void AddProjectToBatch (wxString projectFile, wxString outputFile=_T(""), Project::Target target=Project::STITCHING)
 Adds a project entry in the batch list.
bool AllDone ()
 Returns true if there are no more projects pending execution.
void AppendBatchFile (wxString file)
 Appends projects from file to batch list.
void CancelBatch ()
 Stops batch run, failing projects in progress.
void CancelProject (int index)
 Cancels project at index in batch, failing it.
void ChangePrefix (int index, wxString newPrefix)
 Changes output prefix for project at index.
int ClearBatch ()
 Clears batch list and returns 0 if succesful.
bool CompareProjectsInLists (int stitchListIndex, int batchListIndex)
 Compares two project at indexes in both lists and returns true if they have identical project ids.
int GetFirstAvailable ()
 Returns index of first waiting project in batch.
int GetIndex (int id)
 Returns index of project with selected id.
ProjectGetProject (int index)
 Returns project at index.
int GetProjectCount ()
 Returns number of projects in batch list.
int GetProjectCountByPath (wxString path)
 Returns number of projects in batch list with the input file path.
int GetRunningCount ()
 Returns number of projects currently in progress.
Project::Status GetStatus (int index)
 Returns current status of project at index.
bool IsRunning ()
 return true, if batch is running
bool IsPaused ()
 Returns true if batch execution is currently paused.
const wxString GetLastFile ()
 Returns last saved batch file.
wxDateTime GetLastFileDate ()
void ListBatch ()
 Used in console mode.
int LoadBatchFile (wxString file)
 Clears current batch list and loads projects from batch file.
int LoadTemp ()
 Loads temporary batch file.
bool NoErrors ()
 Returns true if there are no failed projects in batch.
void OnProcessTerminate (wxProcessEvent &event)
 Called internally when all running processes have completed and need to be removed from running list.
bool OnStitch (wxString scriptFile, wxString outname, int id)
 Called to start stitch of project with input scriptFile.
bool OnDetect (wxString scriptFile, int id)
 called to start detecting
void PauseBatch ()
 Pauses and continues batch execution.
void RemoveProject (int id)
 Removes project with id from batch list.
void RemoveProjectAtIndex (int selIndex)
 Removes project at index from batch list.
void RunBatch ()
 Starts batch execution.
void RunNextInBatch ()
 Starts execution of next waiting project in batch.
void SaveBatchFile (wxString file)
 Saves batch list to file.
void SaveTemp ()
 Saves batch list to temporary file.
void SetStatus (int index, Project::Status status)
 Used internally to set status of selected project.
void SwapProject (int index)
 Swaps position in batch of project at index with project at index+1.
void ShowOutput (bool isVisible=true)
 Set visibility of all running projects.
size_t GetFailedProjectsCount ()
 returns number of failed projects
wxString GetFailedProjectName (unsigned int i)
 returns project file name of failed project with index i
wxString GetFailedProjectLog (unsigned int i)
 returns log file name of failed project with index i

Public Attributes

bool parallel
bool deleteFiles
bool shutdown
bool overwrite
bool verbose
bool autostitch
bool autoremove
bool saveLog

Private Attributes

wxConfigBase * m_config
ProjectArray m_projList
FrameArray m_stitchFrames
wxString m_lastFile
wxDateTime m_lastmod
bool m_cancelled
bool m_paused
bool m_running
bool m_clearedInProgress
std::vector< FailedProjectm_failedProjects
PTPrograms progs
AssistantPrograms progsAss


Constructor & Destructor Documentation

Batch::Batch wxFrame *  parent,
wxString  path
 

Main constructor.

Definition at line 44 of file Batch.cpp.

References getAssistantProgramsConfig(), getExePath(), getPTProgramsConfig(), and makefile::path.


Member Function Documentation

void Batch::AddAppToBatch wxString  app  ) 
 

Adds an application entry in the batch list.

Definition at line 82 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::OnButtonAddCommand().

void Batch::AddProjectToBatch wxString  projectFile,
wxString  outputFile = _T(""),
Project::Target  target = Project::STITCHING
 

Adds a project entry in the batch list.

Definition at line 88 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::AddDirToList(), BatchFrame::AddToList(), AppendBatchFile(), and OnProcessTerminate().

bool Batch::AllDone  ) 
 

Returns true if there are no more projects pending execution.

Definition at line 108 of file Batch.cpp.

References m_projList.

Referenced by OnProcessTerminate(), and RunNextInBatch().

void Batch::AppendBatchFile wxString  file  ) 
 

Appends projects from file to batch list.

Definition at line 122 of file Batch.cpp.

References AddProjectToBatch(), m_lastFile, m_lastmod, and m_projList.

Referenced by LoadBatchFile(), and LoadTemp().

void Batch::CancelBatch  ) 
 

Stops batch run, failing projects in progress.

Definition at line 173 of file Batch.cpp.

References CancelProject(), GetRunningCount(), m_cancelled, and m_running.

Referenced by ClearBatch(), and BatchFrame::OnButtonCancel().

void Batch::CancelProject int  index  ) 
 

Cancels project at index in batch, failing it.

Definition at line 182 of file Batch.cpp.

References GetRunningCount(), m_paused, m_running, and m_stitchFrames.

Referenced by CancelBatch(), and BatchFrame::OnButtonSkip().

void Batch::ChangePrefix int  index,
wxString  newPrefix
 

Changes output prefix for project at index.

Definition at line 195 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::ChangePrefix().

int Batch::ClearBatch  ) 
 

Clears batch list and returns 0 if succesful.

Definition at line 200 of file Batch.cpp.

References CancelBatch(), m_clearedInProgress, m_projList, and m_stitchFrames.

Referenced by LoadBatchFile(), BatchFrame::OnButtonClear(), and BatchFrame::OnReloadBatch().

bool Batch::CompareProjectsInLists int  stitchListIndex,
int  batchListIndex
 

Compares two project at indexes in both lists and returns true if they have identical project ids.

Definition at line 234 of file Batch.cpp.

References m_projList, and m_stitchFrames.

Referenced by BatchFrame::OnButtonSkip().

wxString Batch::GetFailedProjectLog unsigned int  i  ) 
 

returns log file name of failed project with index i

Definition at line 975 of file Batch.cpp.

References m_failedProjects.

Referenced by FailedProjectsDialog::OnSelectProject().

wxString Batch::GetFailedProjectName unsigned int  i  ) 
 

returns project file name of failed project with index i

Definition at line 963 of file Batch.cpp.

References m_failedProjects.

size_t Batch::GetFailedProjectsCount  )  [inline]
 

returns number of failed projects

Definition at line 148 of file Batch.h.

References m_failedProjects.

Referenced by BatchFrame::OnBatchFailed().

int Batch::GetFirstAvailable  ) 
 

Returns index of first waiting project in batch.

Definition at line 239 of file Batch.cpp.

References m_projList.

Referenced by RunNextInBatch().

int Batch::GetIndex int  id  ) 
 

Returns index of project with selected id.

Definition at line 264 of file Batch.cpp.

References m_projList.

Referenced by OnProcessTerminate(), and RemoveProject().

const wxString Batch::GetLastFile  )  [inline]
 

Returns last saved batch file.

Definition at line 103 of file Batch.h.

Referenced by BatchFrame::Entry().

wxDateTime Batch::GetLastFileDate  )  [inline]
 

Definition at line 107 of file Batch.h.

Referenced by BatchFrame::Entry().

Project * Batch::GetProject int  index  ) 
 

Returns project at index.

Definition at line 276 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::AddDirToList(), BatchFrame::AddToList(), ProjectListBox::ChangePrefix(), ProjectListBox::Fill(), ProjectListBox::GetSelectedProjectTarget(), BatchFrame::OnButtonAddCommand(), and BatchFrame::OnUpdateListBox().

int Batch::GetProjectCount  ) 
 

Returns number of projects in batch list.

Definition at line 281 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::AddDirToList(), BatchFrame::AddToList(), BatchFrame::ChangePrefix(), ProjectListBox::Fill(), BatchFrame::OnButtonAddCommand(), and BatchFrame::OnUpdateListBox().

int Batch::GetProjectCountByPath wxString  path  ) 
 

Returns number of projects in batch list with the input file path.

Definition at line 286 of file Batch.cpp.

References m_projList, and makefile::path.

int Batch::GetRunningCount  ) 
 

Returns number of projects currently in progress.

Definition at line 299 of file Batch.cpp.

References m_stitchFrames.

Referenced by CancelBatch(), CancelProject(), BatchFrame::OnButtonPause(), BatchFrame::OnButtonResetAll(), BatchFrame::OnButtonSkip(), BatchFrame::OnProcessTerminate(), OnProcessTerminate(), and PauseBatch().

Project::Status Batch::GetStatus int  index  ) 
 

Returns current status of project at index.

Definition at line 304 of file Batch.cpp.

References m_projList, and Project::status.

Referenced by BatchFrame::OnButtonRemoveComplete(), BatchFrame::OnButtonRemoveFromList(), BatchFrame::OnButtonReset(), BatchFrame::OnButtonSkip(), and BatchFrame::OnUpdateListBox().

bool Batch::IsPaused  ) 
 

Returns true if batch execution is currently paused.

Definition at line 322 of file Batch.cpp.

Referenced by BatchFrame::IsPaused(), BatchFrame::OnButtonPause(), and BatchFrame::OnButtonRunBatch().

bool Batch::IsRunning  ) 
 

return true, if batch is running

Definition at line 317 of file Batch.cpp.

Referenced by BatchFrame::IsRunning().

void Batch::ListBatch  ) 
 

Used in console mode.

Prints out all projects and their statuses to the console

Definition at line 327 of file Batch.cpp.

References cout, Project::GetStatusText(), Project::id, m_projList, Project::path, and Project::prefix.

int Batch::LoadBatchFile wxString  file  ) 
 

Clears current batch list and loads projects from batch file.

Definition at line 346 of file Batch.cpp.

References AppendBatchFile(), and ClearBatch().

Referenced by BatchFrame::OnButtonOpenBatch().

int Batch::LoadTemp  ) 
 

Loads temporary batch file.

Definition at line 366 of file Batch.cpp.

References AppendBatchFile().

Referenced by BatchFrame::OnReloadBatch().

bool Batch::NoErrors  ) 
 

Returns true if there are no failed projects in batch.

Definition at line 404 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::OnButtonRemoveComplete(), and OnProcessTerminate().

bool Batch::OnDetect wxString  scriptFile,
int  id
 

called to start detecting

Definition at line 662 of file Batch.cpp.

References RunStitchFrame::DetectProject(), m_stitchFrames, progsAss, and RunStitchFrame::SetProjectId().

Referenced by RunNextInBatch().

void Batch::OnProcessTerminate wxProcessEvent &  event  ) 
 

Called internally when all running processes have completed and need to be removed from running list.

Definition at line 416 of file Batch.cpp.

References AddProjectToBatch(), AllDone(), autostitch, GetIndex(), GetRunningCount(), FailedProject::logfile, m_cancelled, m_clearedInProgress, m_failedProjects, m_paused, m_projList, m_running, m_stitchFrames, NoErrors(), FailedProject::project, RemoveProjectAtIndex(), RunNextInBatch(), saveLog, SaveTemp(), and Project::status.

bool Batch::OnStitch wxString  scriptFile,
wxString  outname,
int  id
 

Called to start stitch of project with input scriptFile.

Definition at line 583 of file Batch.cpp.

References m_stitchFrames, RunStitchFrame::m_stitchPanel, progs, RunStitchPanel::SetOverwrite(), RunStitchFrame::SetProjectId(), and RunStitchFrame::StitchProject().

Referenced by RunNextInBatch().

void Batch::PauseBatch  ) 
 

Pauses and continues batch execution.

Definition at line 688 of file Batch.cpp.

References RunStitchPanel::ContinueStitch(), GetRunningCount(), m_paused, m_projList, m_stitchFrames, RunStitchFrame::m_stitchPanel, and RunStitchPanel::PauseStitch().

Referenced by BatchFrame::OnButtonPause().

void Batch::RemoveProject int  id  ) 
 

Removes project with id from batch list.

Definition at line 722 of file Batch.cpp.

References GetIndex(), and RemoveProjectAtIndex().

void Batch::RemoveProjectAtIndex int  selIndex  ) 
 

Removes project at index from batch list.

Definition at line 735 of file Batch.cpp.

References deleteFiles, and m_projList.

Referenced by BatchFrame::OnButtonRemoveComplete(), BatchFrame::OnButtonRemoveFromList(), OnProcessTerminate(), and RemoveProject().

void Batch::RunBatch  ) 
 

Starts batch execution.

Definition at line 758 of file Batch.cpp.

References m_failedProjects, m_running, and RunNextInBatch().

Referenced by BatchFrame::RunBatch().

void Batch::RunNextInBatch  ) 
 

Starts execution of next waiting project in batch.

Definition at line 773 of file Batch.cpp.

References AllDone(), GetFirstAvailable(), m_projList, m_running, OnDetect(), and OnStitch().

Referenced by OnProcessTerminate(), and RunBatch().

void Batch::SaveBatchFile wxString  file  ) 
 

Saves batch list to file.

Definition at line 867 of file Batch.cpp.

References m_lastFile, m_lastmod, and m_projList.

Referenced by BatchFrame::OnButtonSaveBatch(), and SaveTemp().

void Batch::SaveTemp  ) 
 

Saves batch list to temporary file.

Definition at line 912 of file Batch.cpp.

References SaveBatchFile().

Referenced by BatchFrame::AddDirToList(), BatchFrame::AddToList(), BatchFrame::OnButtonAddCommand(), BatchFrame::OnButtonAddToAssistantQueue(), BatchFrame::OnButtonAddToStitchingQueue(), BatchFrame::OnButtonChangePrefix(), BatchFrame::OnButtonClear(), BatchFrame::OnButtonMoveDown(), BatchFrame::OnButtonMoveUp(), BatchFrame::OnButtonOpenBatch(), BatchFrame::OnButtonRemoveComplete(), BatchFrame::OnButtonRemoveFromList(), BatchFrame::OnButtonReset(), BatchFrame::OnButtonResetAll(), OnProcessTerminate(), and BatchFrame::OnUpdateListBox().

void Batch::SetStatus int  index,
Project::Status  status
 

Used internally to set status of selected project.

Definition at line 937 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::OnButtonReset(), BatchFrame::OnButtonResetAll(), BatchFrame::OnButtonSkip(), and BatchFrame::OnUpdateListBox().

void Batch::ShowOutput bool  isVisible = true  ) 
 

Set visibility of all running projects.

Parameters:
isVisible If true display the project output, otherwise hide it.

Definition at line 955 of file Batch.cpp.

References m_stitchFrames.

Referenced by BatchFrame::OnCheckVerbose(), BatchFrame::OnMinimize(), and BatchFrame::UpdateBatchVerboseStatus().

void Batch::SwapProject int  index  ) 
 

Swaps position in batch of project at index with project at index+1.

Definition at line 949 of file Batch.cpp.

References m_projList.

Referenced by BatchFrame::SwapProject().


Member Data Documentation

bool Batch::autoremove
 

Definition at line 60 of file Batch.h.

Referenced by BatchFrame::OnCheckAutoRemove(), and BatchFrame::PropagateDefaults().

bool Batch::autostitch
 

Definition at line 59 of file Batch.h.

Referenced by BatchFrame::OnCheckAutoStitch(), OnProcessTerminate(), and BatchFrame::PropagateDefaults().

bool Batch::deleteFiles
 

Definition at line 55 of file Batch.h.

Referenced by RemoveProjectAtIndex().

bool Batch::m_cancelled [private]
 

Definition at line 169 of file Batch.h.

Referenced by CancelBatch(), and OnProcessTerminate().

bool Batch::m_clearedInProgress [private]
 

Definition at line 172 of file Batch.h.

Referenced by ClearBatch(), and OnProcessTerminate().

wxConfigBase* Batch::m_config [private]
 

Definition at line 159 of file Batch.h.

std::vector<FailedProject> Batch::m_failedProjects [private]
 

Definition at line 175 of file Batch.h.

Referenced by GetFailedProjectLog(), GetFailedProjectName(), GetFailedProjectsCount(), OnProcessTerminate(), and RunBatch().

wxString Batch::m_lastFile [private]
 

Definition at line 165 of file Batch.h.

Referenced by AppendBatchFile(), and SaveBatchFile().

wxDateTime Batch::m_lastmod [private]
 

Definition at line 166 of file Batch.h.

Referenced by AppendBatchFile(), and SaveBatchFile().

bool Batch::m_paused [private]
 

Definition at line 170 of file Batch.h.

Referenced by CancelProject(), OnProcessTerminate(), and PauseBatch().

ProjectArray Batch::m_projList [private]
 

Definition at line 161 of file Batch.h.

Referenced by AddAppToBatch(), AddProjectToBatch(), AllDone(), AppendBatchFile(), ChangePrefix(), ClearBatch(), CompareProjectsInLists(), GetFirstAvailable(), GetIndex(), GetProject(), GetProjectCount(), GetProjectCountByPath(), GetStatus(), ListBatch(), NoErrors(), OnProcessTerminate(), PauseBatch(), RemoveProjectAtIndex(), RunNextInBatch(), SaveBatchFile(), SetStatus(), and SwapProject().

bool Batch::m_running [private]
 

Definition at line 171 of file Batch.h.

Referenced by CancelBatch(), CancelProject(), OnProcessTerminate(), RunBatch(), and RunNextInBatch().

FrameArray Batch::m_stitchFrames [private]
 

Definition at line 163 of file Batch.h.

Referenced by CancelProject(), ClearBatch(), CompareProjectsInLists(), GetRunningCount(), OnDetect(), OnProcessTerminate(), OnStitch(), PauseBatch(), and ShowOutput().

bool Batch::overwrite
 

Definition at line 57 of file Batch.h.

Referenced by BatchFrame::OnCheckOverwrite(), and BatchFrame::PropagateDefaults().

bool Batch::parallel
 

Definition at line 54 of file Batch.h.

Referenced by BatchFrame::OnCheckParallel(), and BatchFrame::PropagateDefaults().

PTPrograms Batch::progs [private]
 

Definition at line 178 of file Batch.h.

Referenced by OnStitch().

AssistantPrograms Batch::progsAss [private]
 

Definition at line 179 of file Batch.h.

Referenced by OnDetect().

bool Batch::saveLog
 

Definition at line 61 of file Batch.h.

Referenced by BatchFrame::OnCheckSaveLog(), and OnProcessTerminate().

bool Batch::shutdown
 

Definition at line 56 of file Batch.h.

Referenced by BatchFrame::OnCheckShutdown(), and BatchFrame::PropagateDefaults().

bool Batch::verbose
 

Definition at line 58 of file Batch.h.

Referenced by BatchFrame::OnCheckVerbose(), BatchFrame::OnMinimize(), BatchFrame::PropagateDefaults(), BatchFrame::SetInternalVerbose(), and BatchFrame::UpdateBatchVerboseStatus().


The documentation for this class was generated from the following files:
Generated on Sat Aug 30 01:25:44 2014 for Hugintrunk by  doxygen 1.3.9.1