00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _KLASS_H
00025 #define _KLASS_H
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 using namespace std;
00039
00040 #include <string>
00041 #include <list>
00042 #include <set>
00043 #include <map>
00044 #include "sigtype.hh"
00045 #include "smartpointer.hh"
00046 #include "tlib.hh"
00047 #include "uitree.hh"
00048
00049 #define kMaxCategory 32
00050
00051 class Klass
00052 {
00053
00054 protected:
00055 string fKlassName;
00056 string fSuperKlassName;
00057 int fNumInputs;
00058 int fNumOutputs;
00059
00060
00061
00062 set<string> fIncludeFileSet;
00063 set<string> fLibrarySet;
00064
00065 list<Klass* > fSubClassList;
00066
00067 list<string> fDeclCode;
00068 list<string> fStaticInitCode;
00069 list<string> fStaticFields;
00070 list<string> fInitCode;
00071 list<string> fUICode;
00072 list<string> fSlowCode;
00073 list<string> fExecCode;
00074
00075
00076 list<string> fPostCode;
00077
00078
00079 bool vec;
00080
00081
00082 public:
00083
00084 Klass (const string& name, const string& super, int numInputs, int numOutputs, bool __vec = false)
00085 : fKlassName(name), fSuperKlassName(super), fNumInputs(numInputs), fNumOutputs(numOutputs), vec(__vec)
00086 {}
00087
00088 virtual ~Klass() {}
00089
00090 void addIncludeFile (const string& str) { fIncludeFileSet.insert(str); }
00091
00092 void addLibrary (const string& str) { fLibrarySet.insert(str); }
00093
00094 void collectIncludeFile(set<string>& S);
00095
00096 void collectLibrary(set<string>& S);
00097
00098 void addSubKlass (Klass* son) { fSubClassList.push_back(son); }
00099
00100 void addDeclCode (const string& str) { fDeclCode.push_back(str); }
00101
00102 void addInitCode (const string& str) { fInitCode.push_back(str); }
00103
00104 void addStaticInitCode (const string& str) { fStaticInitCode.push_back(str); }
00105
00106 void addStaticFields (const string& str) { fStaticFields.push_back(str); }
00107
00108 void addUICode (const string& str) { fUICode.push_back(str); }
00109
00110
00111 void addSlowCode (const string& str) { fSlowCode.push_back(str); }
00112
00113
00114
00115 void addExecCode ( const string& str) { fExecCode.push_back(str); }
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 void addPostCode (const string& str) { fPostCode.push_front(str); }
00131
00132
00133
00134 virtual void println(int n, ostream& fout);
00135
00136 virtual void printIncludeFile(ostream& fout);
00137
00138 virtual void printLibrary(ostream& fout);
00139
00140 int inputs() { return fNumInputs; }
00141 int outputs() { return fNumOutputs; }
00142 };
00143
00144 class SigIntGenKlass : public Klass {
00145 public:
00146
00147 SigIntGenKlass (const string& name) : Klass(name, "", 0, 1, false) {}
00148
00149 virtual void println(int n, ostream& fout);
00150 };
00151
00152 class SigFloatGenKlass : public Klass {
00153 public:
00154
00155 SigFloatGenKlass (const string& name) : Klass(name, "", 0, 1, false) {}
00156
00157 virtual void println(int n, ostream& fout);
00158 };
00159
00160
00161 #endif