OutputDADABuffer.h
1 /***************************************************************************
2  * *
3  * Copyright (C) 2024 by Jesmigel A. Cantos *
4  * Licensed under the Academic Free License version 2.1 *
5  * *
6  ***************************************************************************/
7 
8 #ifndef __dsp_OutputDADABuffer_h
9 #define __dsp_OutputDADABuffer_h
10 
11 #include "dsp/Sink.h"
12 #include "dsp/BitSeries.h"
13 #include "dsp/DADAHeader.h"
14 
15 #include "dada_hdu.h"
16 
17 #include <ipcio.h>
18 #include <ipcbuf.h>
19 
20 namespace dsp {
21 
26  class OutputDADABuffer : public Sink<BitSeries>
27  {
28  public:
33  OutputDADABuffer(const std::string &key_string);
34 
39 
43  void calculation ();
44 
48  void reopen();
49 
53  void close();
54 
59  DADAHeader* get_header () { return &dada_header; }
60 
61  private:
66  void connect(key_t smrb_key);
67 
71  void disconnect();
72 
76  void write_header();
77 
83  void unload_bytes(const void* buffer, uint64_t nbytes);
84 
90  key_t parse_psrdada_key(const std::string &key_string);
91 
92  protected:
93 
95  dada_hdu_t* hdu = nullptr;
96 
98  bool connected = false;
99 
101  bool locked = false;
102 
104  bool header_written = false;
105 
107  DADAHeader dada_header;
108 
109  private:
110 
114  void display_input_contents();
115 
116  };
117 } // namespace dsp
118 
119 #endif // __dsp_OutputDADABuffer_h
bool connected
Flag indicating connection status.
Definition: OutputDADABuffer.h:103
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
OutputDADABuffer(const std::string &key_string)
Constructor class for writing BitSeries data to the DADA ring buffer.
Definition: OutputDADABuffer.C:20
~OutputDADABuffer()
Destructor.
Definition: OutputDADABuffer.C:32
void close()
Write end-of-data to the data ring buffer and close it.
Definition: OutputDADABuffer.C:96
void reopen()
Open the data ring buffer for writing.
Definition: OutputDADABuffer.C:77
bool header_written
Header has been written to header block in shared memory.
Definition: OutputDADABuffer.h:109
Defines the interface to operations that terminate on input.
Definition: Sink.h:26
DADAHeader dada_header
Manages the ASCII header that will be written to the header block.
Definition: OutputDADABuffer.h:112
DADAHeader * get_header()
Get the DADA header manager.
Definition: OutputDADABuffer.h:64
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
void calculation()
Write BitSeries data to shared memory.
Definition: OutputDADABuffer.C:173
Parses Observation attributes from an ASCII header.
Definition: ASCIIObservation.h:29
bool locked
Flag indicating lock status.
Definition: OutputDADABuffer.h:106
dada_hdu_t * hdu
Shared memory interface.
Definition: OutputDADABuffer.h:100

Generated using doxygen 1.8.17