This file is indexed.

/usr/include/odinseq/seqmeth.h is in libodin-dev 1.8.8-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
/***************************************************************************
                          seqmeth.h  -  description
                             -------------------
    begin                : Thu Aug 9 2001
    copyright            : (C) 2000-2014 by Thies H. Jochimsen
    email                : thies@jochimsen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SEQMETH_H
#define SEQMETH_H

#include <tjutils/tjstate.h>
#include <tjutils/tjhandler.h>

#include <odinpara/protocol.h>

#include <odinseq/seqlist.h>
#include <odinseq/seqplatform.h>


//////////////////////////////////////////////////////////////////////

// forward declarations
class SeqMethod;
class SeqPulsar;


//////////////////////////////////////////////////////////////////////


/**
  * @ingroup odinseq_internals
  * Proxy class to deal with different ODIN methods at once
  */
class SeqMethodProxy : public StaticHandler<SeqMethodProxy> {


 public:
  SeqMethodProxy() {
    Log<Seq> odinlog("SeqMethodProxy","SeqMethodProxy()");
  }

  static void set_current_method(unsigned int index);
  static SeqMethod* get_current_method();
  static unsigned int get_numof_methods();
  static unsigned int delete_methods();
  static const char* get_method_label();

  static const char* get_status_string();

  // pointer-like syntax to access current method
  SeqMethod* operator -> () {return get_current_method();}
  SeqMethod& operator [] (unsigned int index);

  static bool load_method_so(const STD_string& so_filename);

  // functions to initialize/delete static members by the StaticHandler template class
  static void init_static();
  static void destroy_static();


 protected:

  // called by derivedmethod classes to register themselves
  static void register_method(SeqMethod* meth);


 private:

  // struct to store references to all registered methods
  struct MethodList : public STD_list<SeqMethod*>, public Labeled {};

  static SingletonHandler<MethodList,false> registered_methods;

  
  // struct to store references to the current method
  struct MethodPtr : public Labeled {
    SeqMethod* ptr;
  };

  static SingletonHandler<MethodPtr,false> current_method;

  static SeqMethod* empty_method;


};



//////////////////////////////////////////////////////////////////////

/*
  State diagram for SeqMethod, i.e. for all NMR sequences:

  Possible transitions between states are indicated by
  the corresponding member functions that perform the transition.


  empty <--------\
                 |
    |            | clear()
    | init()     |
    |            |
    V            |
                 |
  initialised ---|
                 |
    |            |
    | build()    |
    |            |
    V            |
                 |
  built ---------|
                 |
    |            |
    | prepare()  |
    |            |
    V            |
                 |
  prepared ------'

*/




/**
  * @ingroup odinseq
  *
  * \brief Base class for methods (sequences)
  *
  * The base class for all NMR sequences.
  * To create a new sequence, write a new class which is derived
  * from SeqMethod and overload the following virtual functions
  * with the specified functionality:
  * - void method_pars_init(): Initialize sequence parameters (set default values,
  *                            append to the list of registered parameters of the method)
  * - void method_seq_init(): Create the internal layout of the sequence, i.e.
  *                           the sequence tree
  * - void method_rels(): Calculate timings of the sequence
  * - void method_pars_set(): Finalize the sequence
  *
  * To get an idea what has to be done in each function, please take a
  * look at the example sequences.
  */
class SeqMethod : protected SeqMethodProxy, public SeqObjList, public virtual JDXeditCaller, public StateMachine<SeqMethod> {


 public:

/**
  * Constructs a method with the given label.
  */
  SeqMethod(const STD_string& method_label);

/**
  * Destructor
  */
  virtual ~SeqMethod();

  // public interface to obtain the different states:

/**
  * Performs state transition to 'empty'
  */
  bool clear() {return empty.obtain_state();}

/**
  * Performs state transition to 'initialised'
  */
  bool init() {return initialised.obtain_state();}

/**
  * Performs state transition to 'built'
  */
  bool build() {return built.obtain_state();}

/**
  * Performs state transition to 'prepared'
  */
  bool prepare() {return prepared.obtain_state();}

/**
  * Updates the timing of the sequence (TR, TE) without changing its structure.
  * If the sequence is not yet in the 'built' state, this state will
  * be obtained first.
  */
  bool update_timings();

/**
  * Prepares the acquisition parameters, i.e. recoInfo structure
  * and performs platform specific preparation (generating pulse program, etc.).
  * This function will be called by the current frontend (ODIN GUI, odin2idea, ...)
  * prior to the measurement.
  */
  bool prep_acquisition() const;


/**
  * Returns the description of the method
  */
  const char* get_description() const {return description.c_str();}

/**
  * This function is used in the ODINMAIN function to hand over control to the SeqMethod object.
  */
  int process(int argc, char *argv[]);


/**
  * Loads the sequence protocol (systemInfo, geometryInfo, sequencePars) from file 'filename'
  */
  int load_protocol(const STD_string& filename);

/**
  * Writes the sequence protocol (systemInfo, geometryInfo, sequencePars) to file 'filename'
  */
  int write_protocol(const STD_string& filename) const {create_protcache(); return protcache->write(filename);}


/**
  * Returns the method-specific parameters
  */
  JcampDxBlock& get_methodPars() {return *methodPars;}

/**
  * Loads the sequence parameters (commonPars & methodPars) from file
  */
  int load_sequencePars(const STD_string& filename);

/**
  * Writes the sequence parameters (commonPars & methodPars) to file
  */
  int write_sequencePars(const STD_string& filename) const;

/**
  * Sets the value of the sequence parameter 'parameter_label' to 'value'.
  * Returns true if successful.
  */
  bool set_sequenceParameter(const STD_string& parameter_label, const STD_string& value);

/**
  * Sets the current set of common sequence parameters
  */
  SeqMethod& set_commonPars(const SeqPars& pars);

/**
  * Returns the current set of common sequence parameters
  */
  SeqPars& get_commonPars() {return (*commonPars);}

/**
  * Sets the current geometry to 'geo'
  */
  SeqMethod& set_geometry(const Geometry& geo)  {geometryInfo->operator = (geo); return *this;}

/**
  * Returns the current geometry
  */
  Geometry& get_geometry() {return *(geometryInfo.unlocked_ptr());}

/**
  * Loads the current geometry from disk
  */
  int load_geometry(const STD_string& filename) {return geometryInfo->load(filename);}

/**
  * Writes the current geometry to disk
  */
  int write_geometry(const STD_string& filename) const {return geometryInfo->write(filename);}

/**
  * Returns reference to the current study info
  */
  Study& get_studyInfo() {return *(studyInfo.unlocked_ptr());}

/**
  * Writes the systemInfo to disk
  */
  int write_systemInfo(const STD_string& filename) const {return systemInfo->write(filename);}

/**
  * Loads the systemInfo from disk
  */
  int load_systemInfo(const STD_string& filename);

/**
  * Initialises the method with the given system-specific stuff
  */
  SeqMethod& init_systemInfo(double basicfreq,double maxgrad,double slewrate);

/**
  * Writes the recoInfo to disk
  */
  int write_recoInfo(const STD_string& filename) const;

/**
  * Writes all files which describe the measurement, uses the given filename-prefix
  */
  int write_meas_contex(const STD_string& prefix) const;

/**
  * Returns the scan duration for this method
  */
  double get_totalDuration() const;

/**
  * Returns the current main nucleus of the sequence, i.e. the nucleus for which both, excitation and acquisition, will be performed
  */
  STD_string get_main_nucleus() const {return systemInfo->get_main_nucleus();}

/**
  * Returns the total number of acquisition windows in the sequence.
  */
  unsigned int get_numof_acquisitions() const;

/**
  * Returns a list of Pulsar pulses which are currently
  * active.
  */
  STD_list<const SeqPulsar*>  get_active_pulsar_pulses() const;
  
  // overloaded virtual functions from SeqTreeObj
  unsigned int event(eventContext& context) const;

  // leave this public for idea_emulation
  void set_current_testcase(unsigned int index) {if(index<numof_testcases()) current_testcase=index;}


 protected:

/**
  * This function must be implemented by the method programmer. It should contain all
  * code that initialies parameters of the method.
  */
  virtual void method_pars_init() = 0;

/**
  * This function must be implemented by the method programmer. It should contain all
  * code that initialises the sequence objects and their arrangement.
  */
  virtual void method_seq_init() = 0;

/**
  * This function must be implemented by the method programmer. It should contain all
  * code that changes the aspects of the sequence objects without changing their
  * serialisation, .e.g. timing calculations should be coded in this function.
  */
  virtual void method_rels() = 0;

/**
  * This function must be implemented by the method programmer. It should contain all
  * code that is called only once before the sequence is started, e.g. the setup of the reconsruction.
  */
  virtual void method_pars_set() = 0;


/**
  * Append a user defined parameter to the list of parameters that describe the method
  */
  SeqMethod& append_parameter(JcampDxClass& ldr,const STD_string& label,parameterMode parmode=edit);

/**
  * This function is used to specify the sequence of this method that will be played out
  */
  SeqMethod& set_sequence(const SeqObjBase& s);


/**
  * Specifies the description of the method
  */
  SeqMethod& set_description(const char* descr) {description=descr;return *this;}


/**
  * This function can be implemented by the method programmer to indicate
  * how many different use cases are there to be tested during sequence test.
  */
  virtual unsigned int numof_testcases() const {return 1;}

/**
  * Returns the index of the current test case, used in method_pars_init to 
  * assign different parameter settings for each test case.
  */
  unsigned int get_current_testcase() const {return current_testcase;}


/**
  * Pointer to the current set of common sequence parameters
  */
  SeqPars* commonPars;

 private:
  friend class SeqMethodProxy;
  friend class SeqCmdLine;

  void set_parblock_labels();

  bool calc_timings();


  // overloaded virtual function from JDXeditCaller
  void parameter_relations(JDXeditWidget* editwidget);

  // interface for quick access to current platform
  mutable SeqPlatformProxy platform;

  // block to hold method-specific parameters
  JcampDxBlock* methodPars;

  STD_string description;

  unsigned int current_testcase;


  // cache handle to method plug-in so that it can be removed later
  void *dl_handle;


  void create_protcache() const;
  mutable Protocol* protcache; // used for returning reference to protocol, local static object does not work on VxWorks



  // states and their transition functions:

  State<SeqMethod> empty;
  bool reset();

  State<SeqMethod> initialised;
  bool empty2initialised();

  State<SeqMethod> built;
  bool initialised2built();

  State<SeqMethod> prepared;
  bool built2prepared();
};

//////////////////////////////////////////////////////////////////////

// Macro to include in every sequence file to create an entry point

// Double-stage macros to stringize METHOD_LABEL, see http://c-faq.com/ansi/stringize.html
#define ODINMETHOD_STRINGIZE_MACRO(x) #x
#define ODINMETHOD_STRINGIZE(x) ODINMETHOD_STRINGIZE_MACRO(x)


#ifdef NO_CMDLINE

#define ODINMETHOD_ENTRY_POINT \
int ODINMAIN(int argc, char *argv[]) {\
  return (new METHOD_CLASS(ODINMETHOD_STRINGIZE(METHOD_LABEL)))->process(argc,argv); \
}

#else

#define ODINMETHOD_ENTRY_POINT \
int ODINMAIN(int argc, char *argv[]) {\
  if(LogBase::set_log_levels(argc,argv,false)) return 0; \
  return (new METHOD_CLASS(ODINMETHOD_STRINGIZE(METHOD_LABEL)))->process(argc,argv); \
}

#endif


#endif