00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.12 $ 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 _ERRORSTAT_H_ 00031 #define _ERRORSTAT_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 #include <map> 00037 00038 // + libraries 00039 #include <osberror.h> 00040 #include <apperror.h> 00041 00042 // + local headers 00043 00044 // + class declarations 00045 namespace OSB_APP { 00046 class AppErrors; 00047 } 00048 00049 namespace OSB_LIB { 00050 class Cdr; 00051 class OsbErrors; 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 00069 class ErrorStats { 00070 public: 00074 struct LessError { 00078 bool operator()( 00079 const BaseError& lhs, 00080 const BaseError& rhs 00081 ) const; 00082 }; 00083 00089 typedef std::map<OSB_APP::AppError, long, LessError> AppErrorCnt; 00090 00096 typedef std::map<OsbError, long, LessError> OsbErrorCnt; 00097 00098 public: 00100 bool empty() const; 00102 void print() const; 00103 00105 void clear(); 00106 00108 void add(const OSB_APP::AppError& error); 00110 void add(const OSB_APP::AppErrors& errList); 00111 00113 void add(const OsbError& error); 00115 void add(const OsbErrors& errList); 00116 00118 void add(const Cdr& cdr); 00119 00120 private: 00122 AppErrorCnt appErrors_; 00124 OsbErrorCnt osbErrors_; 00125 }; // class ErrorStats 00126 } // namespace OSB_LIB 00127 00128 // ************************************************************************ 00129 // inline definitions 00130 namespace OSB_LIB { 00131 } // namespace OSB_LIB 00132 #endif // #ifndef _ERRORSTAT_H_