svcore  1.9
MatrixFile Class Reference

#include <MatrixFile.h>

Collaboration diagram for MatrixFile:

List of all members.

Public Types

enum  Mode { ReadOnly, WriteOnly }

Public Member Functions

 MatrixFile (QString fileBase, Mode mode, int cellSize, int width, int height)
 Construct a MatrixFile object reading from and/or writing to the matrix file with the given base name in the application's temporary directory.
virtual ~MatrixFile ()
Mode getMode () const
int getWidth () const
int getHeight () const
int getCellSize () const
void setAutoClose (bool a)
 If this is set true on a write-mode MatrixFile, then the file will close() itself when all columns have been written.
void close ()
bool haveSetColumnAt (int x) const
void getColumnAt (int x, void *data)
void setColumnAt (int x, const void *data)

Protected Member Functions

void initialise ()
bool seekTo (int col) const

Protected Attributes

int m_fd
Mode m_mode
int m_flags
mode_t m_fmode
int m_cellSize
int m_width
int m_height
int m_headerSize
QString m_fileName
ResizeableBitsetm_setColumns
bool m_autoClose
int m_readyToReadColumn

Static Protected Attributes

static std::map< QString, int > m_refcount
static QMutex m_createMutex

Detailed Description

Definition at line 28 of file MatrixFile.h.


Member Enumeration Documentation

Enumerator:
ReadOnly 
WriteOnly 

Definition at line 33 of file MatrixFile.h.


Constructor & Destructor Documentation

MatrixFile::MatrixFile ( QString  fileBase,
Mode  mode,
int  cellSize,
int  width,
int  height 
)

Construct a MatrixFile object reading from and/or writing to the matrix file with the given base name in the application's temporary directory.

If mode is ReadOnly, the file must exist and be readable.

If mode is WriteOnly, the file must not exist.

cellSize specifies the size in bytes of the object type stored in the matrix. For example, use cellSize = sizeof(float) for a matrix of floats. The MatrixFile object doesn't care about the objects themselves, it just deals with raw data of a given size.

width and height specify the dimensions of the file. These cannot be changed after construction.

MatrixFiles are reference counted by name. When the last MatrixFile with a given name is destroyed, the file is removed. These are temporary files; the normal usage is to have one MatrixFile of WriteOnly type creating the file and then persisting until all readers are complete.

MatrixFile has no built-in cache and is not thread-safe. Use a separate MatrixFile in each thread.

Definition at line 54 of file MatrixFile.cpp.

References TempDirectory::getInstance(), initialise(), m_createMutex, m_fd, m_fileName, m_flags, m_fmode, m_height, m_mode, m_refcount, m_width, openCount, ReadOnly, SVDEBUG, totalCount, and WriteOnly.


Member Function Documentation

Mode MatrixFile::getMode ( ) const [inline]

Definition at line 65 of file MatrixFile.h.

References m_mode.

int MatrixFile::getWidth ( ) const [inline]

Definition at line 67 of file MatrixFile.h.

References m_width.

Referenced by FFTFileCacheReader::getWidth(), and FFTFileCacheWriter::getWidth().

int MatrixFile::getCellSize ( ) const [inline]
void MatrixFile::setAutoClose ( bool  a) [inline]

If this is set true on a write-mode MatrixFile, then the file will close() itself when all columns have been written.

Definition at line 75 of file MatrixFile.h.

References m_autoClose.

Referenced by FFTFileCacheWriter::FFTFileCacheWriter().

Definition at line 248 of file MatrixFile.cpp.

References m_fd, openCount, and SVDEBUG.

Referenced by FFTFileCacheWriter::allColumnsWritten(), setColumnAt(), and ~MatrixFile().

void MatrixFile::getColumnAt ( int  x,
void *  data 
)
void MatrixFile::initialise ( ) [protected]
bool MatrixFile::seekTo ( int  col) const [protected]

Member Data Documentation

int MatrixFile::m_flags [protected]

Definition at line 86 of file MatrixFile.h.

Referenced by MatrixFile().

mode_t MatrixFile::m_fmode [protected]

Definition at line 87 of file MatrixFile.h.

Referenced by MatrixFile().

int MatrixFile::m_cellSize [protected]

Definition at line 88 of file MatrixFile.h.

Referenced by getCellSize(), getColumnAt(), initialise(), seekTo(), setColumnAt(), and ~MatrixFile().

int MatrixFile::m_width [protected]

Definition at line 89 of file MatrixFile.h.

Referenced by getWidth(), initialise(), MatrixFile(), and ~MatrixFile().

int MatrixFile::m_height [protected]
int MatrixFile::m_headerSize [protected]

Definition at line 91 of file MatrixFile.h.

Referenced by initialise(), seekTo(), and ~MatrixFile().

QString MatrixFile::m_fileName [protected]
bool MatrixFile::m_autoClose [protected]

Definition at line 95 of file MatrixFile.h.

Referenced by setAutoClose(), and setColumnAt().

int MatrixFile::m_readyToReadColumn [mutable, protected]

Definition at line 99 of file MatrixFile.h.

Referenced by getColumnAt(), haveSetColumnAt(), and seekTo().

std::map< QString, int > MatrixFile::m_refcount [static, protected]

Definition at line 101 of file MatrixFile.h.

Referenced by MatrixFile(), and ~MatrixFile().

QMutex MatrixFile::m_createMutex [static, protected]

Definition at line 102 of file MatrixFile.h.

Referenced by MatrixFile(), and ~MatrixFile().


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