OutputFile.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2011 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/OutputFile.h
10 
11 #ifndef __OutputFile_h
12 #define __OutputFile_h
13 
14 #include "dsp/Sink.h"
15 #include "dsp/BitSeries.h"
16 
17 namespace dsp {
18 
20 
25  class OutputFile : public Sink<BitSeries>
26  {
27  public:
28 
30  OutputFile (const char* operation_name);
31 
33  virtual ~OutputFile ();
34 
35  protected:
36 
37  friend class OutputFileShare;
38 
40  virtual void calculation ();
41 
43  int fd;
44 
46  int header_bytes;
47 
49  std::string output_filename;
50 
52  std::string datestr_pattern;
53 
55  virtual void open_file (const char* filename);
56 
58  void open_file (const std::string& name) { open_file (name.c_str()); }
59 
61  virtual void write_header () = 0;
62 
64  virtual std::string get_extension () const = 0;
65 
67  virtual int64_t unload_bytes (const void* buffer, uint64_t nbytes);
68  };
69 
70 }
71 
72 #endif // !defined(__OutputFile_h)
int fd
The file descriptor.
Definition: OutputFile.h:53
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
virtual void write_header()=0
Write the file header to the open file.
virtual void calculation()
Unload data into the BitSeries specified with set_output.
Definition: OutputFile.C:42
Share one OutputFile among multiple processing threads.
Definition: OutputFileShare.h:35
virtual ~OutputFile()
Destructor.
Definition: OutputFile.C:36
std::string output_filename
The name of the output file.
Definition: OutputFile.h:59
std::string name
Operation name.
Definition: Operation.h:153
std::string datestr_pattern
The pattern used to create an output filename.
Definition: OutputFile.h:62
int header_bytes
The size of the header in bytes.
Definition: OutputFile.h:56
virtual void open_file(const char *filename)
Open the file specified by filename for writing.
Definition: OutputFile.C:67
Defines the interface to operations that terminate on input.
Definition: Sink.h:26
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
virtual int64_t unload_bytes(const void *buffer, uint64_t nbytes)
Load nbyte bytes of sampled data from the device into buffer.
Definition: OutputFile.C:83
virtual std::string get_extension() const =0
Get the extension to be added to the end of new filenames.
OutputFile(const char *operation_name)
Constructor.
Definition: OutputFile.C:27

Generated using doxygen 1.8.17