|
Isis 3.0 Object Programmers' Reference |
Home |
00001 #ifndef CubeDataThread_h 00002 #define CubeDataThread_h 00003 00004 #include <QThread> 00005 00006 template<typename T> class QList; 00007 00008 template<typename A, typename B> class QPair; 00009 template<typename A, typename B> class QMap; 00010 00011 class QReadWriteLock; 00012 class QMutex; 00013 00014 namespace Isis { 00015 class Cube; 00016 class FileName; 00017 class Brick; 00018 class UniversalGroundMap; 00019 00052 class CubeDataThread : public QThread { 00053 Q_OBJECT 00054 00055 public: 00056 CubeDataThread(); 00057 virtual ~CubeDataThread(); 00058 00059 int AddCube(const FileName &fileName, 00060 bool mustOpenReadWrite = false); 00061 int AddCube(Cube *cube); 00062 00063 void RemoveCube(int cubeId); 00064 00065 void AddChangeListener(); 00066 void RemoveChangeListener(); 00067 00068 int BricksInMemory(); 00069 00070 UniversalGroundMap *GetUniversalGroundMap(int cubeId) const; 00071 00072 const Cube *GetCube(int cubeId) const; 00073 int FindCubeId(const Cube *) const; 00074 00075 public slots: 00076 void ReadCube(int cubeId, int startSample, int startLine, 00077 int endSample, int endLine, int band, void *caller); 00078 void ReadWriteCube(int cubeId, int startSample, int startLine, 00079 int endSample, int endLine, int band, void *caller); 00080 00081 void DoneWithData(int, const Isis::Brick *); 00082 00083 signals: 00084 00096 void ReadReady(void *requester, int cubeId, const Isis::Brick *data); 00097 00109 void ReadWriteReady(void *requester, int cubeId, Isis::Brick *data); 00110 00123 void BrickChanged(int cubeId, const Isis::Brick *data); 00124 00125 private: 00134 CubeDataThread(const CubeDataThread &cdt); 00135 00145 const CubeDataThread &operator=(CubeDataThread rhs); 00146 00147 int OverlapIndex(const Brick *initial, int cubeId, 00148 int instanceNum, bool &exact); 00149 00150 void GetCubeData(int cubeId, int ss, int sl, int es, int el, int band, 00151 void *caller, bool sharedLock); 00152 00153 void AcquireLock(QReadWriteLock *lockObject, bool readLock); 00154 00155 bool FreeBrick(int brickIndex); 00156 00164 QMap< int, QPair< bool, Cube * > > * p_managedCubes; 00165 00167 QMutex *p_threadSafeMutex; 00168 00192 QList< QPair<QReadWriteLock *, Brick *> > * p_managedData; 00193 00195 QList< int > * p_managedDataSources; 00196 00198 int p_numChangeListeners; 00199 00201 unsigned int p_currentId; 00202 00204 bool p_stopping; 00205 00210 unsigned int p_currentLocksWaiting; 00211 }; 00212 00213 }; 00214 00215 00216 #endif