| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
MEMORY_MAPPED_FILE Class Reference

`#include <LibSymbolInfo.h>`

## Public Member Functions
| MEMORY_MAPPED_FILE (PSTR pszFileName)
| ~MEMORY_MAPPED_FILE (void)
PVOID | GetBase (void)
DWORD | GetFileSize (void)
BOOL | IsValid (void)
errMMF | GetErrorType ()

## Private Attributes
HANDLE | m_hFile
HANDLE | m_hFileMapping
PVOID | m_pMemoryMappedFileBase
DWORD | m_cbFile
errMMF | m_errCode

## Detailed Description

Definition at line 36 of file LibSymbolInfo.h.

## Constructor & Destructor Documentation

MEMORY_MAPPED_FILE::MEMORY_MAPPED_FILE | ( | PSTR | pszFileName | ) |

Definition at line 197 of file LibSymbolInfo.cpp.

197 {
198
199 //
200 // Given a filename, the constructor opens a file handle, creates a file
201 // mapping, and maps the entire file into memory.
202 //
203 m_hFile = INVALID_HANDLE_VALUE;
204 m_hFileMapping = 0;
205 m_pMemoryMappedFileBase = 0;
206 m_cbFile = 0;
207 m_errCode = errMMF_FileOpen; // Initial error code: not found
208 // First get a file handle
209 m_hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
210 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0);
211
212 if ( m_hFile == INVALID_HANDLE_VALUE )
213 {
214 m_errCode = errMMF_FileOpen;
215 return;
216 }
217 m_cbFile = ::GetFileSize( m_hFile, 0 );
218 // Now, create a file mapping
219 m_hFileMapping = CreateFileMapping(m_hFile,NULL, PAGE_READONLY, 0, 0,NULL);
220 if ( m_hFileMapping == 0 )
221 {
222 // Oops. Something went wrong. Clean up.
223 CloseHandle(m_hFile);
224 m_hFile = INVALID_HANDLE_VALUE;
225 m_errCode = errMMF_FileMapping;
226 return;
227 }
228 m_pMemoryMappedFileBase = (PCHAR)MapViewOfFile( m_hFileMapping,
229 FILE_MAP_READ, 0, 0, 0);
230 if ( m_pMemoryMappedFileBase == 0 )
231 {
232 // Oops. Something went wrong. Clean up.
233 CloseHandle(m_hFileMapping);
234 m_hFileMapping = 0;
235 CloseHandle(m_hFile);
236 m_hFile = INVALID_HANDLE_VALUE;
237 m_errCode = errMMF_MapView;
238 return;
239 }
240 m_errCode = errMMF_NoError;
241 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:33
errMMF_MapView
Definition: LibSymbolInfo.h:34
MEMORY_MAPPED_FILE::GetFileSize
DWORD GetFileSize(void)
Definition: LibSymbolInfo.h:43
errMMF_FileMapping
Definition: LibSymbolInfo.h:34
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:52
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:53
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:51
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:50
errMMF_NoError
Definition: LibSymbolInfo.h:33

MEMORY_MAPPED_FILE::~MEMORY_MAPPED_FILE | ( | void |  | ) |

Definition at line 243 of file LibSymbolInfo.cpp.

244 {
245 // Clean up everything that was created by the constructor
246 if ( m_pMemoryMappedFileBase )
247 UnmapViewOfFile( m_pMemoryMappedFileBase );
248
249 if ( m_hFileMapping )
250 CloseHandle( m_hFileMapping );
251
252 if ( m_hFile != INVALID_HANDLE_VALUE )
253 CloseHandle( m_hFile );
254
255 m_errCode = errMMF_FileOpen;
256 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:33
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:53
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:51
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:50

## Member Function Documentation

PVOID MEMORY_MAPPED_FILE::GetBase | ( | void |  | ) |
| inline

Definition at line 42 of file LibSymbolInfo.h.

42 { return m_pMemoryMappedFileBase; }
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:51

errMMF MEMORY_MAPPED_FILE::GetErrorType | ( |  | ) |
| inline

Definition at line 45 of file LibSymbolInfo.h.

45 { return m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:53

DWORD MEMORY_MAPPED_FILE::GetFileSize | ( | void |  | ) |
| inline

Definition at line 43 of file LibSymbolInfo.h.

43 { return m_cbFile; }
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:52

BOOL MEMORY_MAPPED_FILE::IsValid | ( | void |  | ) |
| inline

Definition at line 44 of file LibSymbolInfo.h.

44 { return errMMF_NoError == m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:53
errMMF_NoError
Definition: LibSymbolInfo.h:33

## Member Data Documentation

DWORD MEMORY_MAPPED_FILE::m_cbFile
| private

Definition at line 52 of file LibSymbolInfo.h.

errMMF MEMORY_MAPPED_FILE::m_errCode
| private

Definition at line 53 of file LibSymbolInfo.h.

HANDLE MEMORY_MAPPED_FILE::m_hFile
| private

Definition at line 49 of file LibSymbolInfo.h.

HANDLE MEMORY_MAPPED_FILE::m_hFileMapping
| private

Definition at line 50 of file LibSymbolInfo.h.

PVOID MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
| private

Definition at line 51 of file LibSymbolInfo.h.

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

- GaudiKernel/src/Util/LibSymbolInfo.h
- GaudiKernel/src/Util/LibSymbolInfo.cpp