resourceitem.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.6 $
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 _RESOURCEITEM_H_
00031 #define _RESOURCEITEM_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <memory>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "productitem.h"
00042 #include "persitem.h"
00043 
00044 // + class declarations
00045 namespace OSB_LIB {
00046     class Resource;
00047 }
00048 
00049 // ************************************************************************
00050 // namespace extensions
00051 namespace OSB_LIB {
00052 
00053 // ************************************************************************
00054 // forward declarations
00055 
00056 // ************************************************************************
00057 // type definitions
00058     // The available resource types are defined by
00059     // ProductItemBase::TypeId defined in productitem.h.
00060 
00061 // ************************************************************************
00062 // class definitions
00063 
00064     // *****************************************************************
00065     // class ResourceItem
00079     class ResourceItem : public ProductItem {
00080     public:
00081         // Documentation from base class.
00082         typedef std::auto_ptr<ResourceItem> AutoPtr;
00083 
00091         ResourceItem(
00092             const Oid&         oid,
00093             const std::string& name = "",
00094             const std::string& des  = ""
00095         );
00096 
00097         // Documentation from base class.
00098         AutoPtr clone() const;
00099 
00100     protected:
00102         ResourceItem(const ResourceItem& rhs);
00104         ResourceItem& operator=(const ResourceItem& rhs);
00105 
00106     private:
00107         // Documentation from base class.
00108         virtual ProductItem* clone_() const = 0;
00109     };
00110 
00111     // *****************************************************************
00112     // class PersResource
00137     class PersResource : public PersProductItem {
00138     public:                             // type definitions
00139         // Documentation from base class.
00140         typedef std::auto_ptr<PersResource> AutoPtr;
00141 
00142     public:                             // construction & destruction
00149         explicit PersResource(const Oid& oid = Oid());
00150 
00151         // Documentation from base class.
00152         AutoPtr clone() const;
00153 
00154     protected:
00156         PersResource(const PersResource& rhs);
00158         PersResource& operator=(const PersResource& rhs);
00159 
00160     public:                             // read access to data members
00171         virtual std::string personalization() const;
00172 
00191         bool resourceAssigned() const;
00198         Id<Resource> resourceId() const;
00205         virtual const Resource* resource() const = 0;
00207 
00213         virtual const Resource* oldResource() const = 0;
00214 
00221 
00222 
00223     private:
00230         virtual Resource* resource() = 0;
00231 
00238         virtual Resource* oldResource() = 0;
00239 
00290         virtual Resource* createResource(
00291             const Id<Resource>& resourceId
00292         ) = 0;
00293 
00294     protected:
00318         bool readPersResource(
00319             const OSB_DB::Session& session
00320         );
00321 
00336         bool insPersResource(
00337             const OSB_DB::Session& session
00338         );
00339 
00349         bool delPersResource(
00350             const OSB_DB::Session& session
00351         );
00352 
00364         virtual bool overwrite(
00365             const OSB_DB::Session& session
00366         );
00367 
00368         // Documentation from base class.
00369         virtual bool deassignOld(
00370             const OSB_DB::Session& session
00371         );
00372 
00385         virtual bool changeAssignTs(
00386             const OSB_DB::Session& session,
00387             const DateTime&        newTs
00388         );
00390     };                                  // class PersResource
00391 }                                       // namespace OSB_LIB
00392 
00393 // ************************************************************************
00394 // inline definitions
00395 namespace OSB_LIB {
00396 }                                       // namespace OSB_LIB
00397 #endif                                  // #ifndef _RESOURCEITEM_H_

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