Seekable.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2002 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/Seekable.h
10 
11 #ifndef __Seekable_h
12 #define __Seekable_h
13 
14 #include "dsp/Memory.h"
15 #include "dsp/Input.h"
16 
17 namespace dsp {
18 
20 
24  class Seekable : public Input
25  {
26 
27  public:
28 
30  Seekable (const char* name);
31 
33  virtual ~Seekable ();
34 
36  virtual bool eod() const;
37 
39  virtual void rewind ();
40 
42  virtual uint64_t get_current_sample() { return current_sample; }
43 
45  void set_output (BitSeries* data);
46 
48  void set_overlap_buffer (BitSeries*);
49 
51  void set_overlap_buffer_memory (Memory * memory);
52 
53  protected:
54 
56  virtual void set_eod(bool _eod){ end_of_data = _eod; }
57 
59  virtual void load_data (BitSeries* data);
60 
62  virtual int64_t load_bytes (unsigned char* buffer, uint64_t bytes) = 0;
63 
65  virtual int64_t load_bytes_device (unsigned char* buffer, uint64_t bytes, void * dev_handle) = 0;
66 
68  virtual int64_t seek_bytes (uint64_t bytes) = 0;
69 
71  virtual uint64_t recycle_data (BitSeries* data);
72 
74  bool end_of_data;
75 
77  uint64_t current_sample;
78 
81 
83  void init();
84  };
85 
86 }
87 
88 #endif // !defined(__Seekable_h)
virtual void load_data(BitSeries *data)
Load next block of data into BitSeries.
Definition: Seekable.C:64
virtual void set_ndat(uint64_t _ndat)
Set the number of time samples in container.
Definition: Observation.h:105
void set_output(BitSeries *data)
Set the bits series into which data will be loaded.
Definition: Seekable.C:318
int64_t get_input_sample(Input *input=0) const
Return the sample offset from the start of the data source.
Definition: BitSeries.C:138
virtual uint64_t get_nsamples(uint64_t nbytes) const
Return the number of samples in nbytes bytes.
Definition: Observation.C:548
virtual int64_t seek_bytes(uint64_t bytes)=0
Seek to absolute position and return absolute position in bytes.
Pure virtual base class of all objects that can load BitSeries data.
Definition: Input.h:31
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
virtual unsigned char * get_rawptr()
Return pointer to the raw data buffer.
Definition: BitSeries.h:64
unsigned get_ndim() const
Return the dimension of each datum.
Definition: Observation.h:80
bool end_of_data
end of data reached
Definition: Seekable.h:84
unsigned get_nbit() const
Return the number of bits per value.
Definition: Observation.h:95
virtual int64_t load_bytes_device(unsigned char *buffer, uint64_t bytes, void *dev_handle)=0
Load data from device to device memory and return the number of bytes read.
virtual ~Seekable()
Destructor.
Definition: Seekable.C:39
uint64_t get_ndat() const
Return the number of time samples in container.
Definition: Observation.h:107
Manages CUDA device memory allocation and destruction.
Definition: MemoryCUDA.h:32
std::string name
Operation name.
Definition: Operation.h:153
virtual int64_t load_bytes(unsigned char *buffer, uint64_t bytes)=0
Load data from device and return the number of bytes read.
Seekable(const char *name)
Constructor.
Definition: Seekable.C:28
unsigned get_npol() const
Return the number of polarizations.
Definition: Observation.h:90
virtual void rewind()
Rewind to the start of the data.
Definition: Seekable.C:49
virtual uint64_t get_nbytes(uint64_t nsamples) const
Return the size in bytes of nsamples time samples.
Definition: Observation.C:543
virtual void set_output(BitSeries *data)
Set the BitSeries to which data will be loaded.
Definition: Input.C:203
virtual bool eod() const
Return true when end of data has been reached.
Definition: Seekable.C:59
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
uint64_t current_sample
Current time sample.
Definition: Seekable.h:87
void set_overlap_buffer(BitSeries *)
Buffer used to store overlap (useful in multi-threaded applications)
Definition: Seekable.C:323
Reference::To< BitSeries > overlap_buffer
Buffer used to store overlap.
Definition: Seekable.h:90
virtual uint64_t get_current_sample()
Inquire current time sample.
Definition: Seekable.h:52
Pure virtual base class of objects that manage memory allocation and destruction.
Definition: Memory.h:23
virtual void set_eod(bool _eod)
set end_of_data
Definition: Seekable.h:66
virtual uint64_t recycle_data(BitSeries *data)
Conserve access to resources by re-using data already in BitSeries.
Definition: Seekable.C:235
void init()
initialize variables
Definition: Seekable.C:43
void set_overlap_buffer_memory(Memory *memory)
Set the memory type used in the overlap buffer.
Definition: Seekable.C:328
unsigned get_nchan() const
Return the number of channels into which the band is divided.
Definition: Observation.h:85

Generated using doxygen 1.8.17