BitSeries.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 #ifndef __BitSeries_h
10 #define __BitSeries_h
11 
12 #include <memory>
13 
14 #include "dsp/Observation.h"
15 #include "dsp/Memory.h"
16 
17 namespace dsp {
18 
19  class Input;
20 
22 
30  class BitSeries : public Observation {
31 
32  friend class Input;
33 
34  public:
36  BitSeries ();
37 
39  virtual ~BitSeries ();
40 
42  virtual void resize (int64_t nsamples);
43 
45  virtual BitSeries& operator = (const BitSeries& data);
46 
48  void copy (const Observation*);
49 
51  virtual void copy (const BitSeries* bs)
52  { operator=( *bs ); }
53 
55  BitSeries& operator = (const Observation& obs)
56  { Observation::operator= (obs); return *this; }
57 
59  virtual unsigned char* get_rawptr () { return data; }
60 
62  virtual const unsigned char* get_rawptr () const { return data; }
63 
65  virtual void zero ();
66 
68  unsigned get_request_offset () const { return request_offset; }
69 
71  uint64_t get_request_ndat () const { return request_ndat; }
72 
74  virtual unsigned char* get_datptr (uint64_t sample = 0);
75 
77  virtual const unsigned char* get_datptr (uint64_t sample = 0) const;
78 
80  virtual void copy_data (const BitSeries* data, uint64_t idat_start = 0, uint64_t ndat = 0);
81 
82  uint64_t get_size () const { return data_size; }
83 
85  virtual void append (const BitSeries* little);
86 
88  void set_input_sample (int64_t sample) { input_sample = sample; }
89 
91  int64_t get_input_sample (Input* input = 0) const;
92 
94  const Input* get_loader() const { return input; }
95 
96  void set_memory (Memory*);
97 
98  Memory* get_memory () { return memory; }
99 
101  void internal_match (const BitSeries*);
102 
104  void copy_configuration (const Observation* copy);
105 
107  class Extension : public Reference::Able { };
108 
109  void set_extension (Extension* ext) { extension = ext; }
110  bool has_extension () { return extension; }
111  Extension* get_extension () { return extension; }
112  const Extension* get_extension () const { return extension; }
113 
114  protected:
115 
116  friend class Unpacker;
117 
119  unsigned char* data;
120 
122 
124  int64_t data_size;
125 
127  int64_t input_sample;
128 
130  unsigned request_offset;
131 
133  uint64_t request_ndat;
134 
136  Input* input;
137 
140 
143 
144  };
145 
146 }
147 
148 #endif
virtual unsigned char * get_datptr(uint64_t sample=0)
Return pointer to the specified time slice (ie ch0,pol0,dim0)
Definition: BitSeries.C:126
const Observation & operator=(const Observation &)
Assignment operator.
Definition: Observation.C:404
int64_t get_input_sample(Input *input=0) const
Return the sample offset from the start of the data source.
Definition: BitSeries.C:138
int64_t data_size
The size (in bytes) of the allocated data buffer.
Definition: BitSeries.h:129
void internal_match(const BitSeries *)
Match the internal memory layout of another BitSeries.
Definition: BitSeries.C:212
Observation()
Null constructor.
Definition: Observation.C:26
void copy(const Observation *)
Call BitSeries::copy if Observation is a BitSeries.
Definition: BitSeries.C:98
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 void resize(int64_t nsamples)
Allocate the space required to store nsamples time samples.
Definition: BitSeries.C:55
virtual unsigned char * get_rawptr()
Return pointer to the raw data buffer.
Definition: BitSeries.h:64
Input * input
The Input instance to last set input_sample.
Definition: BitSeries.h:141
virtual void zero()
Set all bytes to zero.
Definition: BitSeries.C:37
Reference::To< Memory > memory
The memory manager.
Definition: BitSeries.h:144
uint64_t get_ndat() const
Return the number of time samples in container.
Definition: Observation.h:107
uint64_t get_request_ndat() const
Number of time samples requested.
Definition: BitSeries.h:76
void copy_configuration(const Observation *copy)
Copy the configuration of another BitSeries instance (not the data)
Definition: BitSeries.C:242
void set_input_sample(int64_t sample)
Set the sample offset from start of the data source.
Definition: BitSeries.h:93
virtual ~BitSeries()
Destructor.
Definition: BitSeries.C:31
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
virtual uint64_t get_nbytes(uint64_t nsamples) const
Return the size in bytes of nsamples time samples.
Definition: Observation.C:543
virtual BitSeries & operator=(const BitSeries &data)
Set this equal to data.
Definition: BitSeries.C:108
BitSeries()
Null constructor.
Definition: BitSeries.C:17
unsigned get_request_offset() const
Offset (owing to resolution) to the requested time sample.
Definition: BitSeries.h:73
const Input * get_loader() const
Accessing the Input is not thread-safe.
Definition: BitSeries.h:99
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
Abstract base class of Transformations that convert n-bit to float.
Definition: Unpacker.h:42
int64_t input_sample
Sample offset from start of source; attribute used by Input class.
Definition: BitSeries.h:132
uint64_t request_ndat
Number of time samples requested.
Definition: BitSeries.h:138
virtual void append(const BitSeries *little)
Append little onto the end of this.
Definition: BitSeries.C:182
virtual void copy_data(const BitSeries *data, uint64_t idat_start=0, uint64_t ndat=0)
Copy the data of another BitSeries instance.
Definition: BitSeries.C:146
Pure virtual base class of objects that manage memory allocation and destruction.
Definition: Memory.h:23
unsigned char * data
The data buffer.
Definition: BitSeries.h:124
Any additional information required to describe the data.
Definition: BitSeries.h:112
Reference::To< Extension > extension
Any additional information required to describe the data.
Definition: BitSeries.h:147
unsigned request_offset
Offset (owing to resolution) to the requested time sample.
Definition: BitSeries.h:135

Generated using doxygen 1.8.17