USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::CubeDataThreadTester Class Reference

#include <CubeDataThreadTester.h>

Inheritance diagram for Isis::CubeDataThreadTester:
Inheritance graph
Collaboration diagram for Isis::CubeDataThreadTester:
Collaboration graph

Public Slots

void ReadBrick (void *requester, int cubeId, const Isis::Brick *data)
 This is called when a brick is read.
void ReadWriteBrick (void *requester, int cubeId, Isis::Brick *data)
 This is called when a brick is given for R/W.
void BrickChanged (int cubeId, const Isis::Brick *data)
 This is called when a brick is written.

Signals

void RequestReadCube (int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller)
 Ask for a brick for reading.
void RequestReadWriteCube (int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller)
 Ask for a brick for reading and writing.
void NotifyDoneWithData (int, const Isis::Brick *)
 Let the cube data thread know we're no longer working with a particular brick.

Public Member Functions

 CubeDataThreadTester (CubeDataThread *)
 This initializes a CubeDataThreadTester.
virtual ~CubeDataThreadTester ()
 This cleans up the cube data thread.
int NumberOfTestsDone ()
 Returns the number of tests done (testing methods count as several)
CubeDataThreadDataThread ()
 Returns the cube data thread being tested.
void Connect ()
 This connects this class' signals and slots with CubeDataThread's signals and slots.
void ReadCubeTest (int)
 This tests a basic read.
void ReadCubeTest2 (int, int)
 This tests two basic reads with no conflicts.
void ReadCubeTest3 (int)
 This tests an overlapping read.
void WriteCubeTest (int)
 This tests a basic write.
void WriteCubeTest2 (int, int)
 This tests two non-conflicting writes.
void WriteCubeTest3 (int)
 This tests two conflicting* writes.
void WriteCubeTest3BreakDeadlock ()
 This test breaks the deadlock caused by the third write test.
void NotifyChangeTest (int)
 This test tests this automatic change notifications.

Private Member Functions

void run ()
 This thread is centered completely around its event loop.

Private Attributes

int p_numTestsDone
 The count of completed tests.
CubeDataThreadp_cubeDataThread
 The data thread being tested.
bool p_execStarted
 True if this thread is started.
bool p_notifyDone
 True if we will notify done on the next brick received for R/W.
QVector< QPair< int, const
Isis::Brick * > > * 
p_cachedDoneBricks
 A list of bricks we haven't send the done signal for.

Detailed Description

Author
????-??-?? Steven Lambright

Definition at line 18 of file CubeDataThreadTester.h.

Constructor & Destructor Documentation

Isis::CubeDataThreadTester::CubeDataThreadTester ( CubeDataThread testObject)

This initializes a CubeDataThreadTester.

The CubeDataThread given is the subject of the tests.

Parameters
testObjectThe CubeDataThread instance to be tested

Definition at line 27 of file CubeDataThreadTester.cpp.

References p_cachedDoneBricks, p_cubeDataThread, p_execStarted, p_notifyDone, and p_numTestsDone.

Isis::CubeDataThreadTester::~CubeDataThreadTester ( )
virtual

This cleans up the cube data thread.

Definition at line 72 of file CubeDataThreadTester.cpp.

References p_execStarted.

Member Function Documentation

void Isis::CubeDataThreadTester::BrickChanged ( int  cubeId,
const Isis::Brick data 
)
slot

This is called when a brick is written.

Parameters
cubeIdCube identifier
dataBrick of data read

Definition at line 354 of file CubeDataThreadTester.cpp.

References Isis::Buffer::at(), NotifyDoneWithData(), p_numTestsDone, and Isis::Buffer::size().

Referenced by NotifyChangeTest().

void Isis::CubeDataThreadTester::Connect ( )

This connects this class' signals and slots with CubeDataThread's signals and slots.

Definition at line 46 of file CubeDataThreadTester.cpp.

References NotifyDoneWithData(), p_cubeDataThread, ReadBrick(), ReadWriteBrick(), RequestReadCube(), and RequestReadWriteCube().

CubeDataThread* Isis::CubeDataThreadTester::DataThread ( )
inline

Returns the cube data thread being tested.

Definition at line 31 of file CubeDataThreadTester.h.

References p_cubeDataThread.

void Isis::CubeDataThreadTester::NotifyChangeTest ( int  cubeId)

This test tests this automatic change notifications.

This performs 2 tests.

Parameters
cubeIdThe identifier given by the data thread for the file to test

Definition at line 200 of file CubeDataThreadTester.cpp.

References Isis::CubeDataThread::AddChangeListener(), BrickChanged(), p_cubeDataThread, and RequestReadWriteCube().

void Isis::CubeDataThreadTester::NotifyDoneWithData ( int  ,
const Isis::Brick  
)
signal

Let the cube data thread know we're no longer working with a particular brick.

Referenced by BrickChanged(), Connect(), ReadBrick(), ReadWriteBrick(), and WriteCubeTest3BreakDeadlock().

int Isis::CubeDataThreadTester::NumberOfTestsDone ( )
inline

Returns the number of tests done (testing methods count as several)

Definition at line 26 of file CubeDataThreadTester.h.

References p_numTestsDone.

void Isis::CubeDataThreadTester::ReadBrick ( void *  requester,
int  cubeId,
const Isis::Brick data 
)
slot

This is called when a brick is read.

Parameters
requesterPointer to requesting class
cubeIdCube identifier
dataBrick of data read

Definition at line 222 of file CubeDataThreadTester.cpp.

References Isis::Buffer::at(), NotifyDoneWithData(), p_cachedDoneBricks, p_notifyDone, p_numTestsDone, and Isis::Buffer::size().

Referenced by Connect().

void Isis::CubeDataThreadTester::ReadCubeTest ( int  cubeId)

This tests a basic read.

This performs 1 test.

Parameters
cubeIdThe identifier given by the data thread for the file to test

Definition at line 93 of file CubeDataThreadTester.cpp.

References RequestReadCube().

void Isis::CubeDataThreadTester::ReadCubeTest2 ( int  cubeId1,
int  cubeId2 
)

This tests two basic reads with no conflicts.

This performs 2 tests.

Parameters
cubeId1Cube for first read
cubeId2Cube for second read

Definition at line 105 of file CubeDataThreadTester.cpp.

References p_notifyDone, and RequestReadCube().

void Isis::CubeDataThreadTester::ReadCubeTest3 ( int  cubeId)

This tests an overlapping read.

This performs 2 tests.

Parameters
cubeIdThe identifier given by the data thread for the file to test

Definition at line 120 of file CubeDataThreadTester.cpp.

References p_notifyDone, and RequestReadCube().

void Isis::CubeDataThreadTester::ReadWriteBrick ( void *  requester,
int  cubeId,
Isis::Brick data 
)
slot

This is called when a brick is given for R/W.

Parameters
requesterPointer to requesting class
cubeIdCube identifier
dataBrick of data read

Definition at line 277 of file CubeDataThreadTester.cpp.

References Isis::Buffer::at(), NotifyDoneWithData(), p_cachedDoneBricks, p_notifyDone, p_numTestsDone, and Isis::Buffer::size().

Referenced by Connect().

void Isis::CubeDataThreadTester::RequestReadCube ( int  cubeId,
int  startSample,
int  startLine,
int  endSample,
int  endLine,
int  band,
void *  caller 
)
signal

Ask for a brick for reading.

Parameters
cubeIdCube identifier
startSampleBrick starting sample
startLineBrick starting line
endSampleBrick ending sample
endLineBrick ending line
bandBrick band
callerA this pointer

Referenced by Connect(), ReadCubeTest(), ReadCubeTest2(), ReadCubeTest3(), and WriteCubeTest().

void Isis::CubeDataThreadTester::RequestReadWriteCube ( int  cubeId,
int  startSample,
int  startLine,
int  endSample,
int  endLine,
int  band,
void *  caller 
)
signal

Ask for a brick for reading and writing.

Parameters
cubeIdCube identifier
startSampleBrick starting sample
startLineBrick starting line
endSampleBrick ending sample
endLineBrick ending line
bandBrick band
callerA this pointer

Referenced by Connect(), NotifyChangeTest(), WriteCubeTest(), WriteCubeTest2(), and WriteCubeTest3().

void Isis::CubeDataThreadTester::run ( )
private

This thread is centered completely around its event loop.

returns the cube id

Definition at line 83 of file CubeDataThreadTester.cpp.

References p_execStarted.

void Isis::CubeDataThreadTester::WriteCubeTest ( int  cubeId)

This tests a basic write.

This performs 2 tests.

Parameters
cubeIdThe identifier given by the data thread for the file to test

Definition at line 135 of file CubeDataThreadTester.cpp.

References RequestReadCube(), and RequestReadWriteCube().

void Isis::CubeDataThreadTester::WriteCubeTest2 ( int  cubeId1,
int  cubeId2 
)

This tests two non-conflicting writes.

This performs 2 tests.

Parameters
cubeId1Cube for first write
cubeId2Cube for second write

Definition at line 148 of file CubeDataThreadTester.cpp.

References p_notifyDone, and RequestReadWriteCube().

void Isis::CubeDataThreadTester::WriteCubeTest3 ( int  cubeId)

This tests two conflicting* writes.

This causes a deadlock!

This performs a test, deadlocks, and once the deadlock is broken (via WriteCubeTest3BreakDeadlock), finishes another test.

Parameters
cubeIdThe identifier given by the data thread for the file to test

Definition at line 166 of file CubeDataThreadTester.cpp.

References p_notifyDone, and RequestReadWriteCube().

void Isis::CubeDataThreadTester::WriteCubeTest3BreakDeadlock ( )

This test breaks the deadlock caused by the third write test.

Definition at line 180 of file CubeDataThreadTester.cpp.

References NotifyDoneWithData(), and p_cachedDoneBricks.

Member Data Documentation

QVector< QPair<int, const Isis::Brick *> >* Isis::CubeDataThreadTester::p_cachedDoneBricks
private

A list of bricks we haven't send the done signal for.

Definition at line 104 of file CubeDataThreadTester.h.

Referenced by CubeDataThreadTester(), ReadBrick(), ReadWriteBrick(), and WriteCubeTest3BreakDeadlock().

CubeDataThread* Isis::CubeDataThreadTester::p_cubeDataThread
private

The data thread being tested.

Definition at line 95 of file CubeDataThreadTester.h.

Referenced by Connect(), CubeDataThreadTester(), DataThread(), and NotifyChangeTest().

bool Isis::CubeDataThreadTester::p_execStarted
private

True if this thread is started.

Definition at line 98 of file CubeDataThreadTester.h.

Referenced by CubeDataThreadTester(), run(), and ~CubeDataThreadTester().

bool Isis::CubeDataThreadTester::p_notifyDone
private

True if we will notify done on the next brick received for R/W.

Definition at line 101 of file CubeDataThreadTester.h.

Referenced by CubeDataThreadTester(), ReadBrick(), ReadCubeTest2(), ReadCubeTest3(), ReadWriteBrick(), WriteCubeTest2(), and WriteCubeTest3().

int Isis::CubeDataThreadTester::p_numTestsDone
private

The count of completed tests.

Definition at line 92 of file CubeDataThreadTester.h.

Referenced by BrickChanged(), CubeDataThreadTester(), NumberOfTestsDone(), ReadBrick(), and ReadWriteBrick().


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