summaryrefslogtreecommitdiff
path: root/ace/Filecache.h
diff options
context:
space:
mode:
authorjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-09 18:44:45 +0000
committerjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-09-09 18:44:45 +0000
commit71aa04f323e15fc40f433d7e93126e53e11e74bc (patch)
tree230fd816feda10de8f1e920972d03f8575cc09d5 /ace/Filecache.h
parent5f7d233e4ba05608ba19f7be957f266d5fbfd38c (diff)
downloadATCD-71aa04f323e15fc40f433d7e93126e53e11e74bc.tar.gz
Comments and fixes that came up during JAWS code review.
Diffstat (limited to 'ace/Filecache.h')
-rw-r--r--ace/Filecache.h219
1 files changed, 110 insertions, 109 deletions
diff --git a/ace/Filecache.h b/ace/Filecache.h
index 19fc3551cc3..3aff3402e4a 100644
--- a/ace/Filecache.h
+++ b/ace/Filecache.h
@@ -25,114 +25,7 @@
// = Forward declarations.
class ACE_Filecache;
-
-
-class 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.
-{
- friend class ACE_Filecache;
-
-public:
- ACE_Filecache_Object (const char *filename,
- ACE_SYNCH_RW_MUTEX &lock);
- // Creates a file for reading.
-
- ACE_Filecache_Object (const char *filename,
- int size,
- ACE_SYNCH_RW_MUTEX &lock);
- // 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_.
-
- // = 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 stale_;
- // If set to 1, means the object is flagged for removal.
-
- ACE_SYNCH_RW_MUTEX junklock_;
- ACE_SYNCH_RW_MUTEX &lock_;
- // lock_ provides a bookkeeping mechanism for users of this object.
- // junklock_ is the default initializer
-};
+class ACE_Filecache_Object;
class ACE_Export ACE_Filecache_Handle
@@ -321,10 +214,118 @@ private:
static ACE_Filecache *cvf_;
// The reference to the instance
+ // = Synchronization variables.
static ACE_SYNCH_RW_MUTEX lock_;
static ACE_SYNCH_RW_MUTEX hash_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE];
static ACE_SYNCH_RW_MUTEX file_lock_[DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE];
- // Synchronization variables
};
+class 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.
+{
+ friend class ACE_Filecache;
+
+public:
+ ACE_Filecache_Object (const char *filename,
+ ACE_SYNCH_RW_MUTEX &lock);
+ // Creates a file for reading.
+
+ ACE_Filecache_Object (const char *filename,
+ int size,
+ ACE_SYNCH_RW_MUTEX &lock);
+ // 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_.
+
+ // = 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 Creation_States
+ {
+ READING = 1,
+ WRITING = 2
+ };
+
+ enum Error_Conditions
+ {
+ 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 stale_;
+ // If set to 1, means the object is flagged for removal.
+
+ ACE_SYNCH_RW_MUTEX junklock_;
+ ACE_SYNCH_RW_MUTEX &lock_;
+ // lock_ provides a bookkeeping mechanism for users of this object.
+ // junklock_ is the default initializer
+};
+
+
#endif /* ACE_FILECACHE_H */