00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _E164MAP_H_
00031 #define _E164MAP_H_
00032
00033
00034
00035
00036 #include <map>
00037
00038
00039
00040
00041 #include "cpmapper.h"
00042 #include "nwaddress.h"
00043 #include "osbid.h"
00044
00045
00046 namespace OSB_LIB {
00047 class ConnectionPt;
00048 class DateTime;
00049 class E164;
00050 }
00051
00052
00053
00054 namespace OSB_LIB {
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00074 class MsrnToCp : public CpMapper {
00076 static const CpmType cpmType_ = cpmMsrn;
00077
00078 typedef std::auto_ptr<MsrnToCp> AutoPtr;
00079 public:
00080
00081 AutoPtr clone() const;
00082
00084 Type type() const { return Type(cpmType_); }
00085
00098 virtual Id<ConnectionPt> map2Cp(Cdr& cdr) const;
00099 private:
00100
00101 virtual CpMapper* clone_() const;
00102 };
00103
00104
00105
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 };
00237 }
00238
00239
00240
00241 namespace OSB_LIB {
00242 }
00243 #endif // #ifndef _E164MAP_H_