GlobalSearch::LocalQueueInterface Class Reference

Interface for running jobs locally. More...

#include <globalsearch/local.h>

Inheritance diagram for GlobalSearch::LocalQueueInterface:
GlobalSearch::QueueInterface

List of all members.

Public Slots

virtual bool writeFiles (Structure *s, const QHash< QString, QString > &files) const
virtual bool prepareForStructureUpdate (Structure *s) const
virtual bool checkIfFileExists (Structure *s, const QString &filename, bool *exists)
virtual bool fetchFile (Structure *s, const QString &filename, QString *contents) const
virtual bool grepFile (Structure *s, const QString &matchText, const QString &filename, QStringList *matches=0, int *exitcode=0, const bool caseSensitive=true) const

Public Member Functions

 LocalQueueInterface (OptBase *parent, const QString &settingFile="")
virtual ~LocalQueueInterface ()

Detailed Description

Interface for running jobs locally.

Author:
David C. Lonie

Definition at line 30 of file local.h.


Constructor & Destructor Documentation

GlobalSearch::LocalQueueInterface::LocalQueueInterface ( OptBase parent,
const QString &  settingFile = "" 
) [explicit]

Constructor

Parameters:
parent OptBase parent
settingFile Filename from which to initialize settings.

Definition at line 32 of file local.cpp.

References GlobalSearch::QueueInterface::m_hasDialog, and GlobalSearch::QueueInterface::m_idString.

GlobalSearch::LocalQueueInterface::~LocalQueueInterface (  )  [virtual]

Destructor

Definition at line 40 of file local.cpp.


Member Function Documentation

bool GlobalSearch::LocalQueueInterface::checkIfFileExists ( Structure s,
const QString &  filename,
bool *  exists 
) [virtual, slot]

Check if the file filename exists in the working directory of Structure s and store the result in exists.

Note:
This function uses the argument exists to report whether or not the file exists. The return value indicates whether the file check was performed without errors (e.g. network errors).
Returns:
True if the test encountered no errors, false otherwise.

Implements GlobalSearch::QueueInterface.

Definition at line 91 of file local.cpp.

bool GlobalSearch::LocalQueueInterface::fetchFile ( Structure s,
const QString &  filename,
QString *  contents 
) const [virtual, slot]

Retrieve the contents of the file filename for Structure s as a QString contents.

Returns:
True on success, false otherwise.

Implements GlobalSearch::QueueInterface.

Definition at line 101 of file local.cpp.

Referenced by grepFile().

bool GlobalSearch::LocalQueueInterface::grepFile ( Structure s,
const QString &  matchText,
const QString &  filename,
QStringList *  matches = 0,
int *  exitcode = 0,
const bool  caseSensitive = true 
) const [virtual, slot]

Grep through the file filename for Structure s's working directory, looking for matchText. The list of matches is returned in the QStringList matches and the exit status is returned as exitcode.

Possible exitcodes:

  • 0: Matches were found, execution successful
  • 1: No matches found, execution successful
  • 2: Execution unsuccessful
Parameters:
s Structure of interest
matchText Text to match
filename Name of file to grep
matches List of matches (return)
exitcode Exit code of grep (see details) (return)
caseSensitive If true, match case. Otherwise, perform case-insensitive search (e.g. grep -i) Default is true.
Returns:
True on success, false otherwise.
Note:
There are two types of failure possible here: Either the exitcode can be 2 or the function can return false. If the exitcode is 2, then grep failed to execute. If false, then there was a failure in the interface code, likely a communication error with a remote server.
On local queue interface, grep is not actually used and the exit code behavior is emulated.

Implements GlobalSearch::QueueInterface.

Definition at line 115 of file local.cpp.

References fetchFile().

bool GlobalSearch::LocalQueueInterface::prepareForStructureUpdate ( Structure s  )  const [virtual, slot]

Perform any work needed before calling Optimizer::update. This function mainly exists for RemoteQueue classes to copy files back from the server, but may be used for other purposes. It is guaranteed to be called by Optimizer before updating.

Parameters:
s The structure that is to be updated.
Returns:
True on success, false otherwise.

Implements GlobalSearch::QueueInterface.

Definition at line 85 of file local.cpp.

bool GlobalSearch::LocalQueueInterface::writeFiles ( Structure s,
const QHash< QString, QString > &  files 
) const [virtual, slot]

Write the input files in the hash files to the appropriate location for Structure s.

Parameters:
s Structure of interest
files Key: filename, Value: text.
Note:
The filenames in files must not be absolute, but relative to the structure's working directory.
Returns:
True on success, false otherwise.

Implements GlobalSearch::QueueInterface.

Definition at line 45 of file local.cpp.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Enumerator
Generated on Mon Jul 16 14:40:04 2012 for GlobalSearch by  doxygen 1.6.3