1 #include "CubeDataThreadTester.h" 7 #include <QReadWriteLock> 11 #include "CubeDataThread.h" 50 SLOT(ReadCube(
int,
int,
int,
int,
int,
int,
void *)));
55 SLOT(ReadWriteCube(
int,
int,
int,
int,
int,
int,
void *)));
74 QThread::yieldCurrentThread();
94 cout <<
"=============== Testing Basic Read ===============" << endl;
106 cout <<
"=============== Testing Multiple Non-Conflicting Cube Reads " <<
107 "===============" << endl;
121 cout <<
"=============== Testing Exact Overlap Cube Reads ===============" 136 cout <<
"=============== Testing Basic R/W ===============" << endl << endl;
149 cout <<
"=============== Testing Multiple Non-Conflicting Cube R/W " <<
150 "===============" << endl << endl;
167 cout <<
"=============== Testing Conflicting Cube R/W ===============" 181 cout <<
" Breaking Deadlock From Test 3" << endl;
187 cout <<
" Notify done with first brick" << endl;
201 cout <<
"=============== Testing Change Notification ===============" 224 cout <<
" CubeDataThreadTester::ReadBrick" << endl;
226 cout <<
" Requester is me? " << ((
this == requester) ?
"Yes" :
"No")
229 if(
this != requester)
return;
231 cout <<
" Data:" << endl;
233 for(
int i = 0; i < data->
size(); i++) {
234 if(i == 0) cout <<
" ";
235 if(i % 6 == 6 - 1 && i != data->
size() - 1) {
236 cout << data->
at(i) << endl <<
" ";
238 else if(i == data->
size() - 1) {
239 cout << data->
at(i) << endl;
242 cout << data->
at(i) <<
"\t";
248 cout <<
" Notify done with this brick" << endl;
252 cout <<
" Notify done with first brick" << endl;
260 cache.first = cubeId;
279 cout <<
" CubeDataThreadTester::ReadWriteBrick" << endl;
287 cout <<
" Changing Brick : Index 0 Becoming 5" << endl;
290 cout <<
" Old Data: " << endl;
292 for(
int i = 0; i < data->
size(); i++) {
293 if(i == 0) cout <<
" ";
294 if(i % 6 == 6 - 1 && i != data->
size() - 1) {
295 cout << data->
at(i) << endl <<
" ";
297 else if(i == data->
size() - 1) {
298 cout << data->
at(i) << endl;
301 cout << data->
at(i) <<
"\t";
307 cout <<
" New Data: " << endl;
309 for(
int i = 0; i < data->
size(); i++) {
310 if(i == 0) cout <<
" ";
311 if(i % 6 == 6 - 1 && i != data->
size() - 1) {
312 cout << data->
at(i) << endl <<
" ";
314 else if(i == data->
size() - 1) {
315 cout << data->
at(i) << endl;
318 cout << data->
at(i) <<
"\t";
325 cout <<
" Notify done with this brick" << endl;
329 cout <<
" Notify done with first brick" << endl;
337 cache.first = cubeId;
355 cout <<
" CubeDataThreadTester::BrickChanged" << endl;
356 cout <<
" Data:" << endl;
358 for(
int i = 0; i < data->
size(); i++) {
359 if(i == 0) cout <<
" ";
360 if(i % 6 == 6 - 1 && i != data->
size() - 1) {
361 cout << data->
at(i) << endl <<
" ";
363 else if(i == data->
size() - 1) {
364 cout << data->
at(i) << endl;
367 cout << data->
at(i) <<
"\t";
CubeDataThread * p_cubeDataThread
The data thread being tested.
void WriteCubeTest3BreakDeadlock()
This test breaks the deadlock caused by the third write test.
void ReadBrick(void *requester, int cubeId, const Isis::Brick *data)
This is called when a brick is read.
void RequestReadCube(int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller)
Ask for a brick for reading.
Buffer for containing a three dimensional section of an image.
double at(const int index) const
Returns the value in the shape buffer at the given index.
Namespace for the standard library.
bool p_notifyDone
True if we will notify done on the next brick received for R/W.
void ReadCubeTest(int)
This tests a basic read.
void NotifyChangeTest(int)
This test tests this automatic change notifications.
int size() const
Returns the total number of pixels in the shape buffer.
void BrickChanged(int cubeId, const Isis::Brick *data)
This is called when a brick is written.
void ReadWriteBrick(void *requester, int cubeId, Isis::Brick *data)
This is called when a brick is given for R/W.
void WriteCubeTest2(int, int)
This tests two non-conflicting writes.
QVector< QPair< int, const Isis::Brick * > > * p_cachedDoneBricks
A list of bricks we haven't send the done signal for.
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 ReadCubeTest3(int)
This tests an overlapping read.
void WriteCubeTest3(int)
This tests two conflicting* writes.
Encapsulation of Cube I/O with Change Notifications.
void AddChangeListener()
You must call this method after connecting to the BrickChanged signal, otherwise you are not guarante...
void ReadCubeTest2(int, int)
This tests two basic reads with no conflicts.
int p_numTestsDone
The count of completed tests.
void run()
This thread is centered completely around its event loop.
void Connect()
This connects this class' signals and slots with CubeDataThread's signals and slots.
void NotifyDoneWithData(int, const Isis::Brick *)
Let the cube data thread know we're no longer working with a particular brick.
virtual ~CubeDataThreadTester()
This cleans up the cube data thread.
bool p_execStarted
True if this thread is started.
Namespace for ISIS/Bullet specific routines.
void WriteCubeTest(int)
This tests a basic write.