GUPPIBlockFile.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2011 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __GUPPIBlockFile_h
10 #define __GUPPIBlockFile_h
11 
12 #include "dsp/File.h"
13 
14 namespace dsp {
15 
17 
22  class GUPPIBlockFile : public File
23  {
24  public:
25 
27  GUPPIBlockFile (const char* name);
28 
30  ~GUPPIBlockFile ();
31 
33  virtual bool is_valid (const char* filename) const = 0;
34 
36  bool get_signed() const { return signed_8bit; }
37 
38  protected:
39 
41  virtual void open_file (const char* filename) = 0;
42 
44  int64_t load_bytes (unsigned char *buffer, uint64_t nbytes);
45 
47  virtual int load_next_block () = 0;
48 
50  void parse_header ();
51 
53  char *hdr;
54 
56  unsigned char *dat;
57 
59  int hdr_keys;
60 
62  bool time_ordered;
63 
65  bool signed_8bit;
66 
68  uint64_t blocsize;
69 
71  uint64_t overlap;
72 
74  uint64_t current_block_byte;
75 
77  int64_t current_pktidx;
78 
80  int64_t current_nzero_byte;
81 
83  int packet_size;
84 
85  };
86 
87 }
88 
89 #endif // !defined(__GUPPIFile_h)
bool get_signed() const
Return true if data are signed.
Definition: GUPPIBlockFile.h:46
uint64_t blocsize
Size of current data block in bytes.
Definition: GUPPIBlockFile.h:78
virtual bool is_valid(const char *filename) const =0
Returns true if filename is a valid GUPPI file.
uint64_t current_block_byte
Location in current data block.
Definition: GUPPIBlockFile.h:84
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
unsigned char * dat
Pointer to current data block.
Definition: GUPPIBlockFile.h:66
void parse_header()
Parse the current header into info struct.
Definition: GUPPIBlockFile.C:51
bool signed_8bit
Are 8-bit data signed or unsigned.
Definition: GUPPIBlockFile.h:75
int64_t current_nzero_byte
Number of bytes of zeros to emit.
Definition: GUPPIBlockFile.h:90
GUPPIBlockFile(const char *name)
Construct and open file
Definition: GUPPIBlockFile.C:24
Loads BitSeries data from file.
Definition: File.h:38
std::string name
Operation name.
Definition: Operation.h:153
int64_t current_pktidx
Current block packet index.
Definition: GUPPIBlockFile.h:87
virtual void open_file(const char *filename)=0
Open the file.
int packet_size
Packet size.
Definition: GUPPIBlockFile.h:93
int64_t load_bytes(unsigned char *buffer, uint64_t nbytes)
Send data bytes to unpacker.
Definition: GUPPIBlockFile.C:166
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
uint64_t overlap
Overlap between blocks, in samples (per channel)
Definition: GUPPIBlockFile.h:81
char * hdr
Pointer to current header.
Definition: GUPPIBlockFile.h:63
void set_overlap_buffer(BitSeries *)
Buffer used to store overlap (useful in multi-threaded applications)
Definition: Seekable.C:323
virtual int load_next_block()=0
Load next hdr/data block.
int hdr_keys
Number of keys in header string.
Definition: GUPPIBlockFile.h:69
bool time_ordered
Have the data been transposed already.
Definition: GUPPIBlockFile.h:72
~GUPPIBlockFile()
Destructor.
Definition: GUPPIBlockFile.C:39

Generated using doxygen 1.8.17