00001 // OSB library ************************************************ -*- C++ -*- 00006 /* 00007 AUTHOR(S): Andreas Huggel (ahu) 00008 00009 RCS information 00010 $Name: OSB_060808 $ 00011 $Revision: 1.21 $ 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 _TAXGW_H_ 00031 #define _TAXGW_H_ 00032 00033 // ********************************************************************* 00034 // Included header files 00035 // + standard includes 00036 #include <list> 00037 #include <vector> 00038 #include <utility> 00039 00040 // + local headers 00041 #include "osbid.h" 00042 #include "appltaxes.h" 00043 00044 // + class declarations 00045 namespace OSB_DB { 00046 class Session; 00047 } 00048 00049 // ************************************************************************ 00050 // namespace extensions 00051 namespace OSB_DB { 00052 00053 typedef std::list< std::pair<OSB_LIB::TaxkeyTriplet, 00054 OSB_LIB::TaxListId> > Taxkey3Table; 00055 00059 class TaxGw { 00061 TaxGw(const TaxGw& rhs); 00063 TaxGw& operator=(const TaxGw& rhs); 00064 public: 00065 TaxGw() {} 00066 ~TaxGw() { deleteList(cache_); } 00067 // load all objects into memory, return number of objects 00068 // if a TaxList pointer is given, objects are stored there 00069 long fetch(const Session&, OSB_LIB::TaxList* =0); 00070 00071 private: 00072 void deleteList(OSB_LIB::TaxList&); 00073 00074 OSB_LIB::TaxList cache_; 00075 }; 00076 00080 class ApplTaxesGw { 00082 ApplTaxesGw(const ApplTaxesGw&); 00084 ApplTaxesGw& operator=(const ApplTaxesGw&); 00085 public: 00086 ApplTaxesGw() {} 00087 00088 // load all id of taxkeys of a given type 00089 long fetchTaxKeyIds( 00090 const Session&, 00091 OSB_LIB::TaxKeyIdList&, 00092 char 00093 ); 00094 00095 // load taxlists 00096 long fetchTaxIdLists(const Session&, OSB_LIB::TaxIdLists&); 00097 00098 // load taxkey triplets and taxlist ids 00099 long fetchTaxkeyTriplets(const Session&, Taxkey3Table&); 00100 }; 00101 00102 // ********************************************************************* 00103 // inline definitions 00104 00105 } // namespace OSB_DB 00106 #endif // #ifndef _TAXGW_H_