tariffobject.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.37 $
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 _TARIFFOBJECT_H_
00031 #define _TARIFFOBJECT_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <string>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "osbconst.h"
00042 #include "chrono.h"
00043 
00044 // ************************************************************************
00045 // class declarations
00046 namespace OSB_LIB {
00047     class OsbErrors;
00048 }
00049 
00050 namespace OSB_DB {
00051     class Session;
00052 }
00053 
00054 // ************************************************************************
00055 // namespace extensions
00056 namespace OSB_LIB {
00057 
00058 // ************************************************************************
00059 // class definitions
00066     class ToCfgBase {
00067     protected:
00069         explicit ToCfgBase(CfgStatus status = cfgEditable);
00071         virtual ~ToCfgBase();
00073         ToCfgBase& operator=(const ToCfgBase& rhs);
00074     public:
00076         CfgStatus status() const;
00084         virtual bool freeze(
00085             const OSB_DB::Session& session,
00086                   OsbErrors&       msgs
00087         ) = 0;
00088 
00096         virtual bool release(
00097             const OSB_DB::Session& session,
00098                   OsbErrors&       msgs
00099         ) = 0;
00100 
00108         virtual bool revoke(
00109             const OSB_DB::Session& session,
00110                   OsbErrors&       msgs
00111         ) = 0;
00112 
00120         virtual bool unfreeze(
00121             const OSB_DB::Session& session,
00122                   OsbErrors&       errors
00123         ) = 0;
00124 
00125     protected:
00127         CfgStatus status_;
00128     };
00129 
00138     class ToCfgTsBase : public ToCfgBase {
00139     protected:
00141         explicit ToCfgTsBase(CfgStatus status = cfgEditable);
00143         virtual ~ToCfgTsBase();
00145         ToCfgTsBase& operator=(const ToCfgTsBase& rhs);
00146     public:
00148         const DateTime& releaseTs() const;
00149 
00156         virtual void setReleaseTs(const DateTime& ts);
00157     protected:
00159         DateTime releaseTs_;
00160     };                                  // class ToCfgTsBase
00161 
00170     class ToCfgPeriodBase : public ToCfgTsBase {
00171     protected:
00173         explicit ToCfgPeriodBase(CfgStatus status = cfgEditable);
00175         virtual ~ToCfgPeriodBase();
00177         ToCfgPeriodBase& operator=(const ToCfgPeriodBase& rhs);
00178     public:
00180         const DateTime& endTs() const;
00188         virtual void setEndTs(const DateTime& ts);
00192         bool contains(const DateTime& ts) const;
00193     protected:
00195         DateTime endTs_;
00196     };                                  // class ToCfgPeriodBase
00197 
00238     class ToVersion : public ToCfgTsBase {
00239     protected:                          // construction, destruction
00246         ToVersion();
00248         virtual ~ToVersion();
00249     protected:
00251         ToVersion& operator=(const ToVersion& rhs);
00252     public:
00254         const std::string& name() const;
00262         virtual void setName(const std::string& name);
00263     protected:
00265         long objVs() const;
00266     protected:
00268         std::string name_;
00269     protected:
00271         long objVs_;
00272     };                                  // class ToVersion
00273 
00304     class TariffObject {
00305     protected:                          // construction, destruction
00312         TariffObject();
00314         virtual ~TariffObject() = 0;
00315     protected:
00317         TariffObject& operator=(const TariffObject& rhs);
00318     public:                             // access to members
00320         const std::string& name() const;
00322         const std::string& des() const;
00323 
00331         void setName(const std::string& name);
00338         void setDes(const std::string& des);
00339 
00340     protected:
00342         long objVs() const;
00343 // ToDo: do we really need this?
00356 /*
00357  *      virtual void lock(
00358  *          const OSB_DB::Session& session,
00359  *          const bool             noWait
00360  *      ) = 0;
00361  */
00362     protected:
00364         std::string name_;
00366         std::string des_;
00367     protected:
00369         long objVs_;
00370     };                                  // class TariffObject
00371 
00380     class ToNameOnly {
00381     protected:                          // construction, destruction
00388         ToNameOnly();
00390         virtual ~ToNameOnly() = 0;
00391     protected:
00393         ToNameOnly& operator=(const ToNameOnly& rhs);
00394     public:                             // access to members
00396         const std::string& name() const;
00404         void setName(const std::string& name);
00405     protected:
00407         long objVs() const;
00408     protected:
00410         std::string name_;
00412         long objVs_;
00413     };                                  // class ToNameOnly
00414 
00415 // ************************************************************************
00416 // free functions
00417 
00419     bool greaterToReleaseTsRef(
00420         const ToCfgTsBase& lhs,
00421         const ToCfgTsBase& rhs
00422     );
00424     bool greaterToReleaseTsPtr(
00425         const ToCfgTsBase* lhs,
00426         const ToCfgTsBase* rhs
00427     );
00428 }                                       // namespace OSB_LIB
00429 #endif                                  // #ifndef _TARIFFOBJECT_H_

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