e164map.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.7.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 _E164MAP_H_
00031 #define _E164MAP_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <map>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "cpmapper.h"
00042 #include "nwaddress.h"
00043 #include "osbid.h"
00044 
00045 // + class declarations
00046 namespace OSB_LIB {
00047     class ConnectionPt;
00048     class DateTime;
00049     class E164;
00050 }
00051 
00052 // ************************************************************************
00053 // namespace extensions
00054 namespace OSB_LIB {
00055 
00056 // ************************************************************************
00057 // forward declarations
00058 
00059 // ************************************************************************
00060 // type definitions
00061 
00062 // ************************************************************************
00063 // class definitions
00064 
00065     // ********************************************************************
00066     // class MsrnToCp
00074     class MsrnToCp : public CpMapper {
00076         static const CpmType cpmType_ = cpmMsrn;
00077         // Documentation from base class.
00078         typedef std::auto_ptr<MsrnToCp> AutoPtr;
00079     public:
00080         // Documentation from base class.
00081         AutoPtr clone() const;
00082 
00084         Type type() const { return Type(cpmType_); }
00085 
00098         virtual Id<ConnectionPt> map2Cp(Cdr& cdr) const;
00099     private:
00100         // Documentation from base class.
00101         virtual CpMapper* clone_() const;
00102     };                                  // class MsrnToCp
00103 
00104     // *****************************************************************
00105     // class E164Map
00111     class E164Map {
00118         friend class TariffCatalogue;
00119         struct Leaf;
00120         friend struct Leaf;
00121     public:
00127         E164Map();
00128 
00152         Id<ConnectionPt> map2Cp(
00153                   NwAddress::Ton ton,
00154             const std::string&   e164,
00155             const DateTime&      ts
00156         ) const;
00157 
00171         void build(const TariffCatalogue& tcat);
00172 
00174         void print(std::ostream& os) const;
00175     private:
00177         void add(
00178             const E164&         e164,
00179             const ConnectionPt& cp
00180         );
00181 
00183         typedef std::map<char, Leaf> Leaves;
00185         typedef std::map<NwAddress::Ton, Leaves> Tons;
00187         struct Leaf {
00189             char     digit_;
00191             MappedPartInfoList mappedPartInfoList_;
00193             Leaves   nextDigits_;
00195             void add(
00196                       size_t        pos,
00197                 const E164&         e164,
00198                 const ConnectionPt& cp
00199             );
00208             void map2Cp(
00209                       Id<ConnectionPt>& cpId,
00210                 const char*             e164,
00211                 const DateTime&         ts
00212             ) const;
00214             void print(
00215                       std::ostream& os,
00216                 const std::string&  prefix
00217             ) const;
00218         };
00219     private:
00221         Tons tons_;
00223         std::map<NwAddress::Ton, MappedCp> catchalls_;
00235         bool needBuild_;
00236     };                                  // class E164Map
00237 }                                       // namespace OSB_LIB
00238 
00239 // ************************************************************************
00240 // inline definitions
00241 namespace OSB_LIB {
00242 }                                       // namespace OSB_LIB
00243 #endif                                  // #ifndef _E164MAP_H_

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