RandomAccessNullDevice Class Reference

RandomAccessNullDevice is an implementation of RandomAccessDevice which acts something like /dev/null, except that it does not allow any transfers at all. More...

#include <RandomAccessNullDevice.h>

Inheritance diagram for RandomAccessNullDevice:

RandomAccessDevice List of all members.

Public Member Functions

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


Detailed Description

RandomAccessNullDevice is an implementation of RandomAccessDevice which acts something like /dev/null, except that it does not allow any transfers at all.

Definition at line 38 of file RandomAccessNullDevice.h.


Constructor & Destructor Documentation

RandomAccessNullDevice::RandomAccessNullDevice (  )  [explicit]

Creates a new null device.

Definition at line 29 of file RandomAccessNullDevice.cpp.

00030 {
00031 }


Member Function Documentation

FileSize RandomAccessNullDevice::getSizeInBytes (  )  [virtual]

Gets the current size of this device.

Returns:
device size, in bytes

Implements RandomAccessDevice.

Definition at line 33 of file RandomAccessNullDevice.cpp.

00034 {
00035     return 0;
00036 }

void RandomAccessNullDevice::setSizeInBytes ( FileSize  cbNew  )  [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

Implements RandomAccessDevice.

Definition at line 38 of file RandomAccessNullDevice.cpp.

00039 {
00040     assert(cbNew == 0);
00041 }

void RandomAccessNullDevice::transfer ( RandomAccessRequest const &  request  )  [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

Implements RandomAccessDevice.

Definition at line 43 of file RandomAccessNullDevice.cpp.

00044 {
00045     permAssert(false);
00046 }

void RandomAccessNullDevice::prepareTransfer ( RandomAccessRequest request  )  [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

Implements RandomAccessDevice.

Definition at line 48 of file RandomAccessNullDevice.cpp.

00049 {
00050     permAssert(false);
00051 }

void RandomAccessNullDevice::flush (  )  [virtual]

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

fsync for a file device).

Implements RandomAccessDevice.

Definition at line 53 of file RandomAccessNullDevice.cpp.

00054 {
00055 }

int RandomAccessNullDevice::getHandle (  )  [virtual]

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

Implements RandomAccessDevice.

Definition at line 57 of file RandomAccessNullDevice.cpp.

00058 {
00059     return -1;
00060 }


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