rpevalmgr.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.11 $
00012 
00013   License
00014    OSB rating and billing library for communication networks
00015    Copyright (C) 2004, 2005, 2006  OSB systems
00016 
00017    This file may be distributed and/or modify under the terms of the
00018    GNU General Public License (GPL) as published by the Free Software
00019    Foundation which is provided in the file LICENSE.GPL included in the
00020    packaging of this file.
00021 
00022    The file is distributed in the hope that it will be useful, but WITHOUT
00023    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00024    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00025    for more details.
00026 
00027    Holders of a OSB Commercial License may use this file under the terms
00028    and conditions of this commercial license.
00029  */
00030 #ifndef _RPEVALMGR_H_
00031 #define _RPEVALMGR_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <map>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "osberror.h"
00042 #include "osbtype.h"
00043 #include "rpeval.h"
00044 
00045 // + class declarations
00046 namespace OSB_DB {
00047     class RpEvalGw;
00048 }
00049 
00050 namespace OSB_LIB {
00051     class NetworkElement;
00052     class RatedParty;
00053     class UsageType;
00054 }
00055 
00056 // ************************************************************************
00057 // namespace extensions
00058 namespace OSB_LIB {
00059 
00060 // ************************************************************************
00061 // forward declarations
00062 
00063 // ************************************************************************
00064 // type definitions
00065 
00066 // ************************************************************************
00067 // class definitions
00078     class RpEvalMgr {
00080         friend class OSB_DB::RpEvalGw;
00081     public:
00082         // defined below
00083         class EvalExists;
00084     public:
00086         typedef TypeId<RatedParty> RpType;
00088         typedef std::map<RpType, RatedPartyEval*> RpEvals;
00090         typedef TypeId<Cdr, 1> UsgType;
00099         typedef std::map<UsgType, RpEvals> UsgEvalMap;
00101         typedef Id2<NetworkElement> NeId;
00109         typedef std::map<NeId, UsgEvalMap> EvalMap;
00110 
00111     public:
00113         RpEvalMgr();
00115         ~RpEvalMgr();
00116 
00117     private:
00119         RpEvalMgr(const RpEvalMgr&);
00121         RpEvalMgr& operator=(const RpEvalMgr&);
00122 
00123     public:                             // get RP evaluators
00125 
00126 
00134         bool resourceCacheNeeded() const;
00152         const RpEvals* getEvals(
00153             const NeId&    neId,
00154             const UsgType& usgType
00155         ) const;
00156 
00171         const RatedPartyEval* getEval(
00172             const NeId&    neId,
00173             const UsgType& usgType,
00174             const RpType&  rpType
00175         ) const;
00177 
00179 
00180 
00191         const UsgEvalMap* find(
00192             const NeId& neId
00193         ) const;
00194 
00204         const RpEvals* find(
00205             const NeId&    neId,
00206             const UsgType& usgType
00207         ) const;
00208 
00221         const RatedPartyEval* find(
00222             const NeId&    neId,
00223             const UsgType& usgType,
00224             const RpType&  rpType
00225         ) const;
00227 
00228     public:                             // maintenance
00230         void clear();
00231 
00242         void replace(
00243             const NeId&                         neId,
00244             const UsageType&                    usgType,
00245                   std::auto_ptr<RatedPartyEval> rpEval
00246         );
00247 
00258         void remove(
00259             const NeId&      neId,
00260             const UsageType& usgType,
00261             const RpType&    rpType
00262         );
00263 
00264     public:                             // database operations
00272         void read(const OSB_DB::Session& session);
00273 
00279         void save(const OSB_DB::Session& session);
00280 
00281     private:
00299         void add(
00300             const NeId&                         neId,
00301                   long                          objVs,
00302             const UsageType&                    usgType,
00303                   std::auto_ptr<RatedPartyEval> rpEval
00304         );
00305 
00310         struct ModInfo {
00316             ModInfo();
00317 
00319             long objVs_;
00324             bool dirty_;
00325         };                              // struct ModInfo
00326 
00327     private:
00328         typedef std::map<NeId, ModInfo> ModInfos;
00332         EvalMap evalMap_;
00334         ModInfos modInfo_;
00335     };                                  // class RpEvalMgr
00336 
00343     struct RpEvalUsgMap {
00345         typedef RpEvalMgr::NeId NeId;
00347         typedef RpEvalMgr::UsgEvalMap       UsgMap;
00348     public:
00353         RpEvalUsgMap(
00354             const NeId&   neId,
00355                   UsgMap& usgMap,
00356                   long    objVs
00357         ) : neId_(neId), objVs_(objVs), usgMap_(usgMap)
00358         {
00359         }
00360     public:
00362         NeId neId_;
00364         long             objVs_;
00366         UsgMap&          usgMap_;
00367     private:
00369         RpEvalUsgMap(const RpEvalUsgMap& rhs);
00371         RpEvalUsgMap operator=(const RpEvalUsgMap& rhs);
00372     };                                  // struct RpEvalUsgMap
00373 
00381     class RpEvalMgr::EvalExists : public OsbException {
00382     public:
00384         EvalExists();
00385     };                                  // class RpEvalMgr::EvalExists
00386 }                                       // namespace OSB_LIB
00387 
00388 // ************************************************************************
00389 // inline definitions
00390 namespace OSB_LIB {
00391 }                                       // namespace OSB_LIB
00392 #endif                                  // #ifndef _RPEVALMGR_H_

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