The Tracker contains a thread-safe list of unique Structures. More...
#include <globalsearch/tracker.h>
Signals | |
void | newStructureAdded (GlobalSearch::Structure *s) |
void | structureCountChanged (int c) |
Public Member Functions | |
Tracker (QObject *parent=0) | |
virtual | ~Tracker () |
void | lockForRead () |
void | lockForWrite () |
void | unlock () |
QReadWriteLock * | rwLock () |
QList< Structure * > * | list () |
Structure * | at (int i) |
bool | append (QList< Structure * > s) |
bool | append (Structure *s) |
bool | popFirst (Structure *&s) |
bool | remove (Structure *s) |
bool | contains (Structure *s) |
int | size () |
void | reset () |
void | deleteAllStructures () |
The Tracker contains a thread-safe list of unique Structures.
In simplest terms, the Tracker class is a list of Structures. It provides convenience functions and signals to facilitate access.
The Tracker can be used for storage of all Structures generated in a search, or as a FIFO buffer for pending operations by using the append() and popFirst() functions.
If you wish to not use the convenience functions, it is possible to access the list of Structures through list() and the mutex through rwLock(), lockForRead(), lockForWrite(), and unlock().
Definition at line 43 of file tracker.h.
GlobalSearch::Tracker::Tracker | ( | QObject * | parent = 0 |
) |
GlobalSearch::Tracker::~Tracker | ( | ) | [virtual] |
bool GlobalSearch::Tracker::append | ( | Structure * | s | ) |
s | A Structures to append to the Tracker |
Definition at line 49 of file tracker.cpp.
References newStructureAdded(), and structureCountChanged().
bool GlobalSearch::Tracker::append | ( | QList< Structure * > | s | ) |
s | A list of Structures to append to the Tracker |
Definition at line 40 of file tracker.cpp.
Referenced by GlobalSearch::QueueManager::appendToJobStartTracker(), GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::QueueManager::startJob(), GlobalSearch::QueueManager::startPreoptimization(), and GlobalSearch::QueueManager::unlockForNaming().
Structure* GlobalSearch::Tracker::at | ( | int | i | ) | [inline] |
bool GlobalSearch::Tracker::contains | ( | Structure * | s | ) |
Test if a Structure is in the Tracker's list.
s | The Structure to check. |
Definition at line 76 of file tracker.cpp.
void GlobalSearch::Tracker::deleteAllStructures | ( | ) |
Remove and delete from memory all Structures from the list.
Definition at line 90 of file tracker.cpp.
References structureCountChanged().
Referenced by GlobalSearch::OptBase::reset(), and GlobalSearch::AbstractDialog::resumeSession_().
QList<Structure*>* GlobalSearch::Tracker::list | ( | ) | [inline] |
Definition at line 84 of file tracker.h.
Referenced by GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::QueueManager::checkRunning(), GlobalSearch::QueueManager::getAllDuplicateStructures(), GlobalSearch::QueueManager::getAllOptimizedStructures(), GlobalSearch::QueueManager::getAllPreoptimizingStructures(), GlobalSearch::QueueManager::getAllRunningStructures(), GlobalSearch::QueueManager::getAllStructures(), GlobalSearch::OptBase::save(), and GlobalSearch::QueueManager::~QueueManager().
void GlobalSearch::Tracker::lockForRead | ( | ) | [inline] |
Sets a read lock on the Tracker's mutex.
Definition at line 64 of file tracker.h.
Referenced by GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::QueueManager::getAllDuplicateStructures(), GlobalSearch::QueueManager::getAllOptimizedStructures(), GlobalSearch::QueueManager::getAllRunningStructures(), GlobalSearch::QueueManager::getAllStructures(), and GlobalSearch::QueueManager::lockForNaming().
void GlobalSearch::Tracker::lockForWrite | ( | ) | [inline] |
Sets a write lock on the Tracker's mutex.
Definition at line 69 of file tracker.h.
Referenced by GlobalSearch::QueueManager::addManualStructureRequest(), GlobalSearch::QueueManager::appendToJobStartTracker(), GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::OptBase::reset(), GlobalSearch::AbstractDialog::resumeSession_(), GlobalSearch::QueueManager::startJob(), GlobalSearch::QueueManager::startPreoptimization(), GlobalSearch::QueueManager::stopJob(), GlobalSearch::QueueManager::unlockForNaming(), and ~Tracker().
void GlobalSearch::Tracker::newStructureAdded | ( | GlobalSearch::Structure * | s | ) | [signal] |
bool GlobalSearch::Tracker::popFirst | ( | Structure *& | s | ) |
Remove and return the first Structure in the Tracker's list. Useful for creating a FIFO buffer.
s | Becomes the Structure at index 0 of the Tracker's list. |
Definition at line 59 of file tracker.cpp.
References structureCountChanged().
Referenced by GlobalSearch::QueueManager::startJob(), and GlobalSearch::QueueManager::startPreoptimization().
bool GlobalSearch::Tracker::remove | ( | Structure * | s | ) |
Remove a Structure in the Tracker's list.
s | The Structure to remove. |
Definition at line 68 of file tracker.cpp.
References structureCountChanged().
Referenced by GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::QueueManager::senderHasFinishedPreoptimization(), and GlobalSearch::QueueManager::stopJob().
void GlobalSearch::Tracker::reset | ( | ) |
Remove all Structures from the list.
Definition at line 85 of file tracker.cpp.
References structureCountChanged().
Referenced by GlobalSearch::OptBase::reset().
QReadWriteLock* GlobalSearch::Tracker::rwLock | ( | ) | [inline] |
Definition at line 79 of file tracker.h.
Referenced by GlobalSearch::QueueManager::getAllPreoptimizingStructures(), and GlobalSearch::OptBase::save().
int GlobalSearch::Tracker::size | ( | ) |
Definition at line 81 of file tracker.cpp.
Referenced by GlobalSearch::QueueManager::checkPopulation().
void GlobalSearch::Tracker::structureCountChanged | ( | int | c | ) | [signal] |
Signal emitted when then number of Structures in the Tracker changes.
Referenced by append(), deleteAllStructures(), popFirst(), remove(), and reset().
void GlobalSearch::Tracker::unlock | ( | ) | [inline] |
Unlock the Tracker's mutex.
Definition at line 74 of file tracker.h.
Referenced by GlobalSearch::QueueManager::addManualStructureRequest(), GlobalSearch::QueueManager::appendToJobStartTracker(), GlobalSearch::QueueManager::checkPopulation(), GlobalSearch::QueueManager::getAllDuplicateStructures(), GlobalSearch::QueueManager::getAllOptimizedStructures(), GlobalSearch::QueueManager::getAllRunningStructures(), GlobalSearch::QueueManager::getAllStructures(), GlobalSearch::OptBase::reset(), GlobalSearch::AbstractDialog::resumeSession_(), GlobalSearch::QueueManager::startJob(), GlobalSearch::QueueManager::startPreoptimization(), GlobalSearch::QueueManager::stopJob(), and GlobalSearch::QueueManager::unlockForNaming().