00001 // OSB library ************************************************ -*- C++ -*- 00008 /* 00009 AUTHOR(S): Darryl Kang (dk) 00010 00011 RCS information 00012 $Name: OSB_060808 $ 00013 $Revision: 1.9 $ 00014 00015 License 00016 OSB rating and billing library for communication networks 00017 Copyright (C) 2004, 2005, 2006 OSB systems 00018 00019 This file may be distributed and/or modify under the terms of the 00020 GNU General Public License (GPL) as published by the Free Software 00021 Foundation which is provided in the file LICENSE.GPL included in the 00022 packaging of this file. 00023 00024 The file is distributed in the hope that it will be useful, but WITHOUT 00025 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00026 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00027 for more details. 00028 00029 Holders of a OSB Commercial License may use this file under the terms 00030 and conditions of this commercial license. 00031 */ 00032 #ifndef _BACKDATEDOBJECT_H_ 00033 #define _BACKDATEDOBJECT_H_ 00034 00035 // ************************************************************************ 00036 // included header files 00037 00038 // + standard includes 00039 #include <list> 00040 00041 // + local headers 00042 #include "osbid.h" 00043 #include "chrono.h" 00044 00045 // ************************************************************************ 00046 // class declarations 00047 namespace OSB_DB { 00048 class Session; 00049 } 00050 00051 // ************************************************************************ 00052 // namespace extensions 00053 namespace OSB_LIB { 00054 00055 // ************************************************************************ 00056 // class definitions 00057 00058 // class BackDatedObject 00063 class BackDatedObject { 00064 public: 00066 typedef Id<BackDatedObject> Oid; 00067 00069 typedef Id2<BackDatedObject> ToId; 00070 00075 enum TariffObject { 00076 toTfVersion = 'f' 00077 00078 // Add new tariff object below once back-dating for 00079 // the tariff object is supported. 00080 }; 00081 00089 static char toChar(TariffObject to); 00090 00098 static TariffObject toTariffObject(char to); 00099 00101 BackDatedObject( 00102 const Oid& oid, 00103 const ToId& patched, 00104 const ToId& substitute, 00105 TariffObject tariffObject, 00106 const Date& releasedDate, 00107 bool resubmitted = false 00108 ); 00109 00111 const Oid& oid() const { return oid_; } 00112 00114 const ToId& patched() const { return patched_; } 00115 00117 const ToId& substitute() const { return substitute_; } 00118 00120 const Date& patchReleasedDate() const 00121 { 00122 return patchReleasedDate_; 00123 } 00124 00126 TariffObject tariffObject() const { return tariffObject_; } 00127 00129 bool resubmitted() const { return resubmitted_; } 00130 00132 bool insert(const OSB_DB::Session& session); 00133 00134 private: 00136 Oid oid_; 00138 ToId patched_; 00140 ToId substitute_; 00142 TariffObject tariffObject_; 00144 Date patchReleasedDate_; 00145 00147 bool resubmitted_; 00148 }; 00149 00151 typedef std::list<BackDatedObject> BackDatedObjects; 00152 } // namespace OSB_LIB 00153 #endif // #ifndef _BACKDATEDOBJECT_H_