OSB_LIB::PcatLockMgr Class Reference

Collaboration diagram for OSB_LIB::PcatLockMgr:

Collaboration graph
[legend]
List of all members.

Detailed Description

Lock manager for the ProductCatalogue.

The lock manager provides read-guards for individual object managed by the product catalogue and read/write guards for the various lists of objects.

For each type of object maintained by the product catalogue, the lock manager uses a RwMutex (priority for readers) to control the access to the respective list.
This means that multiple read-locks may be aquired by clients of the lock manager. However a write-lock should be requested only if NO OTHER LOCK is held. This has the following consequence: Because the product catalogue needs write-locks when creating, changing or deleting object, a client must NEVER hold a lock when calling such a method of the product catalogue.

Remarks:
When a read lock for an individual object is requested, the current implementation locks the whole list that contains the object.

Currently only products, product nodes and product items are supported.
Product nodes are not locked individually. Instead their product is locked. Because of this there is need to provide locks for all nodes of a product.

Copy constructor and destructor by compiler, compiler generated assignment operator breaks because of assignment to a reference.

ToDo: Make this class a singleton! Just imagine 2 lock managers working with the same product catalogue.

Definition at line 523 of file productcat.h.

Public Types

Guard types
The following typedefs define the guards that can be aquired from the lock manager.
Note that though the write guard types are public, the methods to get a write guard are private and therefore available only for the product catalogue.

Public Member Functions

Private Member Functions

Private Attributes

Friends


Member Typedef Documentation

typedef ReadGuard<Pricelist*> OSB_LIB::PcatLockMgr::PricelistRg

Read guard for one price list.

Definition at line 541 of file productcat.h.

typedef ReadGuard<Pricelists*> OSB_LIB::PcatLockMgr::PricelistsRg

Read guard for the list of price list.

Definition at line 543 of file productcat.h.

typedef WriteGuard<Pricelists*> OSB_LIB::PcatLockMgr::PricelistsWg

Write guard for the list of price list.

Definition at line 549 of file productcat.h.

typedef ReadGuard<ProductNode*> OSB_LIB::PcatLockMgr::ProductNodeRg

Read guard for a product node.

Definition at line 546 of file productcat.h.

typedef ReadGuard<Product*> OSB_LIB::PcatLockMgr::ProductRg

Read guard for one product.

Definition at line 537 of file productcat.h.

typedef ReadGuard<Products*> OSB_LIB::PcatLockMgr::ProductsRg

Read guard for the product list.

Definition at line 539 of file productcat.h.

typedef RwGuard OSB_LIB::PcatLockMgr::ProductsWg

Write guard for the product list.

Remarks:
Because only the product catalogue may get a write guard for all products, there is no need to provide the pointer to the list within the guard.

Definition at line 558 of file productcat.h.


Member Enumeration Documentation

enum OSB_LIB::PcatLockMgr::Status

Status of the issued guards.

Enumerator:
success  Success: none of the other values.
lockFailed  Failed to lock.
objectNotFound  Object does not exist.
wrongPiType  Wrong product item type.

Definition at line 562 of file productcat.h.


Constructor & Destructor Documentation

OSB_LIB::PcatLockMgr::PcatLockMgr ( ProductCatalogue pcat  ) 

The only constructor.

Parameters:
pcat ProductCatalogue to support.


Member Function Documentation

PricelistRg OSB_LIB::PcatLockMgr::readLock ( const Pricelist::Oid id  ) 

Read-lock a price list by its object id.

ProductNodeRg OSB_LIB::PcatLockMgr::readLock ( const Product::Oid pdId,
const ProductNode::Oid pnId 
)

Read-lock a product node.

Parameters:
pdId Id of the product.
pnId Id of the node.
Returns:
A read guard that -in case of success- contains a non-zero pointer to the product node.
If the product or the node are not found, the status of the guard is objectNotFound.

ProductRg OSB_LIB::PcatLockMgr::readLock ( const Product::Oid id  ) 

Read-lock a product by its object id.

ProductsRg OSB_LIB::PcatLockMgr::readLockPds (  ) 

Read-lock all products.

PricelistsRg OSB_LIB::PcatLockMgr::readLockPls (  ) 

Read-lock all price lists.

ProductsWg OSB_LIB::PcatLockMgr::writeLockPds (  )  [private]

Write-lock the list of all products.

PricelistsWg OSB_LIB::PcatLockMgr::writeLockPls (  )  [private]

Write-lock the list of price lists.


Friends And Related Function Documentation

friend class ProductCatalogue [friend]

Only the product catalogue may write locks.

Definition at line 525 of file productcat.h.


Member Data Documentation

ProductCatalogue& OSB_LIB::PcatLockMgr::pcat_ [private]

Product catalogue to support.

Definition at line 611 of file productcat.h.

RwMutex OSB_LIB::PcatLockMgr::pdMutex_ [private]

Mutex for products.

Definition at line 613 of file productcat.h.

RwMutex OSB_LIB::PcatLockMgr::plMutex_ [private]

Mutex for price lists.

Definition at line 615 of file productcat.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:45 2006 for OSB Library by  doxygen 1.4.7