Friday, October 21, 2005
ACE Cached Virtual File system
1. ACE_Filecache_Handle
Abstraction over a real file. This is meant to be the entry point into the Cached Virtual Filesystem
2. ACE_Filecache
A hash table holding the information about entry point into the Cached Virtual Filesystem. On insertion, the reference count is incremented. On destruction, reference count is decremented
3.ACE_Filecache_Object
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
Examples: see ACE_WRAPPERS/apps/JAWS/server/IO.cpp
void
JAWS_Synch_IO::receive_file (const char *filename,
void *initial_data,
int initial_data_length,
int entire_length)
{
ACE_Filecache_Handle handle (filename, entire_length);
int result = handle.error ();
if (result == ACE_Filecache_Handle::ACE_SUCCESS)
{
...
ACE_OS::memcpy (handle.address (), initial_data, bytes_to_memcpy);
...
}
}
void
JAWS_Synch_IO::transmit_file (const char *filename,
const char *header,
int header_size,
const char *trailer,
int trailer_size)
{
ACE_Filecache_Handle handle (filename);
int result = handle.error ();
if (result == ACE_Filecache_Handle::ACE_SUCCESS)
{
ACE_SOCK_Stream stream;
...
(stream.send_n (handle.address (), handle.size ())
...
}