subsfunc.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00027 /*
00028   AUTHOR(S): Stephan Broennimann (vb)
00029 
00030   RCS information
00031    $Name: OSB_060808 $
00032    $Revision: 1.26 $
00033 
00034   License
00035    OSB rating and billing library for communication networks
00036    Copyright (C) 2004, 2005, 2006  OSB systems
00037 
00038    This file may be distributed and/or modify under the terms of the
00039    GNU General Public License (GPL) as published by the Free Software
00040    Foundation which is provided in the file LICENSE.GPL included in the
00041    packaging of this file.
00042 
00043    The file is distributed in the hope that it will be useful, but WITHOUT
00044    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00045    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00046    for more details.
00047 
00048    Holders of a OSB Commercial License may use this file under the terms
00049    and conditions of this commercial license.
00050  */
00051 #ifndef _SUBSFUNC_H_
00052 #define _SUBSFUNC_H_
00053 
00054 // *********************************************************************
00055 // included header files
00056 // + standard includes
00057 #include <string>
00058 
00059 // + local headers
00060 #include "balancesheet.h"
00061 
00062 // *********************************************************************
00063 // class declarations
00064 namespace OSB_DB {
00065     class Session;
00066 }
00067 namespace OSB_LIB {
00068     class Date;
00069     class Contract;
00070     class ProductCatalogue;
00071     class PersProduct;
00072     class PersNode;
00073     class StatusChanges;
00074 }
00075 
00076 // *********************************************************************
00077 // namespace extensions
00078 namespace OSB_LIB {
00079 
00080 // *********************************************************************
00081 // type definitions
00082 
00083 // *********************************************************************
00084 // class definitions
00085 
00086     // *****************************************************************
00087     // CLASS:     SubsChargeList
00097     class SubsChargeList {
00098     public:
00099         SubsChargeList(
00100             const PersProduct::Oid& ppId,
00101             const ProductNode::Oid& pNodeId,
00102             const Date&             billedFrom,
00103             const Date&             billedTo,
00104             const Date&             chargedFrom,
00105             const Date&             chargedTo
00106         ) : persProductId_(ppId), productNodeId_(pNodeId),
00107             billedFrom_(billedFrom), billedTo_(billedTo),
00108             chargedFrom_(chargedFrom), chargedTo_(chargedTo) {}
00109 
00123         SubsCharge& newSubsCharge(
00124             const SubsFuncCfg&   cfg,
00125             const SubsChargeDef& scd,
00126             const bool flag = true
00127         );
00128 
00138         void setBaseSubsCharge(
00139             SubsCharge&          sc,
00140             const SubsFuncCfg&   cfg,
00141             const SubsChargeDef& scd
00142         );
00143 
00145 
00146         const Date& billedFrom() const { return billedFrom_; }
00147         const Date& billedTo() const { return billedTo_; }
00148         const Date& chargedFrom() const { return chargedFrom_; }
00149         const Date& chargedTo() const { return chargedTo_; }
00151 
00153         SubsCharges& subsCharges() { return subsCharges_; }
00154 
00155     private:
00156         const PersProduct::Oid& persProductId_;  
00157         const ProductNode::Oid& productNodeId_;  
00158 
00159         const Date&             billedFrom_;     
00160         const Date&             billedTo_;       
00161 
00162         const Date&             chargedFrom_;    
00163         const Date&             chargedTo_;      
00164 
00165         SubsCharges             subsCharges_;    
00166 
00167     };
00168 
00169     // *****************************************************************
00170     // CLASS:     SubsFuncBase, compute subscription charges
00171 
00179     class SubsFuncBase {
00180     public:
00182         SubsFuncBase() {}
00183         virtual ~SubsFuncBase() {}
00184 
00189         virtual std::string
00190         typeName() const { return std::string("SubsFuncBase"); }
00191 
00199         virtual void chargeSubscription(
00200             SubsChargeList& scList,
00201             const StatusChanges& statusList
00202         ) const = 0;
00203     };
00204 
00205     // *****************************************************************
00206     // CLASS:     SubFuncOnce, charge each status once
00207 
00216     class SubFuncOnce : public SubsFuncBase {
00217     public:
00219         SubFuncOnce(const SubsFuncCfg& cfg) : cfg_(cfg) {}
00220         virtual ~SubFuncOnce() {}
00221 
00222         virtual std::string
00223         typeName() const { return std::string("SubFuncOnce"); }
00224 
00231         virtual void chargeSubscription(
00232             SubsChargeList& scList,
00233             const StatusChanges& statusList
00234         ) const;
00235 
00236     private:
00238         SubFuncOnce(const SubFuncOnce&);
00239         void operator=(const SubFuncOnce&);
00240 
00241     private:
00242         const SubsFuncCfg& cfg_;        
00243     };
00244 
00245     // *****************************************************************
00246     // CLASS:     ChargeSubscription, charge subscription fees
00247 
00259     class ChargeSubscription {
00260     public:
00262         ChargeSubscription() {}
00264 
00273         void operator()(
00274             const Contract& co,
00275             SubsCharges& subsCharges,
00276             const Date& periodStart,
00277             const Date& periodEnd
00278         );
00279 
00288         void chargeProduct(
00289                   SubsCharges& subsCharges,
00290             const PersProduct& persProduct,
00291             const Date&        periodStart,
00292             const Date&        periodEnd
00293         );
00294 
00301         SubsFuncBase*
00302         mkSubsFunc(const SubsFuncCfg&);
00303 
00304     private:
00312         SubsFuncBase* getSubsFunc(
00313             const Pricelist::Oid& plId,
00314             const Date& refDate
00315         );
00316     };
00317 
00318 }                                       // namespace OSB_LIB
00319 #endif                                  // #ifndef _SUBSFUNC_H_

Generated on Sat Sep 2 14:06:34 2006 for OSB Library by  doxygen 1.4.7