00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Stephan Broennimann (vb) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.6 $ 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 _CDRLIST_H_ 00031 #define _CDRLIST_H_ 00032 00033 // ************************************************************************ 00034 // included header files 00035 // + standard includes 00036 #include <list> 00037 00038 // + libraries 00039 00040 // + local headers 00041 #include "cdr.h" 00042 00043 // + class declarations 00044 00045 // ************************************************************************ 00046 // namespace extensions 00047 namespace OSB_LIB { 00048 00049 // ************************************************************************ 00050 // class definitions 00061 class CdrList { 00062 private: 00063 typedef std::list<Cdr> Cont; 00064 public: 00066 00067 typedef Cont::iterator Iter; 00068 typedef Cont::const_iterator ConstIter; 00070 00071 public: 00073 inline CdrList(); 00075 inline CdrList(const CdrList& rhs); 00076 public: 00078 inline size_t numCdr() const; 00080 00081 inline ConstIter begin() const; 00082 inline ConstIter end() const; 00083 inline bool empty() const; 00085 00087 00088 inline Iter begin(); 00089 inline Iter end(); 00090 inline Cdr& front(); 00091 inline Cdr& back(); 00092 void clear(); 00093 Iter erase(Iter pos); 00094 void pushBack(const Cdr& cdr); 00096 private: 00098 CdrList& operator=(const CdrList&); 00099 private: 00101 size_t numCdr_; 00103 Cont cdrs_; 00105 Cont pool_; 00106 }; // class CdrList 00107 } // namespace OSB_LIB 00108 00109 // ************************************************************************ 00110 // inline definitions 00111 namespace OSB_LIB { 00112 // ******************************************************************** 00113 // class CdrList 00114 CdrList::CdrList() 00115 : numCdr_(0) 00116 { 00117 // empty 00118 } 00119 00120 CdrList::CdrList(const CdrList& rhs) 00121 : numCdr_(rhs.numCdr_), cdrs_(rhs.cdrs_) 00122 { 00123 // empty 00124 } 00125 00126 CdrList::Iter CdrList::begin() 00127 { 00128 return cdrs_.begin(); 00129 } 00130 00131 CdrList::Iter CdrList::end() 00132 { 00133 return cdrs_.end(); 00134 } 00135 00136 Cdr& CdrList::front() 00137 { 00138 return cdrs_.front(); 00139 } 00140 00141 Cdr& CdrList::back() 00142 { 00143 return cdrs_.back(); 00144 } 00145 00146 CdrList::ConstIter CdrList::begin() const 00147 { 00148 return cdrs_.begin(); 00149 } 00150 00151 CdrList::ConstIter CdrList::end() const 00152 { 00153 return cdrs_.end(); 00154 } 00155 00156 bool CdrList::empty() const 00157 { 00158 return cdrs_.empty(); 00159 } 00160 00161 size_t CdrList::numCdr() const 00162 { 00163 return numCdr_; 00164 } 00165 } // namespace OSB_LIB 00166 #endif // #ifndef _CDRLIST_H_