rpeval.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.22.2.1 $
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 _RPEVAL_H_
00031 #define _RPEVAL_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "osbid.h"
00042 #include "osbtype.h"
00043 
00044 // + class declarations
00045 namespace OSB_DB {
00046     class RpEvalGw;
00047     class Session;
00048 }
00049 
00050 namespace OSB_LIB {
00051     class Cdr;
00052     class OsbError;
00053     class RatedParty;
00054 }
00055 
00056 // ************************************************************************
00057 // namespace extensions
00058 namespace OSB_LIB {
00059 
00060 // ************************************************************************
00061 // class definitions
00078     class RatedPartyEval {
00080         friend class OSB_DB::RpEvalGw;
00081     public:
00083         typedef Id<RatedPartyEval> Oid;
00085         typedef TypeId<RatedPartyEval> Type;
00087         typedef TypeId<RatedParty> RpType;
00088 
00090         enum Result {
00092             noCdr = 1,
00097             evalError,
00099             useRatedParty,
00104             useCache
00105         };
00106 
00107     public:
00109         RatedPartyEval(
00110             const Oid&    oid,
00111             const RpType& rpType
00112         );
00114         virtual ~RatedPartyEval();
00115 
00116     protected:
00118         RatedPartyEval(const RatedPartyEval& rhs);
00120         RatedPartyEval& operator=(const RatedPartyEval& rhs);
00121 
00122     public:
00124         const Oid& oid() const;
00125 
00127         inline RpType rpType() const;
00128 
00153         Result evalParty(
00154             const Cdr&        cdr,
00155                   RatedParty* rp,
00156                   OsbError*   error
00157         ) const;
00158 
00162         virtual Type type() const = 0;
00163 
00171         virtual bool requiresCache() const = 0;
00172 
00173     private:
00199         virtual Result getParty(
00200             const Cdr&        cdr,
00201                   RatedParty* rp,
00202                   OsbError*   error
00203         ) const = 0;
00204 
00205     public:
00213         virtual int numParam() const = 0;
00214 
00228         virtual std::string getParam(int index) const = 0;
00229 
00230     private:                            // database gateway only
00242         virtual bool setParam(
00243                   int          index,
00244             const std::string& param
00245         ) = 0;
00246 
00247     private:
00249         Oid oid_;
00251         RpType rpType_;
00252     };                                  // class RatedPartyEval
00253 }                                       // namespace OSB_LIB
00254 
00255 // ************************************************************************
00256 // inline definitions
00257 namespace OSB_LIB {
00258     inline const RatedPartyEval::Oid& RatedPartyEval::oid() const
00259     {
00260         return oid_;
00261     }
00262 
00263     inline RatedPartyEval::RpType RatedPartyEval::rpType() const
00264     {
00265         return rpType_;
00266     }
00267 }                                       // namespace OSB_LIB
00268 #endif                                  // #ifndef _RPEVAL_H_

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