Isis 3 Programmer Reference
Isis::CubeIoHandler::BufferToChunkWriter Class Reference

This class is designed to handle write() asynchronously. More...

Inheritance diagram for Isis::CubeIoHandler::BufferToChunkWriter:
Inheritance graph
Collaboration diagram for Isis::CubeIoHandler::BufferToChunkWriter:
Collaboration graph

Public Member Functions

 BufferToChunkWriter (CubeIoHandler *ioHandler, QList< Buffer * > buffersToWrite)
 Create a BufferToChunkWriter which is designed to asynchronously move the given buffers into the cube cache.
 
 ~BufferToChunkWriter ()
 We're done writing our buffers into the cube, clean up.
 
void run ()
 This is the asynchronous computation.
 

Private Member Functions

 BufferToChunkWriter (const BufferToChunkWriter &other)
 This is disabled.
 
BufferToChunkWriteroperator= (const BufferToChunkWriter &rhs)
 This is disabled.
 

Private Attributes

CubeIoHandlerm_ioHandler
 The IO Handler instance to put the buffers into.
 
QList< Buffer * > * m_buffersToWrite
 The buffers that need pushed into the IO handler; we own these.
 
QTime * m_timer
 Used to calculate the lifetime of an instance of this class.
 

Detailed Description

This class is designed to handle write() asynchronously.

Only one of these should be running at a time, otherwise race conditions may exist, so this class locks the ioHandler->m_writeThreadMutex appropriately.

This works by doing what write() used to do, but inside of run(), so that it can happen simultaneously. If any read operations occur, they must block until all writes are done.

Author
2012-02-22 Steven Lambright

Definition at line 185 of file CubeIoHandler.h.

Constructor & Destructor Documentation

◆ BufferToChunkWriter() [1/2]

Isis::CubeIoHandler::BufferToChunkWriter::BufferToChunkWriter ( CubeIoHandler * ioHandler,
QList< Buffer * > buffersToWrite )

Create a BufferToChunkWriter which is designed to asynchronously move the given buffers into the cube cache.

This will lock the ioHandler's m_writeThreadMutex.

Parameters
ioHandlerThis is the cube IO handler. It's not const because you should have non-constness on a cube in order to write to it. This does, sometimes, need overridden externally if you are simply flushing the cache and not doing a new write.
buffersToWriteThe buffers to put into the cube. This takes ownership of the given buffers.

Definition at line 1865 of file CubeIoHandler.cpp.

References m_buffersToWrite, m_ioHandler, m_timer, and Isis::CubeIoHandler::m_writeThreadMutex.

◆ ~BufferToChunkWriter()

Isis::CubeIoHandler::BufferToChunkWriter::~BufferToChunkWriter ( )

We're done writing our buffers into the cube, clean up.

It turns out you can't start the next cache flush from here, so this does not initiate another write cache flush.

Before releasing the lock on the QDataFile, this destructor attempts to correct the ideal cache size to reflect the current run. This tries to bring the cache size to a point where this class lives for a total of 100ms.

Definition at line 1886 of file CubeIoHandler.cpp.

◆ BufferToChunkWriter() [2/2]

Isis::CubeIoHandler::BufferToChunkWriter::BufferToChunkWriter ( const BufferToChunkWriter & other)
private

This is disabled.

Parameters
otherNothing.

Member Function Documentation

◆ operator=()

BufferToChunkWriter & Isis::CubeIoHandler::BufferToChunkWriter::operator= ( const BufferToChunkWriter & rhs)
private

This is disabled.

Parameters
rhsNothing.
Returns
Nothing.

◆ run()

void Isis::CubeIoHandler::BufferToChunkWriter::run ( )

This is the asynchronous computation.

Write the given buffers into the cube synchronously in this thread and delete the buffers when we're done.

Definition at line 1920 of file CubeIoHandler.cpp.

Member Data Documentation

◆ m_buffersToWrite

QList<Buffer * >* Isis::CubeIoHandler::BufferToChunkWriter::m_buffersToWrite
private

The buffers that need pushed into the IO handler; we own these.

Definition at line 210 of file CubeIoHandler.h.

Referenced by BufferToChunkWriter().

◆ m_ioHandler

CubeIoHandler* Isis::CubeIoHandler::BufferToChunkWriter::m_ioHandler
private

The IO Handler instance to put the buffers into.

Definition at line 208 of file CubeIoHandler.h.

Referenced by BufferToChunkWriter().

◆ m_timer

QTime* Isis::CubeIoHandler::BufferToChunkWriter::m_timer
private

Used to calculate the lifetime of an instance of this class.

Definition at line 212 of file CubeIoHandler.h.

Referenced by BufferToChunkWriter().


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