00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SEQTREE_H
00021 #define SEQTREE_H
00022
00023 #include <tjutils/tjvallist.h>
00024
00025 #include <odinseq/seqclass.h>
00026 #include <odinseq/seqoperator.h>
00027
00028
00029
00035
00036
00040 class SeqTreeCallbackAbstract {
00041
00042 public:
00043 virtual void display_node(const SeqClass* thisnode, const SeqClass* parentnode, int treelevel, const svector& columntext) = 0;
00044
00045 };
00046
00048
00049 class ProgressMeter;
00050
00057 enum eventAction {seqRun=0, printEvent, countEvents};
00058
00062 struct eventContext {
00063 eventContext() : action(seqRun), noflush(false), seqcheck(false),
00064 elapsed(0.0),
00065 event_display(0), event_progmeter(0) {}
00066
00067
00068 eventAction action;
00069
00070
00071 bool noflush;
00072
00073
00074 bool seqcheck;
00075
00076
00077 double elapsed;
00078
00079
00080 SeqTreeCallbackAbstract* event_display;
00081
00082
00083 ProgressMeter* event_progmeter;
00084 };
00085
00087
00095 enum freqlistAction {calcDeps=0,calcList,calcAcqList,calcDecList};
00096
00098
00107 enum programMode {brukerPpg=0, brukerGpg, brukerParx, epicCode, epicPg, epicScan, epicPreScan, epicPreScanDummy, numOfProgModes};
00108
00109
00113 struct programContext {
00114 programContext() : mode(programMode(0)), formatted(true), nestlevel(0), neststatus(false) {}
00115
00116
00117 programMode mode;
00118
00119
00120
00121
00122 bool formatted;
00123
00124
00125 int nestlevel;
00126
00127
00128 bool neststatus;
00129 };
00130
00131
00133
00134 class SeqTreeObj;
00135
00144 enum queryAction {count_acqs, checkoccur, check_acq_iter, tag_toplevel_reploop, display_tree};
00145
00149 struct queryContext {
00150 queryContext() : action(count_acqs), numof_acqs(0),
00151 checkoccur_sto(0), checkoccur_result(false),
00152 check_acq_iter_result(false),
00153 tree_display(0), parentnode(0), treelevel(0),
00154 repetitions_prot(0) {}
00155
00156
00157 queryAction action;
00158
00159
00160 unsigned int numof_acqs;
00161
00162
00163 const SeqTreeObj* checkoccur_sto;
00164 bool checkoccur_result;
00165
00166 bool check_acq_iter_result;
00167
00168
00169 SeqTreeCallbackAbstract* tree_display;
00170 const SeqTreeObj* parentnode;
00171 int treelevel;
00172
00173
00174 int repetitions_prot;
00175 };
00176
00177
00179
00184 struct SeqValList : public ValList<double> {
00185 SeqValList(const STD_string& object_label="unnamedSeqValList", unsigned int repetitions=1) : ValList<double>(object_label,repetitions) {}
00186 };
00187
00189
00190
00191
00195 class SeqTreeObj : public virtual SeqClass {
00196
00197 public:
00198
00202 virtual double get_duration() const = 0;
00203
00209 virtual STD_string get_program(programContext& context) const {return "";}
00210
00214 virtual STD_string get_properties() const {return "";}
00215
00216
00220 virtual unsigned int event(eventContext& context) const {
00221 if(context.action==printEvent) display_event(context);
00222 context.elapsed+=get_duration();
00223 return 0;
00224 }
00225
00226
00231 virtual RecoValList get_recovallist(unsigned int reptimes, JDXkSpaceCoords& coords) const {return RecoValList();}
00232
00236 bool contains(const SeqTreeObj* sto) const;
00237
00241 void tree(SeqTreeCallbackAbstract* display) const;
00242
00246 virtual SeqValList get_freqvallist(freqlistAction action) const {return SeqValList();}
00247
00251 virtual SeqValList get_delayvallist() const {return SeqValList();}
00252
00257 virtual double get_rf_energy() const {return 0.0;}
00258
00259
00260 protected:
00261 friend class SeqObjList;
00262 friend class SeqObjVector;
00263 friend class SeqParallel;
00264
00265
00266
00267 SeqTreeObj();
00268
00269 virtual ~SeqTreeObj() {}
00270
00271 SeqTreeObj& operator = (const SeqTreeObj& sto) {
00272 SeqClass::operator =(sto);
00273 return *this;
00274 }
00275
00279 virtual void query(queryContext& context) const;
00280
00281
00282 static int looplevel;
00283
00284 private:
00285 void display_event(eventContext& context) const;
00286
00287 };
00288
00289
00290
00294 #endif