PhaseSeriesUnloader.h
1 
2 /***************************************************************************
3  *
4  * Copyright (C) 2003-2009 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 //-*-C++-*-
9 
10 // dspsr/Signal/Pulsar/dsp/PhaseSeriesUnloader.h
11 
12 #ifndef __PhaseSeriesUnloader_h
13 #define __PhaseSeriesUnloader_h
14 
15 #include "OwnStream.h"
16 #include "Reference.h"
17 
18 namespace dsp {
19 
20  class PhaseSeries;
21  class Operation;
22  class FilenameConvention;
23 
25  class PhaseSeriesUnloader : public OwnStream
26  {
27 
28  public:
29 
32 
34  virtual ~PhaseSeriesUnloader ();
35 
37  virtual PhaseSeriesUnloader* clone () const = 0;
38 
40  virtual void unload (const PhaseSeries*) = 0;
41 
43  virtual void partial (const PhaseSeries*);
44 
46  virtual PhaseSeries* recycle () { return 0; }
47 
49  virtual void finish ();
50 
52  virtual std::string get_filename (const PhaseSeries* data) const;
53 
55  virtual void set_convention (FilenameConvention*);
56  virtual FilenameConvention* get_convention ();
57 
59  virtual void set_directory (const std::string&);
60  virtual std::string get_directory () const;
61 
63  virtual void set_path_add_source (bool);
64  virtual bool get_path_add_source () const;
65 
67  virtual void set_prefix (const std::string&);
68  virtual std::string get_prefix () const;
69 
71  virtual void set_extension (const std::string&);
72  virtual std::string get_extension () const;
73 
75  virtual void set_minimum_integration_length (double seconds) = 0;
76 
77  protected:
78 
81 
83  std::string directory;
84 
86  std::string prefix;
87 
89  std::string extension;
90 
92  bool path_add_source;
93 
94  };
95 
98  {
99  public:
100  virtual std::string get_filename (const PhaseSeries* data) = 0;
101  };
102 
104  class FilenameEpoch : public FilenameConvention
105  {
106  public:
107  FilenameEpoch ();
108  void set_datestr_pattern (const std::string&);
109  void set_integer_seconds (unsigned);
110  std::string get_filename (const PhaseSeries* data);
111 
112  bool report_unload;
113 
114  protected:
115  std::string datestr_pattern;
116  unsigned integer_seconds;
117  };
118 
120  class FilenamePulse : public FilenameConvention
121  {
122  public:
123  std::string get_filename (const PhaseSeries* data);
124  };
125 
128  {
129  public:
131  void set_base_filename (const std::string& s) { filename_base = s; }
132  void set_index (unsigned idx) { current_index = idx; }
133  unsigned get_index () const { return current_index; }
134  std::string get_filename (const PhaseSeries* data);
135  protected:
136  std::string filename_base;
137  unsigned current_index;
138  };
139 
140  class FilenameMJD : public FilenameConvention
141  {
142  public:
143  FilenameMJD (unsigned digits);
144  void set_base_filename (const std::string& s) { filename_base = s; }
145  std::string get_filename (const PhaseSeries* data);
146  protected:
147  std::string filename_base;
148  unsigned digits;
149  };
150 
151 }
152 
153 #endif // !defined(__PhaseSeriesUnloader_h)
virtual void set_convention(FilenameConvention *)
Set the filename convention.
Definition: PhaseSeriesUnloader.C:46
void phase(Profile *input)
virtual void set_minimum_integration_length(double seconds)=0
Set the minimum integration length required to unload data.
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Defines the output filename convention.
Definition: PhaseSeriesUnloader.h:102
virtual std::string get_filename(const PhaseSeries *data) const
Generate a filename using the current convention.
Definition: PhaseSeriesUnloader.C:108
virtual void set_extension(const std::string &)
Set the extension to be added to the end of filenames.
Definition: PhaseSeriesUnloader.C:90
std::string extension
The filename extension.
Definition: PhaseSeriesUnloader.h:94
Data as a function of pulse phase.
Definition: PhaseSeries.h:28
virtual void unload(const PhaseSeries *)=0
Unload the PhaseSeries data.
virtual void set_prefix(const std::string &)
Set the prefix to be added to the front of filenames.
Definition: PhaseSeriesUnloader.C:57
virtual void set_directory(const std::string &)
Set the directory to which output data will be written.
Definition: PhaseSeriesUnloader.C:68
std::string directory
The filename directory.
Definition: PhaseSeriesUnloader.h:88
Output filenames with a sequentially increasing index appended.
Definition: PhaseSeriesUnloader.h:132
virtual void partial(const PhaseSeries *)
Handle partially completed PhaseSeries data.
Definition: PhaseSeriesUnloader.C:32
virtual ~PhaseSeriesUnloader()
Destructor.
Definition: PhaseSeriesUnloader.C:28
Reference::To< FilenameConvention > convention
The filename convention.
Definition: PhaseSeriesUnloader.h:85
virtual void finish()
Perform any clean up tasks before completion.
Definition: PhaseSeriesUnloader.C:39
Output filenames based on the pulse number (for single pulses)
Definition: PhaseSeriesUnloader.h:125
std::string get_source() const
Return the source name.
Definition: Observation.h:122
virtual void set_path_add_source(bool)
place output files in a sub-directory named by source
Definition: PhaseSeriesUnloader.C:79
virtual PhaseSeriesUnloader * clone() const =0
Clone operator.
Output filenames based on the date/time of the observation.
Definition: PhaseSeriesUnloader.h:109
std::string prefix
The filename prefix.
Definition: PhaseSeriesUnloader.h:91
virtual PhaseSeries * recycle()
After unload, a different PhaseSeries may be available for use.
Definition: PhaseSeriesUnloader.h:51
PhaseSeriesUnloader()
Constructor.
Definition: PhaseSeriesUnloader.C:21
virtual Phase phase(const MJD &t) const=0
bool path_add_source
Put each output file in a sub-directory named by source.
Definition: PhaseSeriesUnloader.h:97

Generated using doxygen 1.8.17