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 _FILECDRSTORAGE_H_ 00031 #define _FILECDRSTORAGE_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 00037 // + libraries 00038 00039 // + local headers 00040 #include "cdrfile.h" 00041 #include "cdrstorage.h" 00042 #include "recordstream.h" 00043 00044 // + class declarations 00045 00046 // ************************************************************************ 00047 // namespace extensions 00048 namespace OSB_LIB { 00049 00050 // ************************************************************************ 00051 // forward declarations 00052 00053 // ************************************************************************ 00054 // type definitions 00055 00056 // ************************************************************************ 00057 // class definitions 00061 class FileCdrStorage : public CdrStorage { 00062 public: 00069 FileCdrStorage( 00070 Asn1Writer& writer, 00071 const std::string& format 00072 ); 00073 private: 00075 FileCdrStorage(const FileCdrStorage&); 00077 FileCdrStorage& operator=(const FileCdrStorage&); 00078 00079 public: 00091 OsbError beginStream( 00092 const OSB_DB::Session& session, 00093 const RecordStreamInfo& input 00094 ); 00095 00105 bool push( 00106 const Cdr& cdr, 00107 OsbError& error 00108 ); 00109 00120 OsbError prepareWrite( 00121 OSB_DB::Session& session 00122 ); 00123 00131 OsbError writeCdrFiles(); 00132 00144 OsbError storeCdrs( 00145 const OSB_DB::Session& session, 00146 CdrList& errors 00147 ); 00148 00155 OsbError endStream(); 00156 00172 bool undoChanges( 00173 OSB_DB::Session& session 00174 ); 00175 00176 public: 00178 void setBaseDir(const std::string& baseDir); 00179 00180 private: 00182 Asn1Writer& asn1Writer_; 00184 RecordStreamInfo::Oid inputId_; 00186 RecordStreamInfo rsInfo_; 00188 CdrOutputFile outFile_; 00189 00191 std::string format_; 00193 std::string cdrBaseDir_; 00194 }; // class FileCdrStorage 00195 } // namespace OSB_LIB 00196 00197 // ************************************************************************ 00198 // inline definitions 00199 namespace OSB_LIB { 00200 } // namespace OSB_LIB 00201 #endif // #ifndef _FILECDRSTORAGE_H_