-
Notifications
You must be signed in to change notification settings - Fork 3
/
ch_vdif_assembler_dspsr.hpp
53 lines (42 loc) · 1.79 KB
/
ch_vdif_assembler_dspsr.hpp
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
//
// We sometimes use the vdif_assembler to supply data to the 'dspsr'
// pulsar data processing software. One technical nuisance issue is
// that dspsr is compiled using a C++03 compiler, whereas ch_vdif_assembler
// assumes C++11.
//
// This header file is C++03 compliant and defines a virtual base class
// ch_vdif_assembler::dspsr_handle which can be used from the dspsr code,
// and a factory function dspsr_handle::make(). The factory function (and
// corresponding non-virtual subclass) are implemented in dspsr_handle.cpp
// where C++11 features can be used.
//
#ifndef _CH_VDIF_ASSEMBLER_DSPSR_HPP
#define _CH_VDIF_ASSEMBLER_DSPSR_HPP
// Note: no C++11 includes (including ch_vdif_assembler.hpp!)
#include <stdint.h>
#include <string>
namespace ch_vdif_assembler {
#if 0
}; // pacify emacs c-mode
#endif
struct dspsr_handle {
static const int nfreq;
static const int64_t nt_chunk;
static const double sampling_rate_Hz;
//
// When the dspsr_handle is constructed, curr_chunk_ix is set to (-1) and curr_data is set to NULL.
// In the first call to advance(), the stream is started, curr_chunk_ix is set to 0, and curr_data
// points to the (4+4)-bit data. Subsequent calls to advance() will modify curr_chunk_ix and curr_data
// appropriately until end-of-stream is reached, at which point curr_data is set to NULL.
//
// The 'curr_data' pointer is an array of shape (nfreq, 2, nt_chunk) containing (4+4)-bit offset-encoded
// complex numbers. Invalid entries are represented by 0x00.
//
int64_t curr_chunk_ix;
const uint8_t *curr_data;
virtual void advance() = 0;
virtual ~dspsr_handle() { }
static dspsr_handle *make(const std::string &filelist_filename);
};
} // namespace ch_vdif_assembler
#endif // _CH_VDIF_ASSEMBLER_DSPSR_HPP