TAO  2.3.3
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TAO::Storable_FlatFileStream Class Reference

A Storable_Base derived class that works with a file stream. More...

#include <Storable_FlatFileStream.h>

Inheritance diagram for TAO::Storable_FlatFileStream:
Inheritance graph
[legend]
Collaboration diagram for TAO::Storable_FlatFileStream:
Collaboration graph
[legend]

Public Member Functions

 Storable_FlatFileStream (const ACE_CString &file, const char *mode, bool use_backup=Storable_Base::use_backup_default)
 
virtual ~Storable_FlatFileStream ()
 
virtual int exists ()
 Check if a file exists on disk (file is not open) More...
 
virtual int open ()
 Open a file (the remaining methods below all require an open file) More...
 
virtual int close ()
 Acquire a file lock. More...
 
virtual int flock (int whence, int start, int len)
 Acquire a file lock. More...
 
virtual int funlock (int whence, int start, int len)
 Release a file lock. More...
 
virtual time_t last_changed (void)
 Returns the last time an open file was changed. More...
 
virtual void rewind (void)
 
virtual bool flush (void)
 
virtual int sync (void)
 
virtual Storable_Baseoperator<< (const ACE_CString &str)
 
virtual Storable_Baseoperator>> (ACE_CString &str)
 
virtual Storable_Baseoperator<< (int i)
 
virtual Storable_Baseoperator>> (int &i)
 
virtual Storable_Baseoperator<< (unsigned int i)
 
virtual Storable_Baseoperator>> (unsigned int &i)
 
virtual Storable_Baseoperator<< (const TAO_OutputCDR &cdr)
 
virtual size_t write (size_t size, const char *bytes)
 
virtual size_t read (size_t size, char *bytes)
 
virtual int restore_backup ()
 
- Public Member Functions inherited from TAO::Storable_Base
 Storable_Base (bool use_backup)
 
virtual ~Storable_Base ()
 
bool use_backup ()
 
void remove ()
 
void clear (Storable_State state=goodbit)
 
void setstate (Storable_State state)
 
Storable_State rdstate (void) const
 
bool good (void) const
 
bool bad (void) const
 
bool eof (void) const
 
bool fail (void) const
 

Protected Member Functions

virtual void do_remove ()
 
virtual void remove_backup ()
 If a backup file exists, remove it. More...
 
virtual int create_backup ()
 

Private Member Functions

void throw_on_read_error (Storable_State state)
 
void throw_on_write_error (Storable_State state)
 
ACE_CString backup_file_name ()
 

Private Attributes

ACE_OS::ace_flock_t filelock_
 
FILE * fl_
 
ACE_CString file_
 
ACE_CString mode_
 

Additional Inherited Members

- Public Types inherited from TAO::Storable_Base
enum  Storable_State { goodbit = 0, badbit = 1, eofbit = 2, failbit = 4 }
 
- Static Public Member Functions inherited from TAO::Storable_Base
static ACE_CString state_as_string (Storable_State state)
 
- Static Public Attributes inherited from TAO::Storable_Base
static bool use_backup_default = false
 
- Protected Attributes inherited from TAO::Storable_Base
bool use_backup_
 

Detailed Description

A Storable_Base derived class that works with a file stream.

Constructor & Destructor Documentation

TAO::Storable_FlatFileStream::Storable_FlatFileStream ( const ACE_CString file,
const char *  mode,
bool  use_backup = Storable_Base::use_backup_default 
)
TAO::Storable_FlatFileStream::~Storable_FlatFileStream ( )
virtual

Member Function Documentation

ACE_CString TAO::Storable_FlatFileStream::backup_file_name ( )
private
int TAO::Storable_FlatFileStream::close ( void  )
virtual

Acquire a file lock.

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::create_backup ( )
protectedvirtual

Implements TAO::Storable_Base.

void TAO::Storable_FlatFileStream::do_remove ( )
protectedvirtual

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::exists ( )
virtual

Check if a file exists on disk (file is not open)

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::flock ( int  whence,
int  start,
int  len 
)
virtual

Acquire a file lock.

Implements TAO::Storable_Base.

bool TAO::Storable_FlatFileStream::flush ( void  )
virtual

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::funlock ( int  whence,
int  start,
int  len 
)
virtual

Release a file lock.

Implements TAO::Storable_Base.

time_t TAO::Storable_FlatFileStream::last_changed ( void  )
virtual

Returns the last time an open file was changed.

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::open ( void  )
virtual

Open a file (the remaining methods below all require an open file)

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator<< ( const ACE_CString str)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator<< ( int  i)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator<< ( unsigned int  i)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator<< ( const TAO_OutputCDR cdr)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator>> ( ACE_CString str)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator>> ( int &  i)
virtual

Implements TAO::Storable_Base.

TAO::Storable_Base & TAO::Storable_FlatFileStream::operator>> ( unsigned int &  i)
virtual

Implements TAO::Storable_Base.

size_t TAO::Storable_FlatFileStream::read ( size_t  size,
char *  bytes 
)
virtual

Implements TAO::Storable_Base.

void TAO::Storable_FlatFileStream::remove_backup ( )
protectedvirtual

If a backup file exists, remove it.

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::restore_backup ( )
virtual

Implements TAO::Storable_Base.

void TAO::Storable_FlatFileStream::rewind ( void  )
virtual

Implements TAO::Storable_Base.

int TAO::Storable_FlatFileStream::sync ( void  )
virtual

Force write of storable data to storage. Returns 0 on success, otherwise EOF

Implements TAO::Storable_Base.

void TAO::Storable_FlatFileStream::throw_on_read_error ( Storable_State  state)
private

Throw a Storable_Read_Exception if the state is not good due to a read error.

void TAO::Storable_FlatFileStream::throw_on_write_error ( Storable_State  state)
private

Throw a Storable_Write_Exception if the state is not good due to a write error.

size_t TAO::Storable_FlatFileStream::write ( size_t  size,
const char *  bytes 
)
virtual

Implements TAO::Storable_Base.

Member Data Documentation

ACE_CString TAO::Storable_FlatFileStream::file_
private
ACE_OS::ace_flock_t TAO::Storable_FlatFileStream::filelock_
private
FILE* TAO::Storable_FlatFileStream::fl_
private
ACE_CString TAO::Storable_FlatFileStream::mode_
private

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