TAO_CosNotification  2.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all 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
Collaboration diagram for TAO_Notify::Random_File:
Collaboration graph

Public Member Functions

 Random_File ()
 The constructor.
 
 ~Random_File ()
 The destructor, which closes the open file.
 
bool open (const ACE_TCHAR *filename, size_t block_size=512)
 Open a file with default permissions.
 
size_t block_size () const
 
ACE_OFF_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.
 
- Public Member Functions inherited from ACE_FILE
int close (void)
 
int remove (void)
 
int unlink (void)
 
int get_info (ACE_FILE_Info *finfo)
 
int get_info (ACE_FILE_Info &finfo)
 
int truncate (ACE_OFF_T length)
 
ACE_OFF_T seek (ACE_OFF_T offset, int whence=SEEK_CUR)
 
ACE_OFF_T tell (void)
 
int disable (int signum) const
 
int get_local_addr (ACE_Addr &) const
 
int get_remote_addr (ACE_Addr &) const
 
void dump (void) const
 
 ~ACE_IO_SAP (void)
 
int control (int cmd, void *) const
 
int enable (int value) const
 
int disable (int value) const
 
ACE_HANDLE get_handle (void) const
 
void set_handle (ACE_HANDLE handle)
 
void dump (void) const
 
- Public Member Functions inherited from ACE_IO_SAP
 ~ACE_IO_SAP (void)
 
int control (int cmd, void *) const
 
int enable (int value) const
 
int disable (int value) const
 
ACE_HANDLE get_handle (void) const
 
void set_handle (ACE_HANDLE handle)
 
void dump (void) const
 

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_
 
TAO_SYNCH_MUTEX lock_
 

Additional Inherited Members

- Public Attributes inherited from ACE_FILE
 ACE_ALLOC_HOOK_DECLARE
 
 INVALID_HANDLE
 
- Protected Member Functions inherited from ACE_FILE
 ACE_FILE (void)
 
 ACE_IO_SAP (void)
 
- Protected Attributes inherited from ACE_FILE
ACE_FILE_Addr addr_
 

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 ACE_TCHAR 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.

ACE_OFF_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
TAO_SYNCH_MUTEX TAO_Notify::Random_File::lock_
mutableprivate

The documentation for this class was generated from the following files: