BlockFile.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2005 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/BlockFile.h
10 
11 
12 #ifndef __dsp_BlockFile_h
13 #define __dsp_BlockFile_h
14 
15 #include "dsp/File.h"
16 
17 namespace dsp {
18 
20  class BlockFile : public File
21  {
22 
23  public:
24 
26  BlockFile (const char* name);
27 
29  virtual ~BlockFile ();
30 
32  uint64_t get_block_data_bytes () const;
33 
34  protected:
35 
37  uint64_t block_bytes;
38 
40  uint64_t block_header_bytes;
41 
43  uint64_t block_tailer_bytes;
44 
46  uint64_t current_block_byte;
47 
49  uint64_t total_bytes_missing;
50 
52 
55  virtual int64_t fstat_file_ndat(uint64_t tailer_bytes=0);
56 
58 
61  virtual int64_t load_bytes (unsigned char* buffer, uint64_t nbytes);
62 
64 
69  virtual int64_t seek_bytes (uint64_t bytes);
70 
72 
74  virtual uint64_t skip_extra ();
75 
76  private:
77 
79  void init();
80 
81  };
82 
83 }
84 
85 #endif // !defined(__File_h)
86 
87 
virtual ~BlockFile()
Virtual destructor.
Definition: BlockFile.C:35
uint64_t get_block_data_bytes() const
Get the number of data bytes per block (frame)
Definition: BlockFile.C:39
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
uint64_t block_bytes
Total number of bytes in each block (header + data + tailer)
Definition: BlockFile.h:47
BlockFile(const char *name)
Constructor.
Definition: BlockFile.C:22
virtual int64_t fstat_file_ndat(uint64_t tailer_bytes=0)
Return ndat given the file and header sizes, nchan, npol, and ndim.
Definition: BlockFile.C:197
uint64_t current_block_byte
The current byte within a block.
Definition: BlockFile.h:56
Loads BitSeries data from file.
Definition: File.h:38
std::string name
Operation name.
Definition: Operation.h:153
uint64_t total_bytes_missing
Total number of missing bytes to be zeroed with memset.
Definition: BlockFile.h:59
virtual uint64_t skip_extra()
Skip (by seeking the file pointer) the next tailer and header.
Definition: BlockFile.C:145
uint64_t block_tailer_bytes
Number of bytes in tailer of each block.
Definition: BlockFile.h:53
virtual int64_t load_bytes(unsigned char *buffer, uint64_t nbytes)
Load nbyte bytes of sampled data from the device into buffer.
Definition: BlockFile.C:59
uint64_t block_header_bytes
Number of bytes in header of each block.
Definition: BlockFile.h:50
virtual int64_t seek_bytes(uint64_t bytes)
Set the file pointer to the absolute number of sampled data bytes.
Definition: BlockFile.C:157

Generated using doxygen 1.8.17