Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

AxPipe::CSourceMemFile Class Reference

A CSource providing data from a file system file, using memory mapping. More...

#include <CFileMap.h>

Inheritance diagram for AxPipe::CSourceMemFile:

Inheritance graph
[legend]
Collaboration diagram for AxPipe::CSourceMemFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

CSourceMemFileInit (const _TCHAR *szFileName, size_t cbChunk=64 *1024)
 Set file and chunk size.

 CSourceMemFile ()
 Just initialize member variables.


Protected Member Functions

HANDLE GetHandle ()
 Get the handle to the opened file.

bool OutOpen ()
 Open the file and create a mapping.

bool OutClose (void)
 Close the file and the mapping.

CSegIn ()
 Get the next chunk from the input file.


Private Attributes

HANDLE m_hFile
 The opened file.

HANDLE m_hMapping
 The mapping of the file.

size_t m_cbChunk
 The chunk size we send down stream.

longlong m_cbFileSize
 The length of the file in bytes.

longlong m_cbStreamPos
 The next file position to read a chunk from.

_TCHAR * m_szFileName
 The provided file name, new[]'d and delete[]'d here.


Detailed Description

A CSource providing data from a file system file, using memory mapping.

Definition at line 75 of file CFileMap.h.


Member Function Documentation

HANDLE AxPipe::CSourceMemFile::GetHandle  )  [protected]
 

Get the handle to the opened file.

Returns:
An operating system handle to the open file.

Definition at line 132 of file CFileMap.cpp.

References m_hFile.

CSeg * AxPipe::CSourceMemFile::In  )  [protected, virtual]
 

Get the next chunk from the input file.

The segment returned is actually a CSegMem, i.e. a mapping to the actual file - we do not copy to a memory buffer.

Multiple calls on EOF conditions are allowed.

Returns:
A chunk, or zero-length on End-Of-File, or NULL on error.

Implements AxPipe::CSource.

Definition at line 198 of file CFileMap.cpp.

CSourceMemFile * AxPipe::CSourceMemFile::Init const _TCHAR *  szFileName,
size_t  cbChunk = 64*1024
 

Set file and chunk size.

Parameters:
szFileName The name of the file, it is copied and saved here.
cbChunk The size of the chunks we send downstream
Returns:
A pointer to 'this' CSourceMemFile

Definition at line 140 of file CFileMap.cpp.

bool AxPipe::CSourceMemFile::OutClose void   )  [protected, virtual]
 

Close the file and the mapping.

Check for error with GetErrorCode().

Returns:
true if propagation of the close is recommended, which it is if no error. false is not error indication though.

Reimplemented from AxPipe::CPipe.

Definition at line 173 of file CFileMap.cpp.

bool AxPipe::CSourceMemFile::OutOpen  )  [protected, virtual]
 

Open the file and create a mapping.

The filename is provided in the Init() call. Check for error with GetErrorCode().

Returns:
true if we are to propagate, which we do if no error occurred. false is not an error indication though.

Reimplemented from AxPipe::CPipe.

Definition at line 152 of file CFileMap.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Feb 2 13:19:28 2004 for AxPipe by doxygen 1.3.5