| The Gaudi Framework v32r1 (f65d50dc)

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 34 of file LibSymbolInfo.h.

## Constructor & Destructor Documentation

## ◆ MEMORY_MAPPED_FILE()

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

Definition at line 171 of file LibSymbolInfo.cpp.

171 {
172
173 //
174 // Given a filename, the constructor opens a file handle, creates a file
175 // mapping, and maps the entire file into memory.
176 //
177 m_hFile = INVALID_HANDLE_VALUE;
178 m_hFileMapping = 0;
179 m_pMemoryMappedFileBase = 0;
180 m_cbFile = 0;
181 m_errCode = errMMF_FileOpen; // Initial error code: not found
182 // First get a file handle
183 m_hFile =
184 CreateFile( pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0 );
185
186 if ( m_hFile == INVALID_HANDLE_VALUE ) {
187 m_errCode = errMMF_FileOpen;
188 return;
189 }
190 m_cbFile = ::GetFileSize( m_hFile, 0 );
191 // Now, create a file mapping
192 m_hFileMapping = CreateFileMapping( m_hFile, NULL, PAGE_READONLY, 0, 0, NULL );
193 if ( m_hFileMapping == 0 ) {
194 // Oops. Something went wrong. Clean up.
195 CloseHandle( m_hFile );
196 m_hFile = INVALID_HANDLE_VALUE;
197 m_errCode = errMMF_FileMapping;
198 return;
199 }
200 m_pMemoryMappedFileBase = (PCHAR)MapViewOfFile( m_hFileMapping, FILE_MAP_READ, 0, 0, 0 );
201 if ( m_pMemoryMappedFileBase == 0 ) {
202 // Oops. Something went wrong. Clean up.
203 CloseHandle( m_hFileMapping );
204 m_hFileMapping = 0;
205 CloseHandle( m_hFile );
206 m_hFile = INVALID_HANDLE_VALUE;
207 m_errCode = errMMF_MapView;
208 return;
209 }
210 m_errCode = errMMF_NoError;
211 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:32
errMMF_MapView
Definition: LibSymbolInfo.h:32
MEMORY_MAPPED_FILE::GetFileSize
DWORD GetFileSize(void)
Definition: LibSymbolInfo.h:40
errMMF_FileMapping
Definition: LibSymbolInfo.h:32
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:48
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:45
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:47
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:46
errMMF_NoError
Definition: LibSymbolInfo.h:32

## ◆ ~MEMORY_MAPPED_FILE()

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

Definition at line 213 of file LibSymbolInfo.cpp.

213 {
214 // Clean up everything that was created by the constructor
215 if ( m_pMemoryMappedFileBase ) UnmapViewOfFile( m_pMemoryMappedFileBase );
216
217 if ( m_hFileMapping ) CloseHandle( m_hFileMapping );
218
219 if ( m_hFile != INVALID_HANDLE_VALUE ) CloseHandle( m_hFile );
220
221 m_errCode = errMMF_FileOpen;
222 }
errMMF_FileOpen
Definition: LibSymbolInfo.h:32
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:49
MEMORY_MAPPED_FILE::m_hFile
HANDLE m_hFile
Definition: LibSymbolInfo.h:45
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:47
MEMORY_MAPPED_FILE::m_hFileMapping
HANDLE m_hFileMapping
Definition: LibSymbolInfo.h:46

## Member Function Documentation

## ◆ GetBase()

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

Definition at line 39 of file LibSymbolInfo.h.

39 { return m_pMemoryMappedFileBase; }
MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
PVOID m_pMemoryMappedFileBase
Definition: LibSymbolInfo.h:47

## ◆ GetErrorType()

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

Definition at line 42 of file LibSymbolInfo.h.

42 { return m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:49

## ◆ GetFileSize()

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

Definition at line 40 of file LibSymbolInfo.h.

40 { return m_cbFile; }
MEMORY_MAPPED_FILE::m_cbFile
DWORD m_cbFile
Definition: LibSymbolInfo.h:48

## ◆ IsValid()

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

Definition at line 41 of file LibSymbolInfo.h.

41 { return errMMF_NoError == m_errCode; }
MEMORY_MAPPED_FILE::m_errCode
errMMF m_errCode
Definition: LibSymbolInfo.h:49
errMMF_NoError
Definition: LibSymbolInfo.h:32

## Member Data Documentation

## ◆ m_cbFile

DWORD MEMORY_MAPPED_FILE::m_cbFile
| private

Definition at line 48 of file LibSymbolInfo.h.

## ◆ m_errCode

errMMF MEMORY_MAPPED_FILE::m_errCode
| private

Definition at line 49 of file LibSymbolInfo.h.

## ◆ m_hFile

HANDLE MEMORY_MAPPED_FILE::m_hFile
| private

Definition at line 45 of file LibSymbolInfo.h.

## ◆ m_hFileMapping

HANDLE MEMORY_MAPPED_FILE::m_hFileMapping
| private

Definition at line 46 of file LibSymbolInfo.h.

## ◆ m_pMemoryMappedFileBase

PVOID MEMORY_MAPPED_FILE::m_pMemoryMappedFileBase
| private

Definition at line 47 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