diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-09 18:09:54 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-09 18:09:54 +0000 |
commit | e67dbedfe787e0bcb409990d4d586c2969963a75 (patch) | |
tree | 69268b4d73718c773d385cb9744726d4d34f13b6 /ace/Filecache.h | |
parent | a0128c489495177a4fa48156033db1d732c2a80d (diff) | |
download | ATCD-e67dbedfe787e0bcb409990d4d586c2969963a75.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Filecache.h')
-rw-r--r-- | ace/Filecache.h | 109 |
1 files changed, 4 insertions, 105 deletions
diff --git a/ace/Filecache.h b/ace/Filecache.h index 499a121174b..86a0eb493c5 100644 --- a/ace/Filecache.h +++ b/ace/Filecache.h @@ -134,6 +134,10 @@ public: ~ACE_Filecache (void); + ACE_Filecache_Object *find (const char *filename); + // Return the file associated with ``filename'' if it is in the cache, + // or NULL if not. + ACE_Filecache_Object *fetch (const char *filename); // Return the file associated with ``filename'' if it is in the cache, // or create if not. @@ -181,109 +185,4 @@ private: static ACE_SYNCH_RW_MUTEX lock_; }; -class ACE_Export ACE_Filecache_Object - // = TITLE - // 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. -{ -public: - ACE_Filecache_Object (const char *filename); - // Creates a file for reading. - - ACE_Filecache_Object (const char *filename, - int size); - // Creates a file for writing. - - ~ACE_Filecache_Object (void); - // Only if reference count is zero should this be called. - - int acquire (void); - // Increment the reference_count_. - - int release (void); - // Decrement the reference_count_. - - // = action_ accessors - int action (void) const; - int action (int action_value); - - // = error_ accessors - int error (void) const; - int error (int error_value, - const char *s = "ACE_Filecache_Object"); - - const char *filename (void) const; - // filename_ accessor - - ACE_HANDLE handle (void) const; - // handle_ accessor. - - void *address (void) const; - // Base memory address for memory mapped file. - - size_t size (void) const; - // size_ accessor. - - int update (void) const; - // True if file on disk is newer than cached file. - -protected: - ACE_Filecache_Object (void); - // Prevent from being called. - - void init (void); - // Common initialization code, - -private: - int error_i (int error_value, - const char *s = "ACE_Filecache_Object"); - // Internal error logging method, no locking. - -public: - - enum - { - READING = 1, - WRITING = 2 - }; - - enum - { - SUCCESS = 0, - ACCESS_FAILED, - OPEN_FAILED, - COPY_FAILED, - STAT_FAILED, - MEMMAP_FAILED, - WRITE_FAILED - }; - -private: - char *tempname_; - char filename_[MAXPATHLEN + 1]; - // The temporary file name and the real file name. The real file is - // copied into the temporary file for safety reasons. - - ACE_Mem_Map mmap_; - ACE_HANDLE handle_; - // mmap_ holds the memory mapped version of the temporary file. - // handle_ is the descriptor to the temporary file. - - struct stat stat_; - size_t size_; - // Used to compare against the real file to test if an update is needed. - - int action_; - int error_; - // Status indicators. - - int reference_count_; - ACE_SYNCH_RW_MUTEX lock_; - // reference_count_ counts how many users of the file there are. - // lock_ provides a synchronization mechanism for critical sections - // of code. -}; - #endif /* ACE_FILECACHE_H */ |