InputBuffering.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 #ifndef __InputBuffering_h
10 #define __InputBuffering_h
11 
12 #include "dsp/BufferingPolicy.h"
13 #include "dsp/TimeSeries.h"
14 #include "dsp/Transformation.h"
15 
16 namespace dsp {
17 
18  class Reserve;
19 
21  class InputBuffering : public BufferingPolicy
22  {
23 
24  public:
25 
27  InputBuffering (HasInput<TimeSeries>* target = 0);
28 
30  void set_target (HasInput<TimeSeries>* input);
31 
33  void pre_transformation ();
34 
36  void post_transformation ();
37 
39  void set_next_start (uint64_t next_start_sample);
40 
42  void set_maximum_samples (uint64_t samples);
43 
45  int64_t get_next_contiguous () const;
46 
48  uint64_t bytes_storage() const override;
49 
51  class Share;
52 
54  virtual const TimeSeries* get_input () { return target->get_input(); }
55 
56  protected:
57 
59  uint64_t next_start_sample = 0;
60 
62  HasInput<TimeSeries>* target = nullptr;
63 
66 
68  void resize_buffer ();
69 
72 
73  };
74 
75 }
76 
77 #endif // !defined(__InputBuffering_h)
const In * get_input() const
Return pointer to the container from which input data will be read.
Definition: HasInput.h:41
Reference::To< TimeSeries > buffer
The buffer.
Definition: InputBuffering.h:70
InputBuffering(HasInput< TimeSeries > *target=0)
Default constructor.
Definition: InputBuffering.C:13
void pre_transformation()
Perform all buffering tasks required before transformation.
Definition: InputBuffering.C:119
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void post_transformation()
Perform all buffering tasks required after transformation.
Definition: InputBuffering.C:164
uint64_t bytes_storage() const override
Get the number of bytes of storage required by this buffer.
Definition: InputBuffering.C:57
void set_target(HasInput< TimeSeries > *input)
Set the target with input TimeSeries to be buffered.
Definition: InputBuffering.C:23
HasInput< TimeSeries > * target
The target with input TimeSeries to be buffered.
Definition: InputBuffering.h:67
virtual const TimeSeries * get_input()
Get the TimeSeries to be buffered.
Definition: InputBuffering.h:59
int64_t get_input_sample() const
Return the sample offset from the start of the data source.
Definition: TimeSeries.h:144
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
void resize_buffer()
Resize and configure.
Definition: InputBuffering.C:35
uint64_t next_start_sample
The next start sample.
Definition: InputBuffering.h:64
void set_next_start(uint64_t next_start_sample)
Set the first sample to be used from the input next time.
Definition: InputBuffering.C:67
Remembers how much has been reserved and increases it if necessary.
Definition: Reserve.h:25
Reference::To< Reserve > reserve
The reserve manager.
Definition: InputBuffering.h:76
int64_t get_next_contiguous() const
Get the next contiguous sample following the current buffer.
Definition: InputBuffering.C:169
void set_maximum_samples(uint64_t samples)
Set the maximum number of samples to be buffered.
Definition: InputBuffering.C:29

Generated using doxygen 1.8.17