TAO_CosNotification  2.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
TAO_Notify::Persistent_Storage_Block Class Reference

A class to represent a block on disk. More...

#include <Persistent_File_Allocator.h>

Collaboration diagram for TAO_Notify::Persistent_Storage_Block:
Collaboration graph

Public Member Functions

 Persistent_Storage_Block (const size_t block_number, const size_t block_size)
 The constructor. Initializes the callback to NULL. More...
 
 Persistent_Storage_Block (const Persistent_Storage_Block &psb)
 The copy constructor. Makes a deep copy of the passed in PSB. More...
 
 ~Persistent_Storage_Block ()
 The destructor. More...
 
void set_no_write ()
 
bool get_no_write ()
 Find out whether we have data to be written. More...
 
void set_sync ()
 Set our block to be written as a near-atomic operation. More...
 
bool get_sync () const
 Find out whether this block should be written near-atomically. More...
 
size_t block_number () const
 Find out our physical block number. More...
 
unsigned char * data () const
 Return our data to the user. More...
 
void reassign_data (unsigned char *newptr, bool delete_old=false)
 Set our data pointer, and optionally delete it. More...
 
size_t detach ()
 Return block number and relinquish ownership. More...
 
void set_callback (Persistent_Callback *callback)
 Set our callback. More...
 
Persistent_Callbackget_callback () const
 Get our callback. More...
 
void set_allocator_owns (bool allocator_owns=true)
 Set ownership of this PSB. More...
 
bool get_allocator_owns () const
 Get ownership status of this PSB. More...
 

Private Attributes

unsigned char * data_
 Our raw data. More...
 
size_t block_number_
 The block number corresponding to our data. More...
 
bool no_write_
 Are we a no-op with just a callback? More...
 
bool sync_
 Write in near-atomic fashion. More...
 
size_t block_size_
 The size of our block. More...
 
Persistent_Callbackcallback_
 
bool allocator_owns_
 Does the allocator obtain ownership of our block? More...
 

Detailed Description

A class to represent a block on disk.

Contains the raw data to be written on disk as well as positioning information, synchronization information, and a pointer to a callback.

Constructor & Destructor Documentation

TAO_Notify::Persistent_Storage_Block::Persistent_Storage_Block ( const size_t  block_number,
const size_t  block_size 
)

The constructor. Initializes the callback to NULL.

TAO_Notify::Persistent_Storage_Block::Persistent_Storage_Block ( const Persistent_Storage_Block psb)

The copy constructor. Makes a deep copy of the passed in PSB.

TAO_Notify::Persistent_Storage_Block::~Persistent_Storage_Block ( )

The destructor.

Member Function Documentation

size_t TAO_Notify::Persistent_Storage_Block::block_number ( ) const

Find out our physical block number.

unsigned char * TAO_Notify::Persistent_Storage_Block::data ( ) const

Return our data to the user.

size_t TAO_Notify::Persistent_Storage_Block::detach ( )

Return block number and relinquish ownership.

bool TAO_Notify::Persistent_Storage_Block::get_allocator_owns ( ) const

Get ownership status of this PSB.

Persistent_Callback * TAO_Notify::Persistent_Storage_Block::get_callback ( ) const

Get our callback.

bool TAO_Notify::Persistent_Storage_Block::get_no_write ( )

Find out whether we have data to be written.

bool TAO_Notify::Persistent_Storage_Block::get_sync ( ) const

Find out whether this block should be written near-atomically.

void TAO_Notify::Persistent_Storage_Block::reassign_data ( unsigned char *  newptr,
bool  delete_old = false 
)

Set our data pointer, and optionally delete it.

void TAO_Notify::Persistent_Storage_Block::set_allocator_owns ( bool  allocator_owns = true)

Set ownership of this PSB.

void TAO_Notify::Persistent_Storage_Block::set_callback ( Persistent_Callback callback)

Set our callback.

void TAO_Notify::Persistent_Storage_Block::set_no_write ( )

Set our block to not have any data at all - a no-op. This can be used to implement a checkpoint in the write stream.

void TAO_Notify::Persistent_Storage_Block::set_sync ( )

Set our block to be written as a near-atomic operation.

Member Data Documentation

bool TAO_Notify::Persistent_Storage_Block::allocator_owns_
private

Does the allocator obtain ownership of our block?

size_t TAO_Notify::Persistent_Storage_Block::block_number_
private

The block number corresponding to our data.

size_t TAO_Notify::Persistent_Storage_Block::block_size_
private

The size of our block.

Persistent_Callback* TAO_Notify::Persistent_Storage_Block::callback_
private

Our optional callback function, to be used in such things as state transitions.

unsigned char* TAO_Notify::Persistent_Storage_Block::data_
private

Our raw data.

bool TAO_Notify::Persistent_Storage_Block::no_write_
private

Are we a no-op with just a callback?

bool TAO_Notify::Persistent_Storage_Block::sync_
private

Write in near-atomic fashion.


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