00001 namespace SPUC { 00002 // 00003 // author="Tony Kirke" 00004 // Copyright(c) 1993-1996 Tony Kirke 00005 /* 00006 * SPUC - Signal processing using C++ - A DSP library 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00026 00029 00030 00031 class sum_and_dump { 00032 public: 00033 long average; 00034 long count_exp; 00035 long count; 00036 long count_val; 00037 long result; 00038 00039 sum_and_dump(long exp) : count_exp(exp) { 00040 count = result = average = 0; 00041 count_val = (1 << count_exp) - 1; 00042 } 00043 void input(long in); 00044 long output(void) {return(result);} 00045 void set_exp(long exp) { 00046 count_exp = exp; count = 0; 00047 count_val = (1 << count_exp) - 1; 00048 } 00049 }; 00050 } // namespace SPUC