NAME
ACE_Overlapped_File -
A wrapper for overlapped file I/O.
SYNOPSIS
#include <ace/Proactor.h>
class ACE_Overlapped_File
{
public:
ACE_Overlapped_File (void);
ACE_Overlapped_File (const ACE_Overlapped_File &file);
ACE_Overlapped_File (
const char *file_name,
int mode,
int perms = 0
);
~ACE_Overlapped_File (void);
int open (
const char *file_name,
int access = GENERIC_READ,
int share = FILE_SHARE_READ,
LPSECURITY_ATTRIBUTES security = 0,
int creation = OPEN_EXISTING,
int flags = FILE_ATTRIBUTE_NORMAL,
ACE_HANDLE template_file = ACE_INVALID_HANDLE
);
int open (ACE_HANDLE handle);
void close (void);
off_t offset (void) const;
off_t size (void) const;
off_t lseek (off_t offset, int whence);
ACE_HANDLE get_handle (void) const;
protected:
off_t offset_;
off_t file_size_;
ACE_HANDLE handle_;
int delete_handle_;
};
DESCRIPTION
ACE_Overlapped_File is place-holder for file I/O. When
performing overlapped I/O in win32, a file pointer is not
managed by the kernel. Instead, the user is responsible for
maintaining file pointers for all open files. This wrapper
provides an abstraction for a file pointer. The Proactor
updates Overlapped_File objects when overlapped I/O operations
complete. Eventually, this class may be integrated with
ACE_FILE_IO.
Initialization and termination methods.
ACE_Overlapped_File (void);
ACE_Overlapped_File (const ACE_Overlapped_File &file);
ACE_Overlapped_File (const char *file_name, int mode, int perms = 0);
Construction of an ACE_Overlapped_File. Calls open.
~ACE_Overlapped_File (void);
Destruction. Calls close.
int open (
const char *file_name,
int access = GENERIC_READ,
int share = FILE_SHARE_READ,
LPSECURITY_ATTRIBUTES security = 0,
int creation = OPEN_EXISTING,
int flags = FILE_ATTRIBUTE_NORMAL,
ACE_HANDLE template_file = ACE_INVALID_HANDLE
);
Opens file_name according to mode and perms. This method
is equivalent to CreateFile. Returns 0 on success, -1 on failure
with errno == reason.
int open (ACE_HANDLE handle);
Uses the given handle. Returns 0 on success, -1 on failure.
This will only return -1 when handle == ACE_INVALID_HANDLE.
void close (void);
Closes the file if open. Can be called explicitly, or implicitly
through the destructor.
off_t offset (void) const;
Return the current offset into the file.
off_t size (void) const;
Return the current size of the file.
off_t lseek (off_t offset, int whence);
If whence == SEEK_SET, then the file pointer is set to
offset. If whence == SEEK_CUR, then the file pointer is set
to its current location plus offset. If whence == SEEK_END,
the file pointer is set to the size of the file plus offset.
ACE_HANDLE get_handle (void) const;
Get the handle to the file.
AUTHOR
Doug Schmidt (schmidt@cs.wustl.edu),
Tim Harrison (harrison@cs.wustl.edu), and
Irfan Pyarali (ip1@cs.wustl.edu).
LIBRARY
ace