TAO_CosNotification
2.3.1
|
A random file class. More...
#include <Random_File.h>
Public Member Functions | |
Random_File () | |
The constructor. More... | |
~Random_File () | |
The destructor, which closes the open file. More... | |
bool | open (const ACE_TCHAR *filename, size_t block_size=512) |
Open a file with default permissions. More... | |
size_t | block_size () const |
ACE_OFF_T | size () const |
Return the current file size, in number of blocks. More... | |
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. More... | |
![]() | |
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 |
Private Member Functions | |
bool | seek (const size_t block_number) |
Seek to a given block number, used by reads and writes. More... | |
bool | sync () |
Synchronize the file to disk, used to implement atomic. More... | |
Private Attributes | |
size_t | block_size_ |
TAO_SYNCH_MUTEX | lock_ |
Additional Inherited Members | |
![]() | |
ACE_ALLOC_HOOK_DECLARE | |
![]() | |
ACE_FILE (void) | |
![]() | |
ACE_FILE_Addr | addr_ |
A random file class.
Derived from ACE_FILE, this class provides access to a file of fixed-size blocks.
TAO_Notify::Random_File::Random_File | ( | ) |
The constructor.
TAO_Notify::Random_File::~Random_File | ( | ) |
The destructor, which closes the open file.
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.
|
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.
|
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.
|
private |
|
mutableprivate |