ACE_Filecache_Handle Class Reference

Abstraction over a real file. This is meant to be the entry point into the Cached Virtual Filesystem. More...

#include <Filecache.h>

Collaboration diagram for ACE_Filecache_Handle:

Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  ACE_SUCCESS = 0, ACE_ACCESS_FAILED, ACE_OPEN_FAILED, ACE_COPY_FAILED,
  ACE_STAT_FAILED, ACE_MEMMAP_FAILED, ACE_WRITE_FAILED
}
 These come from ACE_Filecache_Object, which is an internal class. More...

Public Member Functions

 ACE_Filecache_Handle (const ACE_TCHAR *filename, ACE_Filecache_Flag mapit=ACE_MAPIT)
 ACE_Filecache_Handle (const ACE_TCHAR *filename, int size, ACE_Filecache_Flag mapit=ACE_MAPIT)
 ~ACE_Filecache_Handle (void)
 Closes any open handles, release acquired file.
void * address (void) const
 Base address of memory mapped file.
ACE_HANDLE handle (void) const
 A handle (e.g., UNIX file descriptor, or NT file handle).
int error (void) const
 Any associated error in handle creation and acquisition.
ACE_OFF_T size (void) const
 The size of the file.

Protected Member Functions

 ACE_Filecache_Handle (void)
 Default do nothing constructor. Prevent it from being called.
void init (void)
 Common initializations for constructors.

Private Attributes

ACE_Filecache_Objectfile_
 A reference to the low level instance.
ACE_HANDLE handle_
 A <dup>'d version of the one from <file_>.
int mapit_


Detailed Description

Abstraction over a real file. This is meant to be the entry point into the Cached Virtual Filesystem.

This is a cached filesystem implementation based loosely on the implementation of JAWS_File. The interfaces will be nearly the same. The under-the-hood implementation should hopefully be a much faster thing. These will be given their own implementations later. For now, we borrow the implementation provided by JAWS. On creation, the cache is checked, and reference count is incremented. On destruction, reference count is decremented. If the reference count is 0, the file is removed from the cache. E.g. 1, { ACE_Filecache_Handle foo("foo.html"); this->peer ().send (foo.address (), foo.size ()); } E.g. 2, { ACE_Filecache_Handle foo("foo.html"); io->transmitfile (foo.handle (), this->peer ().handle ()); } E.g. 3, { ACE_Filecache_Handle foo("foo.html", content_length); this->peer ().recv (foo.address (), content_length); } TODO:


Member Enumeration Documentation

anonymous enum

These come from ACE_Filecache_Object, which is an internal class.

Enumerator:
ACE_SUCCESS 
ACE_ACCESS_FAILED 
ACE_OPEN_FAILED 
ACE_COPY_FAILED 
ACE_STAT_FAILED 
ACE_MEMMAP_FAILED 
ACE_WRITE_FAILED 


Constructor & Destructor Documentation

ACE_Filecache_Handle::ACE_Filecache_Handle ( const ACE_TCHAR filename,
ACE_Filecache_Flag  mapit = ACE_MAPIT 
)

Query cache for file, and acquire it. Assumes the file is being opened for reading.

ACE_Filecache_Handle::ACE_Filecache_Handle ( const ACE_TCHAR filename,
int  size,
ACE_Filecache_Flag  mapit = ACE_MAPIT 
)

Create new entry, and acquire it. Presence of SIZE assumes the file is being opened for writing. If SIZE is zero, assumes the file is to be removed from the cache.

ACE_Filecache_Handle::~ACE_Filecache_Handle ( void   ) 

Closes any open handles, release acquired file.

ACE_Filecache_Handle::ACE_Filecache_Handle ( void   )  [protected]

Default do nothing constructor. Prevent it from being called.


Member Function Documentation

void * ACE_Filecache_Handle::address ( void   )  const

Base address of memory mapped file.

int ACE_Filecache_Handle::error ( void   )  const

Any associated error in handle creation and acquisition.

ACE_HANDLE ACE_Filecache_Handle::handle ( void   )  const

A handle (e.g., UNIX file descriptor, or NT file handle).

void ACE_Filecache_Handle::init ( void   )  [protected]

Common initializations for constructors.

ACE_OFF_T ACE_Filecache_Handle::size ( void   )  const

The size of the file.


Member Data Documentation

A reference to the low level instance.

ACE_HANDLE ACE_Filecache_Handle::handle_ [private]

A <dup>'d version of the one from <file_>.


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

Generated on Mon Jul 13 16:11:39 2009 for ACE by  doxygen 1.5.8