00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.13 $ 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 _CDRSTORAGE_H_ 00031 #define _CDRSTORAGE_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 00037 // + libraries 00038 00039 // + local headers 00040 #include "osberror.h" 00041 #include "osbid.h" 00042 00043 // + class declarations 00044 namespace OSB_LIB { 00045 class Cdr; 00046 class CdrList; 00047 class RecordStreamInfo; 00048 } 00049 00050 namespace OSB_DB { 00051 class Session; 00052 } 00053 00054 // ************************************************************************ 00055 // namespace extensions 00056 namespace OSB_LIB { 00057 00058 // ************************************************************************ 00059 // forward declarations 00060 00061 // ************************************************************************ 00062 // type definitions 00063 00064 // ************************************************************************ 00065 // class definitions 00123 class CdrStorage { 00124 public: 00125 // exception thrown if a previous batch was not finalized 00126 class StreamPending; 00127 public: 00129 CdrStorage(); 00131 virtual ~CdrStorage(); 00132 protected: 00140 00141 CdrStorage(const CdrStorage&); 00143 CdrStorage& operator=(const CdrStorage&); 00145 00146 public: 00164 virtual OsbError beginStream( 00165 const OSB_DB::Session& session, 00166 const RecordStreamInfo& input 00167 ) = 0; 00168 00182 virtual bool push( 00183 const Cdr& cdr, 00184 OsbError& error 00185 ) = 0; 00186 00199 virtual OsbError prepareWrite( 00200 OSB_DB::Session& session 00201 ) = 0; 00202 00210 virtual OsbError writeCdrFiles() = 0; 00211 00223 virtual OsbError storeCdrs( 00224 const OSB_DB::Session& session, 00225 CdrList& errors 00226 ) = 0; 00227 00237 virtual OsbError endStream() = 0; 00238 00258 virtual bool undoChanges( 00259 OSB_DB::Session& session 00260 ) = 0; 00262 }; // class CdrStorage 00263 00268 class CdrStorage::StreamPending : public OsbException { 00269 public: 00271 static const ErrorNo errno_ = 801; 00273 StreamPending(const Id<RecordStreamInfo>& rsId); 00274 }; // class CdrStorage::StreamPending 00275 } // namespace OSB_LIB 00276 00277 // ************************************************************************ 00278 // inline definitions 00279 namespace OSB_LIB { 00280 } // namespace OSB_LIB 00281 #endif // #ifndef _CDRSTORAGE_H_