casacore
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::BucketBuffered Class Reference

More...

#include <BucketBuffered.h>

Public Member Functions

 BucketBuffered (BucketFile *file, Int64 startOffset, uInt bucketSize, uInt nrOfBuckets)
 Create the object for (part of) a file. More...
 
virtual ~BucketBuffered ()
 
char * getBuffer ()
 Get a pointer to the buffer. More...
 
void read (uInt bucketNr, uInt bucketOffset, uInt nbytes, uInt bufferOffset=0)
 Read the given part into the internal buffer at the given offset. More...
 
void write (uInt bucketNr, uInt bucketOffset, uInt nbytes)
 Write the given part from the internal buffer. More...
 
- Public Member Functions inherited from casacore::BucketBase
 BucketBase (BucketFile *file, Int64 startOffset, uInt bucketSize, uInt nrOfBuckets)
 Create the bucket access for (part of) a file. More...
 
virtual ~BucketBase ()
 Detach the file. More...
 
Bool flush ()
 Flush the cached buckets. More...
 
virtual void resync (uInt nrBucket)
 Resynchronize the object (after another process updated the file). More...
 
uInt nBucket () const
 Get the current nr of buckets in the file. More...
 
void extend (uInt nrBucket)
 Extend the file with the given number of buckets. More...
 
void setWritten ()
 Set that data has been written. More...
 

Private Member Functions

 BucketBuffered (const BucketBuffered &)
 Copy constructor is not possible. More...
 
BucketBufferedoperator= (const BucketBuffered &)
 Assignment is not possible. More...
 
virtual void doFlush ()
 Flush the file. More...
 
virtual void doResync ()
 Do the actual resync-ing. More...
 
virtual void doExtend (uInt nrBucket)
 Extend the file with the given number of buckets. More...
 
virtual void initializeBuckets (uInt bucketNr)
 Initialize the bucket buffer. More...
 

Private Attributes

char * itsBuffer
 Data buffer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from casacore::BucketBase
 BucketBase (const BucketBase &)
 Copy constructor is not possible. More...
 
BucketBaseoperator= (const BucketBase &)
 Assignment is not possible. More...
 
- Protected Attributes inherited from casacore::BucketBase
BucketFileitsFile
 The file used. More...
 
Int64 itsStartOffset
 The starting offsets of the buckets in the file. More...
 
uInt itsBucketSize
 The bucket size. More...
 
uInt itsCurNrOfBuckets
 The current nr of buckets in the file. More...
 
uInt itsNewNrOfBuckets
 The new nr of buckets in the file (after extension). More...
 
Bool itsHasWritten
 Have data been written? More...
 

Detailed Description

Use buffered file IO for buckets in a part of a file

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Prerequisite

Synopsis

BucketBuffered is similar to class BucketCache and is meant to be used by the storage managers of the Table System.

It gives access to buckets in a file by means of memory-buffered files. However, its functionality is a subset of BucketCache and is only meant to be used by the Tiled Storage Managers. If The Standard and Incremental Storage Manager also want to use it, functions like extend needs to be added to this class. Also support for a free bucket list needs to be added.

Motivation

Use of BucketCache is sub-optimal when having large buckets and more or less random IO. Memory-buffering behaves much better.

Definition at line 75 of file BucketBuffered.h.

Constructor & Destructor Documentation

◆ BucketBuffered() [1/2]

casacore::BucketBuffered::BucketBuffered ( BucketFile file,
Int64  startOffset,
uInt  bucketSize,
uInt  nrOfBuckets 
)

Create the object for (part of) a file.

The file part buffered into memory starts at startOffset. Its length is bucketSize*nrOfBuckets bytes. If the file is smaller, the remainder is indicated as an extension similarly to the behaviour of function extend.

◆ ~BucketBuffered()

virtual casacore::BucketBuffered::~BucketBuffered ( )
virtual

◆ BucketBuffered() [2/2]

casacore::BucketBuffered::BucketBuffered ( const BucketBuffered )
private

Copy constructor is not possible.

Member Function Documentation

◆ doExtend()

virtual void casacore::BucketBuffered::doExtend ( uInt  nrBucket)
privatevirtual

Extend the file with the given number of buckets.

Implements casacore::BucketBase.

◆ doFlush()

virtual void casacore::BucketBuffered::doFlush ( )
privatevirtual

Flush the file.

Implements casacore::BucketBase.

◆ doResync()

virtual void casacore::BucketBuffered::doResync ( )
privatevirtual

Do the actual resync-ing.

Implements casacore::BucketBase.

◆ getBuffer()

char* casacore::BucketBuffered::getBuffer ( )
inline

Get a pointer to the buffer.

Definition at line 89 of file BucketBuffered.h.

References itsBuffer.

◆ initializeBuckets()

virtual void casacore::BucketBuffered::initializeBuckets ( uInt  bucketNr)
privatevirtual

Initialize the bucket buffer.

The uninitialized buckets before this bucket are also initialized.

Implements casacore::BucketBase.

◆ operator=()

BucketBuffered& casacore::BucketBuffered::operator= ( const BucketBuffered )
private

Assignment is not possible.

◆ read()

void casacore::BucketBuffered::read ( uInt  bucketNr,
uInt  bucketOffset,
uInt  nbytes,
uInt  bufferOffset = 0 
)

Read the given part into the internal buffer at the given offset.

◆ write()

void casacore::BucketBuffered::write ( uInt  bucketNr,
uInt  bucketOffset,
uInt  nbytes 
)

Write the given part from the internal buffer.

Member Data Documentation

◆ itsBuffer

char* casacore::BucketBuffered::itsBuffer
private

Data buffer.

Definition at line 121 of file BucketBuffered.h.

Referenced by getBuffer().


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