countryinfo.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00009 /*
00010   AUTHOR(S): Manikandan (mk)
00011 
00012   RCS information
00013    $Name: OSB_060808 $
00014    $Revision: 1.21 $
00015 
00016   License
00017    OSB rating and billing library for communication networks
00018    Copyright (C) 2004, 2005, 2006  OSB systems
00019 
00020    This file may be distributed and/or modify under the terms of the
00021    GNU General Public License (GPL) as published by the Free Software
00022    Foundation which is provided in the file LICENSE.GPL included in the
00023    packaging of this file.
00024 
00025    The file is distributed in the hope that it will be useful, but WITHOUT
00026    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00027    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00028    for more details.
00029 
00030    Holders of a OSB Commercial License may use this file under the terms
00031    and conditions of this commercial license.
00032  */
00033 #ifndef _COUNTRYINFO_H_
00034 #define _COUNTRYINFO_H_
00035 
00036 // *********************************************************************
00037 // included header files
00038 // + standard includes
00039 #include <vector>
00040 #include <map>
00041 #include <string>
00042 
00043 // + local headers
00044 #include "osbid.h"
00045 #include "nwaddress.h"
00046 
00047 // *********************************************************************
00048 // class declarations
00049 namespace OSB_DB {
00050     struct CountryInfoGw;
00051     class Session;
00052 }
00053 
00054 // ************************************************************************
00055 // namespace extensions
00056 namespace OSB_LIB {
00057 
00058 // *********************************************************************
00059 // type definitions
00060 
00061 // *********************************************************************
00062 // class definitions
00063 
00064     // *****************************************************************
00065     // class CountryInfo
00072     class CountryInfo
00073     {
00075         friend struct OSB_DB::CountryInfoGw;
00076     public:
00078         typedef Id<CountryInfo> Oid;
00079 
00081         CountryInfo(const Oid& oid = Oid());
00082 
00084 
00085 
00086         const Oid& oid() const;
00088         const std::string& name() const;
00090         const std::string& alphabetCode() const;
00092         const std::string& e164cc() const;
00094 
00096 
00097 
00107         bool read(const OSB_DB::Session& session);
00109     private:
00111         Oid oid_;
00113         std::string name_;
00115         std::string alphabetCode_;
00117         std::string e164cc_;
00118     };
00119 
00121     typedef std::vector<CountryInfo> CountryInfos;
00122 
00129     class CountryInfoList
00130     {
00131     public:
00133         typedef std::map<std::string, CountryInfo*> E164CountryInfoMap;
00134 
00136         typedef std::map<CountryInfo::Oid, CountryInfo*> OidCountryInfoMap;
00137 
00144         static CountryInfoList& instance();
00145 
00147         ~CountryInfoList();
00148 
00161         long read(const OSB_DB::Session& session);
00162 
00168         const CountryInfos& getCountryInfos() const;
00169 
00184         const CountryInfo& getCountryInfo(const CountryInfo::Oid& oid);
00185 
00199         bool getCountryInfo(
00200             const std::string& dialledNum,
00201             CountryInfo&       countryInfo
00202         ) const;
00203 
00220         std::string countryCode(const NwAddress& nwAddress);
00221 
00222     private:
00224         CountryInfoList() {}
00225 
00227         static CountryInfoList* ciList_;
00228 
00230         CountryInfos countryInfos_;
00231 
00237         E164CountryInfoMap e164CntryInfo_;
00238 
00244         OidCountryInfoMap oidCntryInfo_;
00245     };
00246 }                                       // namespace OSB_LIB
00247 #endif                                  // #ifndef _COUNTRYINFO_H_

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