OSB_LIB::BsStorage Class Reference

Collaboration diagram for OSB_LIB::BsStorage:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class handles the storing of cdrs.

This class provides functions to handle storing a list of cdrs to the corresponding balance sheets and to the file system.

Definition at line 75 of file bsstorage.h.

Public Member Functions

Private Types

Private Attributes

Friends

Classes


Member Typedef Documentation

typedef std::map<Contract::Oid, BsCdrs> OSB_LIB::BsStorage::BsMap [private]

Link an unique contract id to each balance sheet.

Definition at line 101 of file bsstorage.h.


Constructor & Destructor Documentation

OSB_LIB::BsStorage::BsStorage (  )  [inline]

Default constructor.

Definition at line 105 of file bsstorage.h.


Member Function Documentation

void OSB_LIB::BsStorage::addCdr ( const Cdr cdr  ) 

Add rated CDR to container.

Parameters:
cdr CDR to add.

void OSB_LIB::BsStorage::assignCdrs ( const OSB_DB::Session session  ) 

Assign CDRs to balance sheets.

Parameters:
session Database session used by the balance sheets to create new pages if needed.
Call BalanceSheet::addUsage() for each balance sheet in bsMap_.

void OSB_LIB::BsStorage::clearRecoveryId ( const OSB_DB::Session session  ) 

Unset the recovery id in all balance sheets.

Parameters:
session Database session to use.
Exceptions:
OsbException from BalanceSheet::clearRecoveryId().
Returns:
False if any balance sheet fails to unset the recovery id, else true.
Calls BalanceSheet::clearRecoveryId() for all balance sheets.

void OSB_LIB::BsStorage::commitCdrs (  ) 

Commit CDR changes to the file system.

Clean-up any files needed for recovery that have been created during writeCdrs().

Exceptions:
OsbException from BalanceSheet::commitCdrs().
Calls BalanceSheet::commitCdrs() for all balance sheets.

ContainerIter OSB_LIB::BsStorage::containerBegin (  ) 

Return an iterator to the 1st CdrList in bsMap_.

ContainerIter OSB_LIB::BsStorage::containerEnd (  ) 

Return an iterator to the last CdrList in bsMap_.

void OSB_LIB::BsStorage::eraseBs ( const Contract::Oid coId  ) 

Remove a balance sheet from bsMap_.

Parameters:
coId Contract id of the balance sheet.
Exceptions:
OsbException if the balance sheet exists in bsMap_ and is locked.

BalanceSheet& OSB_LIB::BsStorage::getBs ( const Contract::Oid coId  ) 

Get a balance sheet from bsMap_.

Parameters:
coId Contract id of the balance sheet.
Exceptions:
OsbException if the balance sheet for the contract does not exist in bsMap_.
Returns:
Reference to the balance sheet in bsMap_.

void OSB_LIB::BsStorage::insertBs ( const Contract::Oid coId  ) 

Insert an empty balance sheet into bsMap_.

Parameters:
coId Contract id of the balance sheet.
Exceptions:
OsbException if the balance sheet for the contract already exists in bsMap_.

void OSB_LIB::BsStorage::lockBs ( const OSB_DB::Session session  ) 

Lock all balance sheets.

Parameters:
session Database session to use.
Locks all balance sheets in bsMap_ and reads their usage charges.

long OSB_LIB::BsStorage::numBs (  )  const

Number of BalanceSheet in bsMap_.

long OSB_LIB::BsStorage::numCdrs (  )  const [inline]

Return the number of cdrs that are stored.

A count done on the number of cdrs before they are saved to the corresponding balance sheets.

Definition at line 247 of file bsstorage.h.

References numCdrs_.

void OSB_LIB::BsStorage::reset (  ) 

Reset internal data for a new batch of Cdr.

Remarks:
The current implementation just calls clear() on bsMap_.

bool OSB_LIB::BsStorage::restoreCdrs ( OSB_DB::Session session  ) 

Restore CDRs after a failure.

Parameters:
session Database session to unset and commit the recovery id to the database.
Returns:
true if restoring the CDRs is successful for all modified balance sheets, else false.

void OSB_LIB::BsStorage::setUnlocked (  ) 

Unlocked balance sheets.

void OSB_LIB::BsStorage::updateBs ( const OSB_DB::Session session  ) 

Update the usage charges of the balance sheets in the database.

Parameters:
session Database session to use.

void OSB_LIB::BsStorage::writeCdrs ( long  recoveryId,
OSB_DB::Session session,
Asn1Writer writer 
)

Write the CDRs to the file system.

Parameters:
recoveryId Recovery mark to write to the CDR file.
session Session used to update and commit the recovery id in the database.
writer ASN.1 writer to use.
Todo:
Comprehensive doc.


Friends And Related Function Documentation

friend class ContainerIter [friend]

The CDR list iterator class must know how the CDR containers are organized.

Definition at line 78 of file bsstorage.h.


Member Data Documentation

BsMap OSB_LIB::BsStorage::bsMap_ [private]

Container with modified balance sheets and related CDRs.

bsMap_ should contain only balance sheets that are modified during the rating process. This is to avoid unnecessary locking of balance sheets.

Note:
An alternative to the rule above would be to add a corresponding flag to BsCdrs.

Definition at line 266 of file bsstorage.h.

long OSB_LIB::BsStorage::numCdrs_ [private]

Number of added CDRs.

Definition at line 268 of file bsstorage.h.

Referenced by numCdrs().


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