00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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