FscrunchInterpreter.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2019 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/General/Pulsar/FscrunchInterpreter.h
10 
11 #ifndef __Pulsar_FscrunchInterpreter_h
12 #define __Pulsar_FscrunchInterpreter_h
13 
14 #include <string>
15 
16 namespace Pulsar {
17 
19  template <class Engine>
20  class FscrunchInterpreter
21  {
22  public:
23 
25 
26  template <class Container, class Interpreter>
27  void fscrunch (Interpreter* interpreter, Container* container, const std::string& args)
28  {
29  bool scrunch_by = false;
30  std::string temp = args;
31 
32  if (args[0] == 'x')
33  {
34  scrunch_by = true;
35  temp.erase (0,1);
36  }
37 
38  unsigned scrunch = interpreter->template setup<unsigned> (temp, 0);
39 
40  if (!scrunch)
41  container -> fscrunch();
42  else if (scrunch_by)
43  container -> fscrunch (scrunch);
44  else
45  container -> fscrunch_to_nchan (scrunch);
46  }
47 
48  protected:
49 
50  Reference::To<Engine> engine;
51 
52  };
53 
54 }
55 
56 #endif
57 
void fscrunch(Interpreter *interpreter, Container *container, const std::string &args)
Default constructor.
Definition: FscrunchInterpreter.h:37
Data storage implementations.
Definition: Container.h:24
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Pulsar data processing command language interpreter.
Definition: Interpreter.h:57

Generated using doxygen 1.8.17