ACE
6.3.3
|
Abstraction over a real file. This is what the Virtual Filesystem contains. This class is not intended for general consumption. Please consult a physician before attempting to use this class. More...
#include <Filecache.h>
Public Types | |
enum | Creation_States { ACE_READING = 1, ACE_WRITING = 2 } |
enum | Error_Conditions { ACE_SUCCESS = 0, ACE_ACCESS_FAILED, ACE_OPEN_FAILED, ACE_COPY_FAILED, ACE_STAT_FAILED, ACE_MEMMAP_FAILED, ACE_WRITE_FAILED } |
Public Member Functions | |
ACE_Filecache_Object (const ACE_TCHAR *filename, ACE_SYNCH_RW_MUTEX &lock, LPSECURITY_ATTRIBUTES sa=0, int mapit=1) | |
Creates a file for reading. More... | |
ACE_Filecache_Object (const ACE_TCHAR *filename, ACE_OFF_T size, ACE_SYNCH_RW_MUTEX &lock, LPSECURITY_ATTRIBUTES sa=0) | |
Creates a file for writing. More... | |
~ACE_Filecache_Object (void) | |
Only if reference count is zero should this be called. More... | |
int | acquire (void) |
Increment the reference_count_. More... | |
int | release (void) |
Decrement the reference_count_. More... | |
int | error (void) const |
int | error (int error_value, const ACE_TCHAR *s=ACE_TEXT("ACE_Filecache_Object")) |
const ACE_TCHAR * | filename (void) const |
filename_ accessor More... | |
ACE_HANDLE | handle (void) const |
handle_ accessor. More... | |
void * | address (void) const |
Base memory address for memory mapped file. More... | |
ACE_OFF_T | size (void) const |
size_ accessor. More... | |
int | update (void) const |
True if file on disk is newer than cached file. More... | |
Protected Member Functions | |
ACE_Filecache_Object (void) | |
Prevent from being called. More... | |
void | init (void) |
Common initialization code,. More... | |
Private Member Functions | |
int | error_i (int error_value, const ACE_TCHAR *s=ACE_TEXT("ACE_Filecache_Object")) |
Internal error logging method, no locking. More... | |
Private Attributes | |
ACE_TCHAR * | tempname_ |
ACE_TCHAR | filename_ [MAXPATHLEN+1] |
ACE_Mem_Map | mmap_ |
Holds the memory mapped version of the temporary file. More... | |
ACE_HANDLE | handle_ |
The descriptor to the temporary file. More... | |
ACE_stat | stat_ |
Used to compare against the real file to test if an update is needed. More... | |
ACE_OFF_T | size_ |
int | action_ |
Status indicators. More... | |
int | error_ |
int | stale_ |
If set to 1, means the object is flagged for removal. More... | |
LPSECURITY_ATTRIBUTES | sa_ |
Security attribute object. More... | |
ACE_SYNCH_RW_MUTEX | junklock_ |
The default initializer. More... | |
ACE_SYNCH_RW_MUTEX & | lock_ |
Provides a bookkeeping mechanism for users of this object. More... | |
Friends | |
class | ACE_Filecache |
Abstraction over a real file. This is what the Virtual Filesystem contains. This class is not intended for general consumption. Please consult a physician before attempting to use this class.
ACE_Filecache_Object::ACE_Filecache_Object | ( | const ACE_TCHAR * | filename, |
ACE_SYNCH_RW_MUTEX & | lock, | ||
LPSECURITY_ATTRIBUTES | sa = 0 , |
||
int | mapit = 1 |
||
) |
Creates a file for reading.
ACE_Filecache_Object::ACE_Filecache_Object | ( | const ACE_TCHAR * | filename, |
ACE_OFF_T | size, | ||
ACE_SYNCH_RW_MUTEX & | lock, | ||
LPSECURITY_ATTRIBUTES | sa = 0 |
||
) |
Creates a file for writing.
ACE_Filecache_Object::~ACE_Filecache_Object | ( | void | ) |
Only if reference count is zero should this be called.
|
protected |
Prevent from being called.
int ACE_Filecache_Object::acquire | ( | void | ) |
Increment the reference_count_.
void * ACE_Filecache_Object::address | ( | void | ) | const |
Base memory address for memory mapped file.
int ACE_Filecache_Object::error | ( | void | ) | const |
int ACE_Filecache_Object::error | ( | int | error_value, |
const ACE_TCHAR * | s = ACE_TEXT("ACE_Filecache_Object") |
||
) |
|
private |
Internal error logging method, no locking.
const ACE_TCHAR * ACE_Filecache_Object::filename | ( | void | ) | const |
filename_ accessor
ACE_HANDLE ACE_Filecache_Object::handle | ( | void | ) | const |
handle_ accessor.
|
protected |
Common initialization code,.
int ACE_Filecache_Object::release | ( | void | ) |
Decrement the reference_count_.
ACE_OFF_T ACE_Filecache_Object::size | ( | void | ) | const |
size_ accessor.
int ACE_Filecache_Object::update | ( | void | ) | const |
True if file on disk is newer than cached file.
|
friend |
|
private |
Status indicators.
|
private |
|
private |
|
private |
The descriptor to the temporary file.
|
private |
The default initializer.
|
private |
Provides a bookkeeping mechanism for users of this object.
|
private |
Holds the memory mapped version of the temporary file.
|
private |
Security attribute object.
|
private |
|
private |
If set to 1, means the object is flagged for removal.
|
private |
Used to compare against the real file to test if an update is needed.
|
private |
The temporary file name and the real file name. The real file is copied into the temporary file for safety reasons.