Isis 3 Programmer Reference
CubeDataThread.h
1 #ifndef CubeDataThread_h
2 #define CubeDataThread_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <QThread>
11 
12 template<typename T> class QList;
13 
14 template<typename A, typename B> struct QPair;
15 template<typename A, typename B> class QMap;
16 
17 class QReadWriteLock;
18 class QMutex;
19 
20 namespace Isis {
21  class Cube;
22  class FileName;
23  class Brick;
24  class UniversalGroundMap;
25 
59  class CubeDataThread : public QThread {
60  Q_OBJECT
61 
62  public:
64  virtual ~CubeDataThread();
65 
66  int AddCube(const FileName &fileName,
67  bool mustOpenReadWrite = false);
68  int AddCube(Cube *cube);
69 
70  void RemoveCube(int cubeId);
71 
72  void AddChangeListener();
73  void RemoveChangeListener();
74 
75  int BricksInMemory();
76 
77  UniversalGroundMap *GetUniversalGroundMap(int cubeId) const;
78 
79  const Cube *GetCube(int cubeId) const;
80  int FindCubeId(const Cube *) const;
81 
82  public slots:
83  void ReadCube(int cubeId, int startSample, int startLine,
84  int endSample, int endLine, int band, void *caller);
85  void ReadWriteCube(int cubeId, int startSample, int startLine,
86  int endSample, int endLine, int band, void *caller);
87 
88  void DoneWithData(int, const Isis::Brick *);
89 
90  signals:
91 
103  void ReadReady(void *requester, int cubeId, const Isis::Brick *data);
104 
116  void ReadWriteReady(void *requester, int cubeId, Isis::Brick *data);
117 
130  void BrickChanged(int cubeId, const Isis::Brick *data);
131 
132  private:
142 
153 
154  int OverlapIndex(const Brick *initial, int cubeId,
155  int instanceNum, bool &exact);
156 
157  void GetCubeData(int cubeId, int ss, int sl, int es, int el, int band,
158  void *caller, bool sharedLock);
159 
160  void AcquireLock(QReadWriteLock *lockObject, bool readLock);
161 
162  bool FreeBrick(int brickIndex);
163 
172 
175 
200 
203 
206 
208  unsigned int p_currentId;
209 
212 
217  unsigned int p_currentLocksWaiting;
218  };
219 
220 };
221 
222 
223 #endif
Isis::CubeDataThread::p_currentLocksWaiting
unsigned int p_currentLocksWaiting
Number of locks being attempted that re-entered the event loop.
Definition: CubeDataThread.h:217
Isis::CubeDataThread::~CubeDataThread
virtual ~CubeDataThread()
This class is a self-contained thread, so normally it would be bad to simply delete it.
Definition: CubeDataThread.cpp:66
Isis::CubeDataThread::FreeBrick
bool FreeBrick(int brickIndex)
This is used internally to delete bricks when possible.
Definition: CubeDataThread.cpp:684
Isis::UniversalGroundMap
Universal Ground Map.
Definition: UniversalGroundMap.h:69
Isis::CubeDataThread::p_stopping
bool p_stopping
This is set to help the shutdown process when deleted.
Definition: CubeDataThread.h:211
Isis::CubeDataThread::DoneWithData
void DoneWithData(int, const Isis::Brick *)
When done processing with a brick (reading or writing) this slot needs to be signalled to free locks ...
Definition: CubeDataThread.cpp:587
Isis::CubeDataThread::CubeDataThread
CubeDataThread()
This constructs a CubeDataThread().
Definition: CubeDataThread.cpp:35
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::CubeDataThread::ReadWriteCube
void ReadWriteCube(int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller)
This slot should be connected to and upon receiving a signal it will begin the necessary cube I/O to ...
Definition: CubeDataThread.cpp:462
Isis::CubeDataThread::CubeDataThread
CubeDataThread(const CubeDataThread &cdt)
Assigning CubeDataThreads to eachother is bad, so this has been intentionally not implemented!
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::CubeDataThread::p_managedCubes
QMap< int, QPair< bool, Cube * > > * p_managedCubes
This is a list of the opened cubes.
Definition: CubeDataThread.h:171
Isis::CubeDataThread::p_currentId
unsigned int p_currentId
This is the unique id counter for cubes.
Definition: CubeDataThread.h:208
Isis::CubeDataThread::OverlapIndex
int OverlapIndex(const Brick *initial, int cubeId, int instanceNum, bool &exact)
This is a searching method used to identify overlapping data already in memory.
Definition: CubeDataThread.cpp:489
Isis::CubeDataThread::AcquireLock
void AcquireLock(QReadWriteLock *lockObject, bool readLock)
This method is exclusively used to acquire locks.
Definition: CubeDataThread.cpp:371
Isis::Brick
Buffer for containing a three dimensional section of an image.
Definition: Brick.h:45
Isis::CubeDataThread
Encapsulation of Cube I/O with Change Notifications.
Definition: CubeDataThread.h:59
Isis::CubeDataThread::FindCubeId
int FindCubeId(const Cube *) const
Given a Cube pointer, return the cube ID associated with it.
Definition: CubeDataThread.cpp:351
Isis::CubeDataThread::AddChangeListener
void AddChangeListener()
You must call this method after connecting to the BrickChanged signal, otherwise you are not guarante...
Definition: CubeDataThread.cpp:230
Isis::CubeDataThread::BrickChanged
void BrickChanged(int cubeId, const Isis::Brick *data)
DO NOT CONNECT TO THIS SIGNAL WITHOUT CALLING AddChangeListener().
Isis::CubeDataThread::GetCube
const Cube * GetCube(int cubeId) const
This returns a constant pointer to a Cube at the given Cube ID.
Definition: CubeDataThread.cpp:767
Isis::CubeDataThread::AddCube
int AddCube(const FileName &fileName, bool mustOpenReadWrite=false)
This method is designed to be callable from any thread before data is requested, though no known side...
Definition: CubeDataThread.cpp:125
Isis::CubeDataThread::p_managedDataSources
QList< int > * p_managedDataSources
This is the associated cube ID with each brick.
Definition: CubeDataThread.h:202
Isis::CubeDataThread::operator=
const CubeDataThread & operator=(CubeDataThread rhs)
Assigning CubeDataThreads to eachother is bad, so this has been intentionally not implemented!
Isis::CubeDataThread::ReadReady
void ReadReady(void *requester, int cubeId, const Isis::Brick *data)
This signal will be emitted when ReadCube has finished processing.
Isis::CubeDataThread::BricksInMemory
int BricksInMemory()
This is a helper method for both testing/debugging and general information that provides the current ...
Definition: CubeDataThread.cpp:734
Isis::CubeDataThread::GetUniversalGroundMap
UniversalGroundMap * GetUniversalGroundMap(int cubeId) const
This returns a new Universal Ground Map given a Cube ID.
Definition: CubeDataThread.cpp:750
Isis::CubeDataThread::p_threadSafeMutex
QMutex * p_threadSafeMutex
This locks the member variable p_managedCubes and p_managedData itself.
Definition: CubeDataThread.h:174
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::CubeDataThread::ReadWriteReady
void ReadWriteReady(void *requester, int cubeId, Isis::Brick *data)
This signal will be emitted when ReadWriteCube has finished processing.
Isis::CubeDataThread::p_numChangeListeners
int p_numChangeListeners
This is the number of shaded locks to put on a brick when changes made.
Definition: CubeDataThread.h:205
Isis::CubeDataThread::RemoveChangeListener
void RemoveChangeListener()
You must call this method after disconnecting from the BrickChanged signal, otherwise bricks cannot b...
Definition: CubeDataThread.cpp:238
Isis::CubeDataThread::RemoveCube
void RemoveCube(int cubeId)
Removes a cube from this lock manager.
Definition: CubeDataThread.cpp:192
QThread
QPair
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:23
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::CubeDataThread::ReadCube
void ReadCube(int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller)
This slot should be connected to and upon receiving a signal it will begin the necessary cube I/O to ...
Definition: CubeDataThread.cpp:427
Isis::CubeDataThread::GetCubeData
void GetCubeData(int cubeId, int ss, int sl, int es, int el, int band, void *caller, bool sharedLock)
This helper method reads in cube data and handles the locking of similar bricks appropriately.
Definition: CubeDataThread.cpp:258
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::CubeDataThread::p_managedData
QList< QPair< QReadWriteLock *, Brick * > > * p_managedData
This is a list of bricks in memory and their locks.
Definition: CubeDataThread.h:199