OSB_LIB::TcatMgr Class Reference

Collaboration diagram for OSB_LIB::TcatMgr:

Collaboration graph
[legend]
List of all members.

Detailed Description

The TariffCatalogue used by the OSB library.

This singleton class provide access to the global tariff catalogue.
The OSB library internally uses only this tariff catalogue.

Remarks:
Clients of the library may define and use their own tariff catalogue.

Definition at line 72 of file tcatmgr.h.

Static Public Member Functions

Private Member Functions

Prevent construction:
Default and copy constructor not implemented.

Static Private Attributes


Constructor & Destructor Documentation

OSB_LIB::TcatMgr::TcatMgr (  )  [private]

OSB_LIB::TcatMgr::TcatMgr ( const TcatMgr  )  [private]


Member Function Documentation

static TariffCatalogue& OSB_LIB::TcatMgr::tcat (  )  [static]

Access to the global tariff catalogue.

If tcat_ is 0, the function allocates a new tariff catalogue. This is done in a fairly thread-safe way:

          tcat()
          {
              // Seems that nobody has initialized yet:
              // create a tariff catalogue.
              if (0 == tcat_) {
                  TariffCatalogue* tmp = new TariffCatalogue;
                  // If the tcat pointer is still 0, set it.
                  // Note: this is the thread critical statement.
                  if (0 == tcat_) tcat_ = tmp;
                  // Somebody else has initialized in the meantime:
                  // use its tcat pointer.
                  else delete tmp;
              }
              return *tcat_;
          }
There is only one way how applications can make ensure absolute thread safety: call the member before any threads are created.

Returns:
The global tariff catalogue instance.


Member Data Documentation

TariffCatalogue* OSB_LIB::TcatMgr::tcat_ [static, private]

Pointer to the global tariff catalogue object.

Definition at line 113 of file tcatmgr.h.


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