00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.13 $ 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 _SERVICEITEM_H_ 00031 #define _SERVICEITEM_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 00037 // + libraries 00038 00039 // + local headers 00040 #include "productitem.h" 00041 #include "persitem.h" 00042 #include "service.h" 00043 00044 // ************************************************************************ 00045 // class declarations 00046 namespace OSB_DB { 00047 class ServiceItemGw; 00048 class PersServiceGw; 00049 } 00050 00051 // ************************************************************************ 00052 // namespace extensions 00053 namespace OSB_LIB { 00054 00055 // ************************************************************************ 00056 // class definitions 00057 00058 // ***************************************************************** 00059 // PersService 00067 class PersService : public PersProductItem { 00072 friend struct OSB_DB::PersServiceGw; 00073 public: 00075 static const Type type_; 00076 00077 // Documentation from base class. 00078 typedef std::auto_ptr<PersService> AutoPtr; 00079 00080 public: 00082 PersService(const std::string& personalization) 00083 : personalization_(personalization) {}; 00084 00086 PersService( 00087 const Oid& persItemId = Oid(), 00088 const std::string& personalization = "" 00089 ) : PersProductItem(persItemId), 00090 personalization_(personalization) {}; 00091 00092 public: 00093 // documentation from base class 00094 Type type() const { return type_; } 00095 AutoPtr clone() const; 00096 00102 std::string personalization() const; 00103 00105 virtual bool canConfig() const; 00106 00107 private: 00108 // Documentation from base class. 00109 virtual PersProductItem* clone_() const; 00110 00112 00113 00114 virtual bool 00115 readSpecific(const OSB_DB::Session& session); 00116 00118 virtual bool 00119 insSpecific(const OSB_DB::Session& session); 00120 00122 virtual bool 00123 updSpecific(const OSB_DB::Session& session); 00124 00126 virtual bool 00127 delSpecific(const OSB_DB::Session& session); 00129 00130 private: 00132 std::string personalization_; 00133 }; // class PersService 00134 00135 // ***************************************************************** 00136 // ServiceItem 00144 class ServiceItem : public ProductItem { 00149 friend struct OSB_DB::ServiceItemGw; 00150 public: 00152 static const Type type_; 00153 00154 // Documentation from base class. 00155 typedef std::auto_ptr<ServiceItem> AutoPtr; 00156 00157 public: 00159 ServiceItem(const Oid& oid); 00160 00174 ServiceItem( 00175 const Oid& oid, 00176 const std::string& name, 00177 const std::string& des, 00178 const ServiceTuple& st 00179 ); 00180 00181 public: 00182 // Documentation from base class. 00183 Type type() const { return type_; } 00184 AutoPtr clone() const; 00185 00187 00188 00192 const ServiceTuple& serviceTuple() const; 00194 00196 00197 00202 void setServiceTuple(const ServiceTuple& service); 00204 00206 virtual ProductItem::CfgType canConfigure() const 00207 { 00208 return ProductItem::cfgMandatory; 00209 } 00210 00212 virtual ProductItem::DefPersType canDefPers() const 00213 { 00214 return ProductItem::defPersNone; 00215 } 00216 00218 CfgPersType canPersonalize() const; 00219 00221 const PersProductItem* defPersItem() const; 00222 00231 std::auto_ptr<PersProductItem> crePersProductItem() const; 00232 00233 private: 00234 // Documentation from base class. 00235 virtual ProductItem* clone_() const; 00236 00238 00239 00240 virtual bool 00241 readSpecific(const OSB_DB::Session& session); 00242 00244 virtual bool 00245 insSpecific(const OSB_DB::Session& session); 00246 00248 virtual bool 00249 updSpecific(const OSB_DB::Session& session); 00250 00252 virtual bool 00253 delSpecific(const OSB_DB::Session& session); 00255 00256 private: 00258 ServiceTuple serviceTuple_; 00260 PersService defPersService_; 00261 }; // class ServiceItem 00262 } // namespace OSB_LIB 00263 00264 // ************************************************************************ 00265 // inline definitions 00266 namespace OSB_LIB { 00267 } // namespace OSB_LIB 00268 #endif // #ifndef _SERVICEITEM_H_