OSB_LIB::ProductItemBase Class Reference

Inheritance diagram for OSB_LIB::ProductItemBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

Abstract base class for product items and personalized product items.

The only purpose of the class is to provide a common base for product items and personalized product items. For new product item types, three classes should be defined:

Definition at line 81 of file productitem.h.

Public Types

Public Member Functions

Protected Member Functions


Member Typedef Documentation

typedef TypeId<ProductItemBase> OSB_LIB::ProductItemBase::Type

Unique identification of the product item type.

See also:
PiType defines symbolic constants for all supported types.

Definition at line 88 of file productitem.h.


Constructor & Destructor Documentation

OSB_LIB::ProductItemBase::ProductItemBase (  ) 

Empty constructor.

virtual OSB_LIB::ProductItemBase::~ProductItemBase (  )  [virtual]

Virtual destructor.

OSB_LIB::ProductItemBase::ProductItemBase ( const ProductItemBase rhs  )  [protected]

Copying for derived classes only.


Member Function Documentation

template<typename P>
const P * OSB_LIB::ProductItemBase::isa ( const P *&  ptr  )  const

Downcasting: see template<typename P> P* isa(P*&).

Definition at line 720 of file productitem.h.

template<typename P>
P * OSB_LIB::ProductItemBase::isa ( P *&  ptr  ) 

Downcast to a derived class.

The function uses dynamic_cast<P*> to downcast an object of ProductItemBase to an object of a derived class.

          ptr = dynamic_cast<P*>(this);
          return ptr;

The typical use is:

          void foo(const ProductItemBase& pi)
          {
              ...
              Item* pItem;
              if (0 != pi.isa(pItem)) {
                  // work with pItem
              }
          }

Parameters:
ptr Pointer to cast to. It gets the result of the downcast. It's value will be 0 if the cast fails.
Returns:
The argument pointer `ptr' after the downcast.

Definition at line 713 of file productitem.h.

ProductItemBase& OSB_LIB::ProductItemBase::operator= ( const ProductItemBase rhs  )  [protected]

Assignment or derived classes only.

virtual Type OSB_LIB::ProductItemBase::type (  )  const [pure virtual]

The type of the product item.

The function returns the type of the product item. It is needed for only one reason: Corba clients must provide a configuration window that depends on the actual type.

No appropriate design can be provided: Unless on-line clients use the real product item type through-out the whole live cycle of an object, there must be a way to determine the actual type of a product item. No matter how clever we make our design, for on-line clients there will always be one step where they need to determine a product item's type in a switch-like statement. For this step I personally perfer to work with an enumeration type (and compiler warnings) rather than relying on dynamic casts (where errors can be detected only during run-time).

Remarks:
Derived classes declare the function private.

Implemented in OSB_LIB::PersAn, OSB_LIB::AnItem, OSB_LIB::PersCallingCard, OSB_LIB::CallingCardItem, OSB_LIB::PersCredit, OSB_LIB::CreditItem, OSB_LIB::DeviceItem, OSB_LIB::PersE164Item, OSB_LIB::E164Item, OSB_LIB::PersIpGroup, OSB_LIB::IpGroupItem, OSB_LIB::PersUimCard, OSB_LIB::PricelistItem, OSB_LIB::DescriptionItem, OSB_LIB::PersService, OSB_LIB::ServiceItem, OSB_LIB::PersTrunk, OSB_LIB::TrunkItem, OSB_LIB::PersTariffSystem, and OSB_LIB::TariffSystemItem.


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