connectionpt.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00006 /*
00007   AUTHOR(S): Tang Boon Leong (tbl)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.41 $
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 _CONNECTIONPT_H_
00031 #define _CONNECTIONPT_H_
00032 
00033 // *********************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <list>
00037 
00038 // + local headers
00039 #include "osbid.h"
00040 #include "tariffobject.h"
00041 
00042 // *********************************************************************
00043 // class declarations
00044 namespace OSB_DB {
00045     struct ConnectionPtGw;
00046     class  Session;
00047 }
00048 
00049 // ************************************************************************
00050 // namespace extensions
00051 namespace OSB_LIB {
00052 
00053 // ************************************************************************
00054 // forward declarations
00055 class ConnectionPt;
00056 
00057 // ************************************************************************
00058 // type definitions
00059 
00060 // *********************************************************************
00061 // class definitions
00062 
00063     // *****************************************************************
00064     // CpParent
00068     class CpParent {
00073         friend class OSB_DB::ConnectionPtGw;
00079         friend class ConnectionPt;
00080     public:
00082         typedef Id<ConnectionPt> ParentId;
00084         explicit CpParent(
00085             const ParentId&  parentId,
00086             const DateTime&  ts = DateTime()
00087         );
00089 
00090 
00091         const ParentId& parentId() const;
00093         long seq() const;
00095         const CfgStatus& status() const;
00097         const DateTime& releaseTs() const;
00099 
00101 
00102 
00108         void setReleaseTs(const DateTime& ts);
00110 
00112 
00113 
00119         bool freeze(OsbErrors& errors);
00126         bool unfreeze(OsbErrors& errors);
00133         bool release(OsbErrors& errors);
00141         bool revoke(
00142             const ConnectionPt& cp,
00143                   OsbErrors&    errors
00144         );
00146 
00147     private:
00149         ParentId parentId_;
00151         long seq_;
00153         CfgStatus status_;
00155         DateTime releaseTs_;
00156     };
00157 
00158     // *****************************************************************
00159     // ConnectionPt
00167     class ConnectionPt : public ToCfgPeriodBase,
00168                          public TariffObject
00169     {
00174         friend class OSB_DB::ConnectionPtGw;
00176         friend class TariffCatalogue;
00177     public:
00179         typedef Id<ConnectionPt> Oid;
00181         typedef std::list<CpParent> Parents;
00182     public:
00184         explicit ConnectionPt(const Oid& oid = Oid());
00185 
00187 
00188 
00189         const Oid& oid() const;
00191         bool isRoot() const;
00193         const Parents& parents() const;
00200         const CpParent* parent(const int seq) const;
00202 
00204         const Oid getParent(const DateTime& ts) const;
00205 
00207 
00208 
00215         void setRoot(bool isRoot);
00225         void setReleaseTs(const DateTime& ts);
00227 
00229 
00230 
00239         void addParent(CpParent& parent);
00247         void delParent(const int seq);
00254         void updParent(const CpParent& parent);
00255 
00257         void sortParents();
00259 
00261 
00262 
00273         bool freeze(
00274             const OSB_DB::Session& session,
00275                   OsbErrors&       errors
00276         );
00277 
00292         bool unfreeze(
00293             const OSB_DB::Session& session,
00294                   OsbErrors&       errors
00295         );
00296 
00314         bool release(
00315             const OSB_DB::Session& session,
00316                   OsbErrors&       errors
00317         );
00318 
00334         bool revoke(
00335             const OSB_DB::Session& session,
00336                   OsbErrors&       errors
00337         );
00339 
00341 
00342 
00351         bool read(const OSB_DB::Session& session);
00352 
00353     private:
00366         bool insert(const OSB_DB::Session& session);
00367 
00379         bool update(const OSB_DB::Session& session);
00380 
00393         bool remove(const OSB_DB::Session& session);
00395 
00396     private:
00398         Oid oid_;
00400         bool isRoot_;
00402         Parents parents_;
00403     };                                  // class ConnectionPt
00404 
00405 // *********************************************************************
00406 // inline definitions
00407 
00408 }                                       // namespace OSB_LIB
00409 #endif                                  // #ifndef _CONNECTIONPT_H_

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