00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00028 #ifndef methods_h
00029 #define methods_h
00030
00031 #include "token.h"
00032 #include "make_array.h"
00033
00035 class MdRecord {
00036 public:
00037
00039 MdRecord():
00040 mname( "" ),
00041 mdescription( "" ),
00042 moutput( 0 ),
00043 minput( 0 ),
00044 mgoutput( 0 ),
00045 mginput( 0 ),
00046 mkeywords( 0 ),
00047 mtypes( 0 )
00048 {};
00049
00052 MdRecord(const char name[],
00053 const char description[],
00054 const MakeArray<Index>& output,
00055 const MakeArray<Index>& input,
00056 const MakeArray<Index>& goutput,
00057 const MakeArray<Index>& ginput,
00058 const MakeArray<String>& keywords,
00059 const MakeArray<TokValType>& types) :
00060 mname( name ),
00061 mdescription( description ),
00062 moutput( output ),
00063 minput( input ),
00064 mgoutput( goutput ),
00065 mginput( ginput ),
00066 mkeywords( keywords ),
00067 mtypes( types )
00068 {
00069
00070
00071
00072
00073
00074
00075 assert( mkeywords.nelem() == mtypes.nelem() );
00076 }
00077
00078 const String& Name() const { return mname; }
00079 const String& Description() const { return mdescription; }
00080 const ArrayOfIndex& Output() const { return moutput; }
00081 const ArrayOfIndex& Input() const { return minput; }
00082 const ArrayOfIndex& GOutput() const { return mgoutput; }
00083 const ArrayOfIndex& GInput() const { return mginput; }
00084 const Array<String>& Keywords() const { return mkeywords; }
00085 const Array<TokValType>& Types() const { return mtypes; }
00086
00094 ostream& PrintTemplate(ostream& os, bool show_description=true) const;
00095
00098 MdRecord operator=(const MdRecord&){
00099 cout << "MdRecord cannot be assigned!\n";
00100 exit(1);
00101 }
00102 private:
00103
00105 String mname;
00106
00108 String mdescription;
00109
00111 ArrayOfIndex moutput;
00112
00114 ArrayOfIndex minput;
00115
00117 ArrayOfIndex mgoutput;
00118
00120 ArrayOfIndex mginput;
00121
00123 ArrayOfString mkeywords;
00124
00126 Array<TokValType> mtypes;
00127
00128 };
00129
00130
00131
00132 #define NAME(x) x
00133 #define DESCRIPTION(x) x
00134 #define OUTPUT MakeArray<Index>
00135 #define INPUT MakeArray<Index>
00136 #define GOUTPUT MakeArray<Index>
00137 #define GINPUT MakeArray<Index>
00138 #define KEYWORDS MakeArray<String>
00139 #define TYPES MakeArray<TokValType>
00140
00145 void define_md_data();
00146
00149 void define_md_map();
00150
00153 ostream& operator<<(ostream& os, const MdRecord& mdr);
00154
00155
00156 #endif // methods_h