00001 /* 00002 00003 Rebuffering class 00004 Copyright (C) 2001-2002 Jussi Laako 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 00023 #include <typeinfo> 00024 00025 #include <Alloc.hh> 00026 00027 00028 #ifndef REBUFFER_HH 00029 #define REBUFFER_HH 00030 00031 00036 class clReBuffer 00037 { 00038 long lSize; 00039 long lPutIndex; 00040 long lGetIndex; 00041 long lCount; 00042 clAlloc Buffer; 00043 void CheckSize (long, long); 00044 protected: 00045 void *Index (const std::type_info &, long); 00046 void *GetPtr (const std::type_info &); 00047 public: 00048 clReBuffer (); 00049 clReBuffer (const clReBuffer &CopySrc) 00050 { 00051 *this = CopySrc; 00052 } 00053 ~clReBuffer (); 00060 void Put (const float *, long); 00062 void Put (const double *, long); 00072 bool Get (float *, long); 00074 bool Get (double *, long); 00080 long GetCount () const 00081 { 00082 return lCount; 00083 } 00087 void Clear () 00088 { 00089 lSize = 0; 00090 lPutIndex = 0; 00091 lGetIndex = 0; 00092 lCount = 0; 00093 Buffer.Free(); 00094 } 00095 clReBuffer & operator= (const clReBuffer &); 00096 }; 00097 00098 00099 #endif