seqplatform.h
1 /***************************************************************************
2  seqplatform.h - description
3  -------------------
4  begin : Sat Apr 3 2004
5  copyright : (C) 2000-2015 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SEQPLATFORM_H
19 #define SEQPLATFORM_H
20 
21 #include <tjutils/tjhandler.h>
22 
23 #include <odinseq/seqtree.h>
24 #include <odinseq/seqplot.h>
25 #include <odinseq/seqcmdline.h>
26 
27 // Global Bruker stuff
28 #define REFGAIN_FILE "odin_refgain"
29 #define MAINNUC_FILE "odin_mainnuc"
30 
31 
32 
33 // forward declarations for hardware drivers
34 class SeqAcqDriver;
35 class SeqEpiDriver;
37 class SeqDelayDriver;
38 class SeqDelayVecDriver;
39 class SeqFreqChanDriver;
40 class SeqGradChanDriver;
43 class SeqListDriver;
44 class SeqCounterDriver;
45 class SeqParallelDriver;
46 class SeqPhaseDriver;
47 class SeqPulsDriver;
48 class SeqTriggerDriver;
49 
50 
51 class eventContext; // forward declaration
52 
53 class ProgressMeter; // forward declaration
54 
56 
64 enum recoMode {odinReco=0, rawData, recoInfoOnly};
65 
67 
74 
75 
77 
83 class SeqPlatform : public virtual SeqClass {
84 
85  public:
86  enum eventLogging {noLogging=0,loggEvent};
87 
91  virtual void init() = 0;
92 
96  virtual void reset_before_prep() = 0;
97 
102  virtual void prepare_measurement(unsigned int nacqs_total) = 0;
103 
104 
105  // functions for driver factory
106  virtual SeqAcqDriver* create_driver(SeqAcqDriver*) const = 0;
107  virtual SeqEpiDriver* create_driver(SeqEpiDriver*) const = 0;
108  virtual SeqDecouplingDriver* create_driver(SeqDecouplingDriver*) const = 0;
109  virtual SeqDelayDriver* create_driver(SeqDelayDriver*) const = 0;
110  virtual SeqDelayVecDriver* create_driver(SeqDelayVecDriver*) const = 0;
111  virtual SeqFreqChanDriver* create_driver(SeqFreqChanDriver*) const = 0;
112  virtual SeqGradChanDriver* create_driver(SeqGradChanDriver*) const = 0;
113  virtual SeqGradChanParallelDriver* create_driver(SeqGradChanParallelDriver*) const = 0;
114  virtual SeqGradTrapezDriver* create_driver(SeqGradTrapezDriver*) const = 0;
115  virtual SeqListDriver* create_driver(SeqListDriver*) const = 0;
116  virtual SeqCounterDriver* create_driver(SeqCounterDriver*) const = 0;
117  virtual SeqParallelDriver* create_driver(SeqParallelDriver*) const = 0;
118  virtual SeqPhaseDriver* create_driver(SeqPhaseDriver*) const = 0;
119  virtual SeqPulsDriver* create_driver(SeqPulsDriver*) const = 0;
120  virtual SeqTriggerDriver* create_driver(SeqTriggerDriver*) const = 0;
121 
122  virtual int process(int argc, char *argv[]) = 0;
123  virtual SeqCmdlineActionList get_actions_usage() const = 0;
124 
125  virtual void pre_event (eventContext& context) const = 0;
126  virtual void post_event(eventContext& context) const = 0;
127 
128  virtual fvector get_acq_channel_scale_factors() const = 0;
129 
130  virtual STD_string get_program(programContext& context) const = 0;
131 
132  virtual STD_string get_rawfile() const = 0;
133  virtual STD_string get_rawdatatype() const = 0;
134  virtual unsigned int get_rawheader_size() const = 0;
135  virtual STD_string get_image_proc() const = 0;
136  virtual bool create_recoInfo() const = 0;
137 
138  virtual int write_rf_waveform (const STD_string& filename, const cvector& waveform) const = 0;
139  virtual int load_rf_waveform (const STD_string& filename, cvector& result) const = 0;
140 
141  virtual int get_max_methodname_length() const = 0;
142 
143  virtual void set_eventlogging(eventLogging loggflag) = 0;
144 
145  // Paravision specific
146  virtual bool pv_pilot(ProgressMeter* progmeter) {return true;}
147  virtual STD_string pv_pilot_scan() const {return "";}
148  virtual bool pv_gop(bool autorg, ProgressMeter* progmeter) {return true;}
149  virtual bool pv_stop() {return true;}
150 
151  // IDEA specific
152  virtual void set_idea_pars(void* pMrProt,void* pSeqLim,void* pSeqExpo, recoMode reco_mode) {}
153 
154  // StandAlone specific
155  virtual SeqPlotDataAbstract* get_plot_data() {return 0;}
156  virtual bool create_plot_events(ProgressMeter* progmeter) {return true;}
157 
158  virtual ~SeqPlatform() {}
159 
160  protected:
161  SeqPlatform() {}
162 };
163 
164 
166 
167 
173 
174  public:
177 
178  bool set_current(odinPlatform pf);
179  SeqPlatform* get_current() {return instance[get_current_platform_id()];}
180  odinPlatform get_current_platform_id() {return SystemInterface::get_current_pf();}
181 
182  private:
183  friend class SeqPlatformProxy;
184 
185  SeqPlatform* instance[numof_platforms];
186  static odinPlatform pf_during_platform_construction;
187 };
188 
189 
191 
192 
197 class SeqPlatformProxy : public virtual SeqClass, public StaticHandler<SeqPlatformProxy> {
198  public:
199 
200  SeqPlatformProxy() {set_label("SeqPlatformProxy");}
201 
202  static void set_current_platform(odinPlatform pF);
203  static odinPlatform get_current_platform();
204 
205  static int load_systemInfo(const STD_string& filename);
206 
207  static STD_string get_platform_str(odinPlatform pF);
208  static svector get_possible_platforms();
209 
210  static STD_string get_platforms_usage();
211 
212  static int get_platform_for_action(const STD_string& action);
213 
214 
215  SeqPlatform& operator * () {return *get_platform_ptr();}
216  SeqPlatform* operator -> () {return get_platform_ptr();}
217 
218  // functions to initialize/delete static members by the StaticHandler template class
219  static void init_static();
220  static void destroy_static();
221 
222  private:
223  friend class SeqPlatform;
224 
225  // manually allocate of platform instances
226  static void create_platform_instances();
227 
228  static SeqPlatform* get_platform_ptr();
229 
230  // manage platform instances (driver factories)
232 };
233 
234 
235 
236 
237 #endif
odinPlatform
Definition: system.h:39
TinyVector< T, N_rows > operator*(const TinyMatrix< T, N_rows, N_columns > &matrix, const TinyVector< T, N_columns > &vector)
Definition: utils.h:149
recoMode
Definition: seqplatform.h:64