OSB_LIB::RatingFn Class Reference

Inheritance diagram for OSB_LIB::RatingFn:

Inheritance graph
[legend]
Collaboration diagram for OSB_LIB::RatingFn:

Collaboration graph
[legend]
List of all members.

Detailed Description

RatingFn is the object that actually rate a used service.

Definition at line 73 of file ratingfn.h.

Database operations:

Public Types

Public Member Functions

Read access to data members:
Modify data members:
Status change operations:

Static Public Member Functions

Protected Member Functions

Private Member Functions

Specific criteria checking before status changes:
These are pure virtual functions that must be reimplement by all derieved classes. Every individual derieved class implementation will have to check for their specific requirement before changing the status. For derieved classes that do not have any specific criteria checking should return true.

Specific database operations for derived classes.
The following functions are used to perform derived class specific database operations. For those derieved classes that do not have any specific database operation, will implement the functions to return true.

Private Attributes

Friends


Member Typedef Documentation

typedef std::auto_ptr<RatingFn> OSB_LIB::RatingFn::AutoPtr

Short-cut for an auto pointer.

For details see quality manual, implementation patterns: Virtual copy construction.

Reimplemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

Definition at line 101 of file ratingfn.h.

typedef Id<RatingFn> OSB_LIB::RatingFn::Oid

Type-safe, unique id of a rating function.

Definition at line 91 of file ratingfn.h.

typedef TypeId<RatingFn> OSB_LIB::RatingFn::Type

Type-safe identification of the type.

Definition at line 94 of file ratingfn.h.


Member Enumeration Documentation

enum OSB_LIB::RatingFn::RfType

Available rating function type.

Enumerator:
rfStairCase  StairCase rating function.
rfSlot  DiscountRental rating function.

Definition at line 103 of file ratingfn.h.


Constructor & Destructor Documentation

OSB_LIB::RatingFn::RatingFn ( const Oid oid = Oid()  )  [explicit]

Constructor with rating function type and optional object id.

virtual OSB_LIB::RatingFn::~RatingFn (  )  [inline, virtual]

Virtual destructor.

Definition at line 115 of file ratingfn.h.


Member Function Documentation

bool OSB_LIB::RatingFn::checkObjVs ( const OSB_DB::Session session,
OsbErrors errors 
) [protected]

Compare the object version with the database.

Parameters:
session Database session to use.
errors Gets error message if the object version does not match the database.
Returns:
true if the object version is the same as in the database, else false.

AutoPtr OSB_LIB::RatingFn::clone (  )  const

Virtual copy construction.

For details see quality manual, implementation patterns.

Reimplemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

virtual RatingFn* OSB_LIB::RatingFn::clone_ (  )  const [private, pure virtual]

Virtual copy construction.

For details see quality manual, implementation patterns.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

const Id<CtBase>& OSB_LIB::RatingFn::ctId (  )  const

Get the charge traits.

const std::string& OSB_LIB::RatingFn::currency (  )  const

Get the currency id.

bool OSB_LIB::RatingFn::freeze ( const OSB_DB::Session session,
OsbErrors errors 
) [virtual]

Set the rating function from editable to standby.

To freeze a rating function, the following criteria must be fulfilled:

Parameters:
session database session.
errors container for error messages if any.
Returns:
true if success else false.

Implements OSB_LIB::ToCfgBase.

virtual bool OSB_LIB::RatingFn::freezeSpecific ( const OSB_DB::Session session,
OsbErrors errors 
) [private, pure virtual]

Criteria checking before setting the status from editable to standby.

Parameters:
session Database session used.
errors Container for error messages if any.
Returns:
true if success else false.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::insert ( const OSB_DB::Session session  )  [private]

This function allow rating function to insert itself into database.

The object's id is not set before the function call. If the function completed successfully, the object will have it's id set, else the id will still be the same (not set).

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException for the following errors:
  • Duplicate name.

virtual bool OSB_LIB::RatingFn::insSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Insert derived class specific data members into database.

Parameters:
session Database session.
Returns:
true if success else false.
Exceptions:
OsbException for database error.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

template<typename F>
const F * OSB_LIB::RatingFn::isa ( const F *&  ptr  )  const

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

Definition at line 1194 of file ratingfn.h.

template<typename F>
F * OSB_LIB::RatingFn::isa ( F *&  ptr  ) 

Downcast to a derived class.

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

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

An example is given below:

          class DerivedFunc : public RatingFn {
              ...
          };

          void foo(const RatingFn& rf)
          {
              ...
              DerivedFunc* pRf;
              if (0 != rf.isa(pRf)) {
                  // work with pRf
              }
          }

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 1188 of file ratingfn.h.

const Oid& OSB_LIB::RatingFn::oid (  )  const

Get the rating function id.

virtual RatingFn& OSB_LIB::RatingFn::operator= ( const RatingFn rhs  )  [protected, virtual]

Assignment operator.

Remarks:
The operator is protected in order to avoid partial assignments of derived classes through pointers or references to the base class.

virtual const Decimal OSB_LIB::RatingFn::rateMoneyToVolume ( const Money money  )  const [pure virtual]

Rate a used service based on the available money.

This function takes in an amount of money and calculate the total amount of time for a call.

Parameters:
money Available money to be converted into call duration.
Returns:
Call duration.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

virtual const Money OSB_LIB::RatingFn::rateVolumeToMoney ( const TypeId< Unit > &  unitId,
const Decimal volume,
Decimal roundedVolume 
) const [pure virtual]

Rate a used service for a specific time interval.

This function takes in the total volume or length of time a service is used. It will then calculate the cost for the volume of service used and round the volume as well.

Parameters:
unitId Unit of the volume passed in.
volume Length of time a service is used.
roundedVolume Length of time after round.
Returns:
The cost of the service used for the inputed interval.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::read ( const OSB_DB::Session session  ) 

This function allow rating function to read itself from database.

Object id must be set before the function call. The id is used to retrieve other details from database and populate the object.

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException for database error.

virtual bool OSB_LIB::RatingFn::readSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Read derived class specific data members from database.

Parameters:
session Database session.
Returns:
true if success else false.
Exceptions:
OsbException for database error.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::release ( const OSB_DB::Session session,
OsbErrors errors 
) [virtual]

Set the rating function from standby to released.

To release a rating function, the following criteria must be fulfilled:

Parameters:
session database session.
errors container for error messages if any.
Returns:
true if success else false.
Exceptions:
OsbException for any database errors.

Implements OSB_LIB::ToCfgBase.

virtual bool OSB_LIB::RatingFn::releaseSpecific ( const OSB_DB::Session session,
OsbErrors errors 
) [private, pure virtual]

Criteria checking before setting the status from standby to release.

Parameters:
session Database session used.
errors Container for error messages if any.
Returns:
true if success else false.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::remove ( const OSB_DB::Session session  )  [private]

This function allow rating function to remove itself from database.

Object id must be set before the function call. The id will be unset if the function completed successfully, else no changes to the object.

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException for the following errors:
  • Object is not editable.

virtual bool OSB_LIB::RatingFn::removeSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Remove derived class specific data members from database.

Parameters:
session Database session.
Returns:
true if success else false.
Exceptions:
OsbException for database error.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::revoke ( const OSB_DB::Session session,
OsbErrors errors 
) [virtual]

Set the rating function from released to standby.

To revoke a rating function, the following criteria must be fulfilled:

Parameters:
session database session.
errors container for error messages if any.
Returns:
true if success else false.
Exceptions:
OsbException for any database errors.

Implements OSB_LIB::ToCfgBase.

virtual bool OSB_LIB::RatingFn::revokeSpecific ( const OSB_DB::Session session,
OsbErrors errors 
) [private, pure virtual]

Criteria checking before setting the status from release to standby.

Parameters:
session Database session used.
errors Container for error messages if any.
Returns:
true if success else false.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

RfType OSB_LIB::RatingFn::rfType (  )  const

Rating function type as enumeration constant.

static RfType OSB_LIB::RatingFn::rfType ( const Type t  )  [static]

Utility to convert a Type into a RfType.

void OSB_LIB::RatingFn::setCtId ( const ChargeTraits ct  ) 

Set the rating function's charge traits.

Parameters:
ct Charge traits of the rating function, only their object id and currency code is relevant.
Exceptions:
OsbException if the rating function is not editable.

void OSB_LIB::RatingFn::setUnitId ( const TypeId< Unit > &  id  ) 

Set the rating function's unit.

Parameters:
id Object id of the unit.
Exceptions:
OsbException if the rating function is not editable.

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

Get the type of rating function.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

bool OSB_LIB::RatingFn::unfreeze ( const OSB_DB::Session session,
OsbErrors errors 
) [virtual]

Set the rating function from standby to editable.

To unfreeze a rating function, the following criteria must be fulfilled:

Parameters:
session database session.
errors container for error messages if any.
Returns:
true if success else false.
Exceptions:
OsbException for any database errors.

Implements OSB_LIB::ToCfgBase.

virtual bool OSB_LIB::RatingFn::unfreezeSpecific ( const OSB_DB::Session session,
OsbErrors errors 
) [private, pure virtual]

Criteria checking before setting the status from standby to editable.

Parameters:
session Database session used.
errors Container for error messages if any.
Returns:
true if success else false.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.

const TypeId<Unit>& OSB_LIB::RatingFn::unitId (  )  const

Get the unit id.

bool OSB_LIB::RatingFn::update ( const OSB_DB::Session session  )  [private]

This function allow rating function to update itself into database.

This function will update an existing rating function object in the database. If the function completed successfully, the object's objVs will increment by 1.

Parameters:
session database session.
Returns:
true if success else false.
Exceptions:
OsbException for the following errors:
  • Object does not exist.

virtual bool OSB_LIB::RatingFn::updSpecific ( const OSB_DB::Session session  )  [private, pure virtual]

Update derived class specific data members into database.

Parameters:
session Database session.
Returns:
true if success else false.
Exceptions:
OsbException for database error.

Implemented in OSB_LIB::RfStairCase, and OSB_LIB::RfSlot.


Friends And Related Function Documentation

friend struct OSB_DB::RatingFnGw [friend]

The database gateway needs to populate data members after construction.

Definition at line 78 of file ratingfn.h.

friend class RatingFns [friend]

Allow RatingFns to insert rating function to database.

Definition at line 88 of file ratingfn.h.

friend class TariffCatalogue [friend]

Tariff Catalogue is the only object that is allow to invoke the database functions of this class.

Definition at line 83 of file ratingfn.h.


Member Data Documentation

Id<CtBase> OSB_LIB::RatingFn::ctId_ [private]

Unique id of charge traits.

Definition at line 517 of file ratingfn.h.

std::string OSB_LIB::RatingFn::currency_ [private]

Unique id of Currency, maintained together with ctId_.

Definition at line 519 of file ratingfn.h.

Oid OSB_LIB::RatingFn::oid_ [private]

Unique id of the rating function object.

Definition at line 515 of file ratingfn.h.

TypeId<Unit> OSB_LIB::RatingFn::unitId_ [private]

Unique id of unit.

Definition at line 521 of file ratingfn.h.


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