deviceitem.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 $
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 _DEVICEITEM_H_
00031 #define _DEVICEITEM_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 
00037 // + libraries
00038 
00039 // + local headers
00040 #include "devicetype.h"
00041 #include "persitem.h"
00042 #include "productitem.h"
00043 
00044 // + class declarations
00045 
00046 // ************************************************************************
00047 // namespace extensions
00048 namespace OSB_LIB {
00049 
00050 // ************************************************************************
00051 // forward declarations
00052 
00053 // ************************************************************************
00054 // type definitions
00055 
00056 // ************************************************************************
00057 // class definitions
00061     class DeviceItem : public ProductItem {
00062     public:
00064         static const Type type_;
00065         // doc from base class
00066         typedef std::auto_ptr<DeviceItem> AutoPtr;
00068         typedef TypeId<Device> DvcType;
00069 
00070     public:
00074         explicit DeviceItem(
00075             const Oid&         oid,
00076             const std::string& name = "",
00077             const std::string& des  = ""
00078         );
00079         // doc from base class
00080         AutoPtr clone() const;
00081 
00082     public:                             // implement ProductItem
00083         // doc from base class
00084         Type type() const;
00086         CfgType canConfigure() const;
00088         DefPersType canDefPers() const;
00090         CfgPersType canPersonalize() const;
00092         const PersProductItem* defPersItem() const;
00098         std::auto_ptr<PersProductItem> crePersProductItem() const;
00099 
00100     public:                             // specific functions
00102         DvcType deviceType() const;
00109         void setDeviceType(const DvcType dvcType);
00110 
00111     private:
00112         bool readSpecific(
00113             const OSB_DB::Session& session
00114         );
00115 
00123         bool insSpecific(
00124             const OSB_DB::Session& session
00125         );
00126 
00134         bool updSpecific(
00135             const OSB_DB::Session& session
00136         );
00137 
00146         bool delSpecific(
00147             const OSB_DB::Session& session
00148         );
00149 
00150     private:
00151         // doc from base class
00152         virtual ProductItem* clone_() const;
00153     private:
00155         DvcType dvcType_;
00156     };                                  // class DeviceItem
00157 
00161     class PersDevice : public PersProductItem {
00162     public:
00163         // doc from base class
00164         typedef std::auto_ptr<PersDevice> AutoPtr;
00165     public:
00167         explicit PersDevice(const Oid& oid = Oid());
00168 
00169         // doc from base class
00170         AutoPtr clone() const;
00171 
00172     protected:
00174         PersDevice(const PersDevice& rhs);
00176         PersDevice& operator=(const PersDevice& rhs);
00177 
00178     public:
00193         Id<Device> dvcId() const;
00194 
00201         virtual const Device* device() const = 0;
00208         virtual const Device* oldDevice() const = 0;
00210 
00211     private:
00218         virtual Device* device() = 0;
00219 
00226         virtual Device* oldDevice() = 0;
00227 
00246         virtual Device* mkDevice(
00247             const Id<Device>& dvcId
00248         ) = 0;
00249 
00250     protected:
00275         bool readPersDevice(
00276             const OSB_DB::Session& session
00277         );
00278 
00291         bool insPersDevice(
00292             const OSB_DB::Session& session
00293         );
00294 
00304         bool delPersDevice(
00305             const OSB_DB::Session& session
00306         );
00307 
00319         virtual bool overwrite(
00320             const OSB_DB::Session& session
00321         );
00322 
00323         // Documentation from base class.
00324         virtual bool deassignOld(
00325             const OSB_DB::Session& session
00326         );
00327 
00340         virtual bool changeAssignTs(
00341             const OSB_DB::Session& session,
00342             const DateTime&        newTs
00343         );
00345     };                                  // class PersDevice
00346 }                                       // namespace OSB_LIB
00347 
00348 // ************************************************************************
00349 // inline definitions
00350 namespace OSB_LIB {
00351 }                                       // namespace OSB_LIB
00352 #endif                                  // #ifndef _DEVICEITEM_H_

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