oaMapFile Class Reference
Inheritance diagram for oaMapFile:
Detailed Description
The oaMapFile class implements the basic file-mapping capability for memory-mapped disk files, including functions for reading and writing the file data. This class has byte-swapping supports for files across machines. This class supports files larger than 32 bits. The API allows you to map any 32-bit window of the file at a time.
You cannot map zero-size files. When you create files, the tool checks the mapping size. If the file size is zero, the map is not created.
It is the user's responsibility to ensure all writes are aligned on a boundary of the object size to be written. For example, you must write out shorts on two-byte boundaries, ints on four-byte boundaries, and so on. Violating this requirement results in a bus-error.
The Win32 and UNIX versions of this class differ due to the differences in file mapping support. Because of how Win32 supports memory mapping, it is not effective to derive this class from the oaFile class.
Constructor & Destructor Documentation
oaMapFile::oaMapFile |
( |
const oaString & |
nameIn |
) |
|
|
|
This function is the constructor for the oaMapFile class. This function initializes the members, but does not access the specified file in any way.
- Parameters:
-
nameIn | The name of the file to initialize |
|
oaMapFile::~oaMapFile |
( |
|
) |
[virtual] |
|
|
This function is the destructor for the oaMapFile object. This function maps and closes the file (if it is open and mapped) and releases all resources associated with the file. |
Member Function Documentation
|
This function adds window to the list of windows associated with this file. |
void oaMapFile::closeWindows |
( |
|
) |
|
|
|
This function closes all of the memory-mapped windows associated with this file. |
|
This function returns the first mapWindow associated with this map file. |
oaUInt8 oaMapFile::getMappableSize |
( |
|
) |
const |
|
|
This function returns the size of the portion of the file that is currently mappable. The mappable size is established when the first window is opened. If no windows are currently open, this function returns the current file size. |
oaBoolean oaMapFile::getSwap |
( |
|
) |
const [inline] |
|
|
This function returns a boolean indicating whether this file requires byte-swapping.
- Returns:
- true or false
|
oaBoolean oaMapFile::isMapped |
( |
|
) |
const [inline] |
|
|
This function returns true if this file is mapped.
- Returns:
- true or false
|
oaByte * oaMapFile::map |
( |
oaUInt4 & |
size, |
|
|
oaUInt8 & |
offset, |
|
|
void * |
mapLoc = NULL |
|
) |
|
|
|
This function maps a portion of the file associated with this oaMapFile object into memory using the specified access mode. The size and offset are adjusted to reflect operating system alignment and map size restrictions. The size bytes starting at set in the file are mapped. If the file is empty, this function will not map anything. If size is zero, the portion of the file between offset and the end of the file are mapped, with a 32-bit limitation. For write mode, if the file is not currently mapped it is extended if necessary.
- Exceptions:
-
|
|
This function removes window from the list of windows associated with this file. |
void oaMapFile::setSize |
( |
oaUInt8 |
size |
) |
|
|
|
This function sets the size of this file to the specified value. The file must be open for this function to succeed.
- Parameters:
-
size | The new size of the file |
- Exceptions:
-
|
void oaMapFile::setSwap |
( |
oaBoolean |
swapIn |
) |
|
|
|
This function sets the byte-swapping flag for this map file to indicate it requires byte-swapping. |
void oaMapFile::unmap |
( |
oaByte * |
mapLoc, |
|
|
oaUInt4 |
size |
|
) |
|
|
|
This function closes the memory-map at the given memory location. This mapFile object remains valid.
- Exceptions:
-
|
Friends And Related Function Documentation
friend class oaMapFileWindow [friend]
|
|
The documentation for this class was generated from the following files:
Return to top of page
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.