Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

debugfc.h

Go to the documentation of this file.
00001 // SPUC - Signal processing using C++ - A DSP library
00002 /* 
00003  * This program is free software; you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2, or (at your option)
00006  * any later version.
00007  * 
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  * 
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00016 */
00017 #ifndef DEBUGFC
00018 #define DEBUGFC
00019 #include <iostream.h>
00020 #include <fstream.h>
00021 #include <cmplx.h>
00022 #include <debugf.h>
00023 typedef debugf* dbf;
00024 #define MSTREAMS 10
00025 namespace SPUC {
00029 class debugfc {
00030 
00031  private:
00032         dbf fc[MSTREAMS];
00033         bool on[MSTREAMS];
00034         int streams;
00035  public:
00036         inline bool is_on(int x) { return(on[x]); }
00037         debugfc() { 
00038                 streams=0;
00039                 for (int i=0;i<MSTREAMS;i++) on[i]=0;
00040         }
00041         ~debugfc() {
00042         }
00043         void add_stream_number(const int num, const char* n) {
00044                 // If not added already
00045                 if (!on[num]) {
00046                         on[num] = 1;
00047                         debugf* ptr = new debugf(n);
00048                         fc[num] = ptr;
00049                         streams++;
00050                 }
00051         }
00052         void add_stream(const char* n) {
00053                 if (!on[streams]) {
00054                         on[streams] = 1;
00055                         debugf* ptr = new debugf(n);
00056                         fc[streams++] = ptr;
00057                 }
00058         }
00059         void close_stream(const int num) {
00060                 if (on[num]) {
00061                         fc[num]->close();
00062                         on[num] = 0;
00063                 }
00064         }
00065         void close_all_streams() {
00066                 for (int i=0;i<MSTREAMS;i++) {
00067                         if (on[i]) {
00068                                 fc[i]->close();
00069                                 on[i] = 0;
00070                         }
00071                 }
00072         }
00073         void newline(const int n) { fc[n]->newline(); }
00074         template <class T> void out(int stream_num, T x) {
00075                 fc[stream_num]->out(x);
00076         }
00077         template <class T> void outn(int stream_num, T x) {
00078                 fc[stream_num]->outn(x);
00079         }
00080 };
00081 }
00082 #endif

Generated on Fri Sep 16 11:02:30 2005 for spuc by  doxygen 1.4.4