## NAME

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

## SYNOPSIS

    #include <ace/Filecache.h>

    class ACE_Filecache_Handle
    {
      public:
        ACE_Filecache_Handle (
            const char *filename,
            ACE_Filecache_Flag mapit = ACE_MAPIT
            );
        ACE_Filecache_Handle (
            const char *filename,
            int size,
            ACE_Filecache_Flag mapit = ACE_MAPIT
            );
        ~ACE_Filecache_Handle (void);
        void *address (void) const;
        ACE_HANDLE handle (void) const;
        int error (void) const;
        size_t size (void) const;
            enum{ ACE_SUCCESS = 0,
            ACE_ACCESS_FAILED,
            ACE_OPEN_FAILED,
            ACE_COPY_FAILED,
            ACE_STAT_FAILED,
            ACE_MEMMAP_FAILED,
            ACE_WRITE_FAILED };

      protected:
        ACE_Filecache_Handle (void);
        void init (void);
      private:
        ACE_Filecache_Object *file_;
        ACE_HANDLE handle_;
        int mapit_;
    };

## DESCRIPTION

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:

## These come from ACE_Filecache_Object, which is an internal class.

## AUTHOR

James Hu

## LIBRARY

ace