comparison data/fileio/MatrixFile.h @ 550:107d3f3705c9

* Auto-close write-mode matrix files when all columns written
author Chris Cannam
date Thu, 05 Feb 2009 14:17:11 +0000
parents 3cc4b7cd2aa5
children 60482f13e627
comparison
equal deleted inserted replaced
549:388afa99d537 550:107d3f3705c9
65 Mode getMode() const { return m_mode; } 65 Mode getMode() const { return m_mode; }
66 66
67 size_t getWidth() const { return m_width; } 67 size_t getWidth() const { return m_width; }
68 size_t getHeight() const { return m_height; } 68 size_t getHeight() const { return m_height; }
69 size_t getCellSize() const { return m_cellSize; } 69 size_t getCellSize() const { return m_cellSize; }
70 70
71 /**
72 * If this is set true on a write-mode MatrixFile, then the file
73 * will close() itself when all columns have been written.
74 */
75 void setAutoClose(bool a) { m_autoClose = a; }
76
71 void close(); // does not decrement ref count; that happens in dtor 77 void close(); // does not decrement ref count; that happens in dtor
72 78
73 bool haveSetColumnAt(size_t x) const; 79 bool haveSetColumnAt(size_t x) const;
74 void getColumnAt(size_t x, void *data); // may throw FileReadFailed 80 void getColumnAt(size_t x, void *data); // may throw FileReadFailed
75 void setColumnAt(size_t x, const void *data); 81 void setColumnAt(size_t x, const void *data);
83 size_t m_width; 89 size_t m_width;
84 size_t m_height; 90 size_t m_height;
85 size_t m_headerSize; 91 size_t m_headerSize;
86 QString m_fileName; 92 QString m_fileName;
87 93
94 ResizeableBitset *m_setColumns; // only in writer
95 bool m_autoClose;
96
88 static std::map<QString, int> m_refcount; 97 static std::map<QString, int> m_refcount;
89 static QMutex m_createMutex; 98 static QMutex m_createMutex;
90 99
91 void initialise(); 100 void initialise();
92 bool seekTo(size_t x, size_t y) const; 101 bool seekTo(size_t x, size_t y) const;