Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TAO_Notify::Random_File Class Reference

A random file class. More...

#include <Random_File.h>

Inheritance diagram for TAO_Notify::Random_File:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify::Random_File:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Random_File ()
 The constructor.
 ~Random_File ()
 The destructor, which closes the open file.
bool open (const char *filename, size_t block_size=512)
 Open a file with default permissions.
size_t block_size () const
size_t size () const
 Return the current file size, in number of blocks.
bool write (const size_t block_number, void *buffer, bool atomic=false)
bool read (const size_t block_number, void *buffer)
 Read a block from our file.

Private Member Functions

bool seek (const size_t block_number)
 Seek to a given block number, used by reads and writes.
bool sync ()
 Synchronize the file to disk, used to implement atomic.

Private Attributes

size_t block_size_
ACE_SYNCH_MUTEX lock_

Detailed Description

A random file class.

Derived from ACE_FILE, this class provides access to a file of fixed-size blocks.


Constructor & Destructor Documentation

TAO_Notify::Random_File::Random_File  ) 
 

The constructor.

TAO_Notify::Random_File::~Random_File  ) 
 

The destructor, which closes the open file.


Member Function Documentation

size_t TAO_Notify::Random_File::block_size  )  const
 

Accessor for the block size. Note signed size_t is used to be compatible with ACE_FILE.

bool TAO_Notify::Random_File::open const char *  filename,
size_t  block_size = 512
 

Open a file with default permissions.

bool TAO_Notify::Random_File::read const size_t  block_number,
void *  buffer
 

Read a block from our file.

bool TAO_Notify::Random_File::seek const size_t  block_number  )  [private]
 

Seek to a given block number, used by reads and writes.

size_t TAO_Notify::Random_File::size  )  const
 

Return the current file size, in number of blocks.

bool TAO_Notify::Random_File::sync  )  [private]
 

Synchronize the file to disk, used to implement atomic.

bool TAO_Notify::Random_File::write const size_t  block_number,
void *  buffer,
bool  atomic = false
 

Write a block to our file, potentially as an "atomic" write. If the atomic argument is true, then the operating system's write-through cache for this file is flushed both before and after the write. The flush before ensures that any record pointers in this block will point to records that actually appear in the file. The flush after provides the caller with a guarantee that the data will appear in the file even if the system fails immediately after this method returns.


Member Data Documentation

size_t TAO_Notify::Random_File::block_size_ [private]
 

ACE_SYNCH_MUTEX TAO_Notify::Random_File::lock_ [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Dec 31 16:11:18 2004 for TAO_CosNotification by  doxygen 1.3.9.1