RandomAccessDevice Class Reference

RandomAccessDevice is an interface representing any Device whose stored bytes can be accessed at random in constant time. More...

#include <RandomAccessDevice.h>

Inheritance diagram for RandomAccessDevice:

RandomAccessFileDevice RandomAccessNullDevice List of all members.

Public Member Functions

virtual ~RandomAccessDevice ()
virtual FileSize getSizeInBytes ()=0
 Gets the current size of this device.
virtual void setSizeInBytes (FileSize cbNew)=0
 Sets the size of this device, truncating or extending the device as necessary.
virtual void transfer (RandomAccessRequest const &request)=0
 Synchronously reads or writes a range of bytes from the device.
virtual void prepareTransfer (RandomAccessRequest &request)=0
 Prepares for an asynchronous transfer by associating required information about this device (e.g.
virtual void flush ()=0
 Forces any buffered writes to permanent storage (e.g.
virtual int getHandle ()=0
 
Returns:
OS-defined handle representing this device, or -1 for none


Detailed Description

RandomAccessDevice is an interface representing any Device whose stored bytes can be accessed at random in constant time.

For more information, see DeviceDesign.

Definition at line 39 of file RandomAccessDevice.h.


Constructor & Destructor Documentation

RandomAccessDevice::~RandomAccessDevice (  )  [virtual]

Definition at line 42 of file RandomAccessFileDevice.cpp.

00043 {
00044 }


Member Function Documentation

virtual FileSize RandomAccessDevice::getSizeInBytes (  )  [pure virtual]

Gets the current size of this device.

Returns:
device size, in bytes

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

virtual void RandomAccessDevice::setSizeInBytes ( FileSize  cbNew  )  [pure virtual]

Sets the size of this device, truncating or extending the device as necessary.

Contents of extended portion are undefined.

Parameters:
cbNew new device size in bytes

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

virtual void RandomAccessDevice::transfer ( RandomAccessRequest const &  request  )  [pure virtual]

Synchronously reads or writes a range of bytes from the device.

Never returns an error state; instead, a completion notification method is called (via RandomAccessRequestBinding::notifyTransferCompletion).

Parameters:
request the encapsulated request parameters

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

Referenced by RandomAccessRequest::execute().

virtual void RandomAccessDevice::prepareTransfer ( RandomAccessRequest request  )  [pure virtual]

Prepares for an asynchronous transfer by associating required information about this device (e.g.

file handle) with the given request. The actual asynchronous transfer is initiated by a calling DeviceAccessScheduler rather than this RandomAccessDevice itself.

Parameters:
request the encapsulated request parameters

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

Referenced by AioSignalScheduler::schedule(), AioPollingScheduler::schedule(), and AioLinuxScheduler::schedule().

virtual void RandomAccessDevice::flush (  )  [pure virtual]

Forces any buffered writes to permanent storage (e.g.

fsync for a file device).

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

virtual int RandomAccessDevice::getHandle (  )  [pure virtual]

Returns:
OS-defined handle representing this device, or -1 for none

Implemented in RandomAccessFileDevice, and RandomAccessNullDevice.

Referenced by IoCompletionPortScheduler::schedule().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:44 2009 for Fennel by  doxygen 1.5.1