casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes
casa::TableLockData Class Reference

Class to hold table lock data. More...

#include <TableLockData.h>

Inheritance diagram for casa::TableLockData:
casa::TableLock

List of all members.

Public Types

typedef MemoryIOReleaseCallBack (void *parentObject, Bool always)
 Define the signature of the callback function when a lock is released.

Public Member Functions

 TableLockData (const TableLock &lockOptions, ReleaseCallBack *=0, void *releaseParentObject=0)
 Construct from the given TableLock object.
 ~TableLockData ()
void makeLock (const String &name, Bool create, FileLocker::LockType, uInt locknr=0)
 Create the LockFile object and acquire a read or write lock when permanent locking is in effect.
Bool acquire (MemoryIO *info, FileLocker::LockType, uInt nattempts)
 Acquire a read or write lock.
void release (Bool always=False)
 Release the lock.
void autoRelease (Bool always=False)
 When the inspection interval has expired, inspect if another process needs the lock.
Bool hasLock (FileLocker::LockType) const
 Has this process the read or write lock, thus can the table be read or written safely?
Bool isMultiUsed () const
 Is the table in use (i.e.
void getInfo (MemoryIO &info)
 Get or put the info in the lock file.
void putInfo (const MemoryIO &info)

Private Member Functions

 TableLockData (const TableLockData &that)
 
     

TableLockDataoperator= (const TableLockData &that)
 Assignment is forbidden.

Private Attributes

LockFileitsLock
ReleaseCallBackitsReleaseCallBack
void * itsReleaseParent

Detailed Description

Class to hold table lock data.

Intended use:

Internal

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tTable

Prerequisite

Synopsis

This class keeps the LockFile object used to do the actual locking/unlocking. It also keeps the synchronization information.

Motivation

Encapsulate Table locking data.

Definition at line 63 of file TableLockData.h.


Member Typedef Documentation

typedef MemoryIO* casa::TableLockData::ReleaseCallBack(void *parentObject, Bool always)

Define the signature of the callback function when a lock is released.

The flag always tells if the callback function should always write its main data (meant for case that table gets closed). The callback function has to write the synchronization data (preferably in canonical format) in a MemoryIO object. A pointer to this MemoryIO object has to be returned. A zero pointer can be returned when no synchronization data is available.

Definition at line 73 of file TableLockData.h.


Constructor & Destructor Documentation

casa::TableLockData::TableLockData ( const TableLock lockOptions,
ReleaseCallBack = 0,
void *  releaseParentObject = 0 
)

Construct from the given TableLock object.

     

Copy constructor is forbidden.


Member Function Documentation

Acquire a read or write lock.

It throws an exception when acquire failed while it had to wait.

void casa::TableLockData::autoRelease ( Bool  always = False) [inline]

When the inspection interval has expired, inspect if another process needs the lock.

If so, release the lock. always=True means that the inspection is always done, thus not every 25th call or so.

Definition at line 138 of file TableLockData.h.

References casa::TableLock::AutoLocking, casa::LockFile::inspect(), itsLock, casa::TableLock::option(), and release().

Referenced by casa::ColumnSet::autoReleaseLock().

void casa::TableLockData::getInfo ( MemoryIO info) [inline]

Get or put the info in the lock file.

Definition at line 150 of file TableLockData.h.

References casa::LockFile::getInfo(), and itsLock.

Has this process the read or write lock, thus can the table be read or written safely?

Definition at line 134 of file TableLockData.h.

References casa::LockFile::hasLock(), itsLock, and casa::True.

Referenced by casa::ColumnSet::checkReadLock(), casa::ColumnSet::checkWriteLock(), and casa::ExternalLockSync::hasLock().

Is the table in use (i.e.

open) in another process?

Definition at line 144 of file TableLockData.h.

References casa::LockFile::isMultiUsed(), and itsLock.

void casa::TableLockData::makeLock ( const String name,
Bool  create,
FileLocker::LockType  ,
uInt  locknr = 0 
)

Create the LockFile object and acquire a read or write lock when permanent locking is in effect.

It throws an exception when acquiring the lock failed.

TableLockData& casa::TableLockData::operator= ( const TableLockData that) [private]

Assignment is forbidden.

void casa::TableLockData::putInfo ( const MemoryIO info) [inline]

Definition at line 154 of file TableLockData.h.

References itsLock, and casa::LockFile::putInfo().

Release the lock.

When always==False, the lock is not released when a permanent lock is used. It does nothing when permanent locking is used. It throws an exception when the release failed. When the lock is released, the release callback function (if defined) is called to write the synchronization data.

Referenced by autoRelease(), casa::ExternalLockSync::release(), and casa::ColumnSet::userUnlock().


Member Data Documentation

Definition at line 127 of file TableLockData.h.

Referenced by autoRelease(), getInfo(), hasLock(), isMultiUsed(), and putInfo().

Definition at line 129 of file TableLockData.h.

Definition at line 130 of file TableLockData.h.


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