TAO  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
TAO::Storable_File_Guard Class Referenceabstract

Base class to use with TAO_Storable_Base to synch object state with a storable base. More...

#include <Storable_File_Guard.h>

Collaboration diagram for TAO::Storable_File_Guard:
Collaboration graph

Public Types

enum  Method_Type { CREATE_WITH_FILE, CREATE_WITHOUT_FILE, ACCESSOR, MUTATOR }
 

Public Member Functions

 Storable_File_Guard (bool redundant, bool use_backup=Storable_Base::use_backup_default)
 
virtual ~Storable_File_Guard ()
 
void release (void)
 
virtual time_t get_object_last_changed ()=0
 Return when the object in memory has last changed. More...
 
TAO::Storable_Basepeer ()
 Get the underlying stream being used. More...
 

Protected Member Functions

void init (Method_Type method_type)
 
virtual bool object_obsolete (void)
 Check if the object is current with the last update. More...
 
virtual void mark_object_current (void)
 Mark the object as up to date. More...
 
virtual void set_object_last_changed (const time_t &time)=0
 Indicate when the object in memory has last changed. More...
 
virtual int load_from_stream ()=0
 Load object from file to memory. Return 0 on success. More...
 
virtual bool is_loaded_from_stream ()=0
 Answer if object has been loaded from file. More...
 
virtual Storable_Basecreate_stream (const char *mode)=0
 

Protected Attributes

Storable_Basefl_
 The pointer to the actual file I/O (bridge pattern) More...
 

Private Types

enum  { mode_write = 1, mode_read = 2, mode_create = 4 }
 Symbolic values for the flags in the above. More...
 

Private Member Functions

int load ()
 

Private Attributes

bool redundant_
 
int closed_
 A flag to keep us from trying to close things more than once. More...
 
int rwflags_
 The flags that we were opened with. More...
 
bool use_backup_
 A flag indicating if backup/restore should be performed. More...
 

Detailed Description

Base class to use with TAO_Storable_Base to synch object state with a storable base.

A guard for Storable_Base that opens a file for read/write and sets a lock on it. It then checks if the file has changed and re-reads it if it has.

Member Enumeration Documentation

anonymous enum
private

Symbolic values for the flags in the above.

Enumerator
mode_write 
mode_read 
mode_create 
enum TAO::Storable_File_Guard::Method_Type

Indicate how the state of the object is being used. This is used for determine the mode for accessing the persistent store.

Enumerator
CREATE_WITH_FILE 

Construction with persistent file already existing.

CREATE_WITHOUT_FILE 

Construction with persistent file not existing.

ACCESSOR 

Getting object state.

MUTATOR 

Setting object state.

Constructor & Destructor Documentation

TAO::Storable_File_Guard::Storable_File_Guard ( bool  redundant,
bool  use_backup = Storable_Base::use_backup_default 
)
TAO::Storable_File_Guard::~Storable_File_Guard ( )
virtual

Member Function Documentation

virtual Storable_Base* TAO::Storable_File_Guard::create_stream ( const char *  mode)
protectedpure virtual
virtual time_t TAO::Storable_File_Guard::get_object_last_changed ( )
pure virtual

Return when the object in memory has last changed.

void TAO::Storable_File_Guard::init ( Method_Type  method_type)
protected

Should be called by constructors of derived classes since can't call the virtual functions below in constructor of this class.

virtual bool TAO::Storable_File_Guard::is_loaded_from_stream ( )
protectedpure virtual

Answer if object has been loaded from file.

int TAO::Storable_File_Guard::load ( )
private
virtual int TAO::Storable_File_Guard::load_from_stream ( )
protectedpure virtual

Load object from file to memory. Return 0 on success.

void TAO::Storable_File_Guard::mark_object_current ( void  )
protectedvirtual

Mark the object as up to date.

bool TAO::Storable_File_Guard::object_obsolete ( void  )
protectedvirtual

Check if the object is current with the last update.

TAO::Storable_Base & TAO::Storable_File_Guard::peer ( )

Get the underlying stream being used.

void TAO::Storable_File_Guard::release ( void  )

Releases the lock, closes the file, and deletes the I/O stream. Destructors of derived classes should call this this will virtual functions are available.

virtual void TAO::Storable_File_Guard::set_object_last_changed ( const time_t &  time)
protectedpure virtual

Indicate when the object in memory has last changed.

Member Data Documentation

int TAO::Storable_File_Guard::closed_
private

A flag to keep us from trying to close things more than once.

Storable_Base* TAO::Storable_File_Guard::fl_
protected

The pointer to the actual file I/O (bridge pattern)

bool TAO::Storable_File_Guard::redundant_
private
int TAO::Storable_File_Guard::rwflags_
private

The flags that we were opened with.

bool TAO::Storable_File_Guard::use_backup_
private

A flag indicating if backup/restore should be performed.


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