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
00031 #ifndef _SERVICE_H_
00032 #define _SERVICE_H_
00033
00034
00035
00036
00037 #include <map>
00038 #include <set>
00039 #include <vector>
00040
00041
00042 #include "osbid.h"
00043
00044
00045 namespace OSB_DB {
00046 class Session;
00047 struct ServiceElementGw;
00048 }
00049
00050
00051
00052 namespace OSB_LIB {
00053
00054
00055
00056
00057
00058
00065 class ServiceElement {
00070 friend struct OSB_DB::ServiceElementGw;
00071 public:
00073 typedef Id<ServiceElement> Oid;
00074
00076 typedef unsigned char ServiceCode;
00077
00084 enum ServiceType {
00085 stUnknown = '?',
00086 gsmTelephony = 'T',
00087 gsmBearer = 'B',
00088 gsmSupplementary = 'S',
00089 pstnTelephony = 'P',
00090 isdnTelephony = 'I',
00091 stMax = 0xff
00092 };
00093
00101 ServiceElement();
00102
00114 ServiceElement(
00115 const Oid& oid,
00116 ServiceType type,
00117 ServiceCode code,
00118 const Oid pid
00119 );
00120
00130 ServiceElement(
00131 ServiceType type,
00132 ServiceCode code
00133 );
00134
00136
00137
00144 static char toChar(const ServiceType st);
00145
00159 static ServiceType toServiceType(char c);
00160
00170 static std::string toHex(ServiceCode c);
00172
00174
00175
00176 const Oid& oid() const;
00177
00179 const ServiceType& serviceType() const;
00180
00182 const ServiceCode& serviceCode() const;
00183
00185 const Oid& pId() const;
00187
00197 const std::string shortCode() const;
00198
00200
00201
00209 bool read(const OSB_DB::Session& session);
00210
00220 bool insert(const OSB_DB::Session& session);
00221
00230 bool update(const OSB_DB::Session& session);
00231
00241 bool remove(const OSB_DB::Session& session);
00243
00245
00246
00254 bool operator==(const ServiceElement& se) const;
00255
00261 bool operator<(const ServiceElement& rhs) const;
00263
00264 private:
00266 Oid id_;
00267
00269 ServiceType serviceType_;
00270
00275 ServiceCode serviceCode_;
00276
00278 Oid pId_;
00279 };
00280
00284 typedef std::vector<ServiceElement> ServiceElements;
00285
00286
00287
00295 class SeTree {
00296 public:
00298 typedef std::map<ServiceElement::Oid, ServiceElement> Elements;
00299 private:
00301 typedef std::set<ServiceElement> SeList;
00302 public:
00308 void read(const OSB_DB::Session& session);
00309
00311 const Elements& elements() const;
00312
00320 const ServiceElement* findServiceElement(
00321 const ServiceElement& se
00322 ) const;
00323
00331 const ServiceElement* findServiceElement(
00332 const ServiceElement::Oid& seId
00333 ) const;
00334
00343 const ServiceElement& getServiceElement(
00344 const ServiceElement::Oid& seId
00345 ) const;
00346
00347 private:
00349 Elements elements_;
00351 SeList seList_;
00352 };
00353
00354
00355
00364 class ServiceTuple {
00365 public:
00367 ServiceTuple();
00368
00375 explicit ServiceTuple(
00376 const ServiceElements& ses
00377 );
00378
00387 explicit ServiceTuple(
00388 const ServiceElement& se
00389 );
00390
00403 ServiceTuple(
00404 ServiceElement::ServiceType type,
00405 ServiceElement::ServiceCode code
00406 );
00407
00414 bool operator==(const ServiceTuple& rhs) const;
00415
00417
00418
00419 const ServiceElements& serviceElements() const;
00421 private:
00426 ServiceElements serviceElements_;
00427 };
00428 }
00429 #endif // #ifndef _SERVICE_H_