usagerecord.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00014 /*
00015   AUTHOR(S): Andreas Huggel (ahu)
00016 
00017   RCS information
00018    $Name: OSB_060808 $
00019    $Revision: 1.26 $
00020 
00021   License
00022    OSB rating and billing library for communication networks
00023    Copyright (C) 2004, 2005, 2006  OSB systems
00024 
00025    This file may be distributed and/or modify under the terms of the
00026    GNU General Public License (GPL) as published by the Free Software
00027    Foundation which is provided in the file LICENSE.GPL included in the
00028    packaging of this file.
00029 
00030    The file is distributed in the hope that it will be useful, but WITHOUT
00031    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00032    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00033    for more details.
00034 
00035    Holders of a OSB Commercial License may use this file under the terms
00036    and conditions of this commercial license.
00037  */
00038 #ifndef _USAGERECORD_H_
00039 #define _USAGERECORD_H_
00040 
00041 // *********************************************************************
00042 // included header files
00043 // + standard includes
00044 #include <string>
00045 #include <vector>
00046 
00047 // + local headers
00048 #include "chrono.h"
00049 #include "decimal.h"
00050 #include "osbunit.h"
00051 #include "contract.h"
00052 #include "persproduct.h"
00053 #include "product.h"
00054 #include "chargetraits.h"
00055 #include "tariff.h"
00056 #include "tariffsystem.h"
00057 #include "tariffperiod.h"
00058 #include "tcdist.h"
00059 #include "connectionpt.h"
00060 #include "tariffclass.h"
00061 #include "serviceclass.h"
00062 
00063 // + class declarations
00064 namespace OSB_LIB {
00065     class Cdr;
00066     class CdrList;
00067     class TariffCatalogue;
00068 }
00069 
00070 // *********************************************************************
00071 // namespace extensions
00072 namespace OSB_LIB {
00073 
00074 // *********************************************************************
00075 // type definitions
00076 
00077 // *********************************************************************
00078 // class definitions
00079 
00091     class Usagerecord {
00092     public:
00099         Usagerecord() {}
00100 
00101         // ToDo: To hold information of the origin of this usage record.
00103         long               callId;
00105         long               recordId;
00107         Contract::Oid      contractId;
00109         PersProduct::Oid   persProductId;
00111         ProductNode::Oid   productNodeId;
00113         Decimal            amount;
00115         ChargeTraits::Oid  chargeTraitsId;
00117         std::string        otherParty;
00119         Decimal            volume;
00121         Unit::Oid          unitId;
00123         DateTime           callStamp;
00125         Date               assigned;
00127         std::string        remark;
00129         TariffSystem::Oid  tsId;
00131         ServiceClass::Oid  scId;
00133         TariffPeriod::Oid  tpId;
00135         TariffClass::Oid   tcId;
00137         Tariff::Oid        flatTfId;
00139         Tariff::Oid        massTfId;
00141         TariffZone::Oid    tzId;
00143         ConnectionPt::Oid  ratedOriginId;
00145         ConnectionPt::Oid  ratedDestinationId;
00146 
00152         void readTariffInfoName(const TariffCatalogue& tcat);
00153 
00155         const std::string& tsName() const { return tsName_; }
00157         const std::string& scName() const { return scName_; }
00159         const std::string& tpName() const { return tpName_; }
00161         const std::string& tcName() const { return tcName_; }
00163         const std::string& flatTfName() const { return flatTfName_;}
00165         const std::string& massTfName() const { return massTfName_; }
00167         const std::string& tzName() const { return tzName_; }
00169         const std::string& ratedOriginName() const
00170         {
00171             return ratedOriginName_;
00172         }
00174         const std::string& ratedDestinationName() const
00175         {
00176             return ratedDestinationName_;
00177         }
00178     private:
00180         std::string     tsName_;
00182         std::string     scName_;
00184         std::string     tpName_;
00186         std::string     tcName_;
00188         std::string     flatTfName_;
00190         std::string     massTfName_;
00192         std::string     tzName_;
00194         std::string     ratedOriginName_;
00196         std::string     ratedDestinationName_;
00197     };
00198 
00200     typedef std::vector<Usagerecord> UrContainer;
00201 
00214     class Usagerecords {
00215     public:
00231          void write(
00232              const OSB_DB::Session& session,
00233                    bool             keepRecords = false
00234          );
00235 
00251         long read(
00252             const OSB_DB::Session& session,
00253                   long             size,
00254             const Contract::Oid&   contractId,
00255             const Date&            from,
00256             const Date&            upto
00257         );
00258 
00289         size_t cdr2Ur(const Cdr& cdr);
00290 
00305         size_t cdr2Ur(const CdrList& cdrContainer);
00306 
00308         UrContainer container;
00309     };
00310 }                                       // namespace OSB_LIB
00311 #endif                                  // #ifndef _USAGERECORD_H_

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