oaMapFileWindow Class Reference

Inheritance diagram for oaMapFileWindow:

oaMapWindow


Public Methods

 oaMapFileWindow (oaByte *dataIn, oaUInt4 sizeIn, oaUInt8 offsetIn, oaMapFile &mapFileIn)
void map (oaUInt4 sizeIn=0, oaUInt8 offsetIn=0, void *mapLoc=NULL)
void unmap ()
oaUInt4 move (oaUInt4 sizeIn, oaUInt8 offsetIn, oaBoolean resize=false)
oaUInt4 extend (oaUInt4 sizeIn)
oaMapFilegetMapFile ()
const oaMapFilegetMapFile () const
oaMapFileWindow * getNext () const
void setMapFile (oaMapFile &mapFileIn)
void reset ()
void writeSwapCheck (oaUInt4 &loc)
void readSwapCheck (oaUInt4 &loc)
oaBoolean getSwap () const

Protected Methods

void setNext (oaMapFileWindow *nextIn)
void setSwap (oaBoolean swap)

Friends

class oaMapFile

Detailed Description

The oaMapFileWindow utility class reads data from and writes data to a memory-mapped disk file. The oaMapFileWindow class derives from oaMapWindow, associating the window with an oaMapFile as the backing storage.

This class includes byte-swapping support for files moved between big-endian and little-endian computers. This class supports files with sizes larger than 32 bits. As part of this support, the API allows any 32-bit window of the file to map at a time.

The usage of oaMapFileWindow is primarily internal to OpenAccess. It is public because pcell evaluators may use it to store private data in a pcell supermaster. See oaPackedData for a discussion. Such callers will get an oaMapFileWindow from oaPcellDataCallback::onPcellRead or oaPcellDataCallback::onPcellWrite. They do not need to call any functions on oaMapFileWindow except the inherited call oaMapWindow::data().


Constructor & Destructor Documentation

oaMapFileWindow::oaMapFileWindow oaByte *    dataIn,
oaUInt4    sizeIn,
oaUInt8    offsetIn,
oaMapFile &    mapFileIn
 


Member Function Documentation

oaUInt4 oaMapFileWindow::extend oaUInt4    sizeIn
 

This function ensures that the size of the memory-mapped window is at least sizeIn, extending the memory-mapped window if necessary without changing the window offset. The new window size that is returned may be somewhat larger than sizeIn due to memory-mapping granularity. In write mode, the file is also extended, if necessary.

Parameters:
sizeIn The minimum size of the memory-mapped window

const oaMapFile & oaMapFileWindow::getMapFile   const [inline]
 

This function returns the mapFile associated with this mapFileWindow.

oaMapFile & oaMapFileWindow::getMapFile   [inline]
 

This function returns the mapFile associated with this mapFileWindow.

oaMapFileWindow * oaMapFileWindow::getNext   const [inline]
 

This function returns the next mapFileWindow associated with the same mapFile as this mapFileWindow.

oaBoolean oaMapFileWindow::getSwap   const [inline]
 

This function returns a boolean indicating if this file requires byte-swapping.

Returns:
true or false

void oaMapFileWindow::map oaUInt4    sizeIn = 0,
oaUInt8    offsetIn = 0,
void *    mapLoc = NULL
 

This function creates a memory-mapped window of sizeIn bytes, starting at offsetIn in this file. If mapLoc is not NULL, it is used as a suggested address for the start of the mapping in memory.

Parameters:
sizeIn The size of the memory-mapped window to create
offsetIn The starting location in the file for this memory-mapped window
mapLoc The suggested starting address for the memory mapping; no starting location is provided by default

oaUInt4 oaMapFileWindow::move oaUInt4    sizeIn,
oaUInt8    offsetIn,
oaBoolean    resize = false
 

This function moves the memory-mapped window from the current offset in the file to offsetIn, changing the size of the window to sizeIn.

Parameters:
sizeIn The new size of the memory-mapped window
offsetIn The new starting location in the file for this memory-mapped window
resize 

void oaMapFileWindow::readSwapCheck oaUInt4 &    loc
 

This function reads an integer from this file. This test integer determines if subsequent reads from this file must be done using byte-swapping.

Parameters:
loc The location in the file from which to read the integer

void oaMapFileWindow::reset  
 

void oaMapFileWindow::setMapFile oaMapFile &    mapFileIn
 

This function changes the underlying file to use for subsequent mapping.

Parameters:
mapFileIn The map file to use
Exceptions:
oacInvalidSetMapWindowFile 

void oaMapFileWindow::setNext oaMapFileWindow *    nextIn [inline, protected]
 

This function sets the specified mapFileWindow to be the next mapFileWindow that is associated with the same mapFile as this mapFileWindow.

Parameters:
nextIn The name of the next mapFileWindow

void oaMapFileWindow::setSwap oaBoolean    swap [inline, protected]
 

This function sets the byte-swapping flag.

Parameters:
swap 

void oaMapFileWindow::unmap  
 

This function removes the current memory-mapped window if one exists.

void oaMapFileWindow::writeSwapCheck oaUInt4 &    loc
 

This function writes an integer to this file. This test integer determines if subsequent reads from this file must be done using byte-swapping.

Parameters:
loc The location in the file where to write the integer


Friends And Related Function Documentation

friend class oaMapFile [friend]
 


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

Return to top of page