ParallelUnpacker.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2023 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/ParallelUnpacker.h
10 
11 #ifndef __ParallelUnpacker_h
12 #define __ParallelUnpacker_h
13 
14 #include "dsp/ParallelBitSeries.h"
15 #include "dsp/Unpacker.h"
16 #include "Registry.h"
17 
18 namespace dsp {
19 
20  class ParallelInput;
21 
23  class ParallelUnpacker : public Transformation <ParallelBitSeries, TimeSeries>
24  {
25 
26  public:
27 
29  ParallelUnpacker (const char* name);
30 
32  static ParallelUnpacker* create (const Observation* observation);
33 
35  ParallelUnpacker* clone() const;
36 
39 
42 
44  bool get_device_supported (Memory*) const;
45 
47  void set_device (Memory*);
48 
50 
51  virtual bool matches (const Observation* observation) const = 0;
52 
54  virtual void match (const Observation* observation) = 0;
55 
57  virtual void match_resolution (ParallelInput*) { /* do nothing */ }
58 
60  virtual unsigned get_resolution () const { return 0; }
61 
63  void prepare () override;
64 
66  void reserve () override;
67 
69  uint64_t bytes_storage() const override;
70 
72  uint64_t bytes_scratch () const override;
73 
75  void set_buffering_policy (BufferingPolicy* policy);
76 
78  void set_cerr (std::ostream& os) const;
79 
82 
84  static Register& get_register();
85 
86  protected:
87 
90 
92 
93  virtual void unpack () = 0;
94 
96  void transformation ();
97 
99  std::vector< Reference::To<Unpacker> > unpackers;
100 
101  };
102 
103 }
104 
105 #endif // !defined(__ParallelUnpacker_h)
106 
static ParallelUnpacker * create(const Observation *observation)
Return a pointer to a new instance of the appropriate sub-class.
Definition: ParallelUnpacker.C:153
std::vector< Reference::To< Unpacker > > unpackers
The parallel Unpackers.
Definition: ParallelUnpacker.h:104
void set_device(Memory *)
Set the device on which the unpacker will operate.
Definition: ParallelUnpacker.C:99
void set_output_order(TimeSeries::Order)
Set the order of the dimensions in the output TimeSeries.
Definition: ParallelUnpacker.C:85
TimeSeries::Order output_order
The order of the dimensions in the output TimeSeries.
Definition: ParallelUnpacker.h:94
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void prepare() override
Copy the input attributes to the output.
Definition: ParallelUnpacker.C:29
Defines the interface by which Transformations are performed on data.
Definition: Transformation.h:54
Order
Order of the dimensions.
Definition: TimeSeries.h:39
void reserve() override
Reserve the maximum amount of space required in the output.
Definition: ParallelUnpacker.C:43
void transformation()
The operation unpacks parallel BitSeries into floating point TimeSeries.
Definition: ParallelUnpacker.C:106
Defines the interface by which Transformation data are buffered.
Definition: BufferingPolicy.h:29
std::string name
Operation name.
Definition: Operation.h:153
virtual void unpack()=0
The unpacking routine.
Parent * create(unsigned i) const
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
virtual void match_resolution(ParallelInput *)
Match the unpacker to the resolution of the Input.
Definition: ParallelUnpacker.h:62
ParallelUnpacker * clone() const
Clone operator.
Definition: ParallelUnpacker.C:22
virtual unsigned get_resolution() const
Return the smallest number of time samples that can be unpacked.
Definition: ParallelUnpacker.h:65
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
unsigned size() const
Manages memory allocation and destruction on the host machine.
Definition: MemoryHost.h:22
Registry::List< ParallelUnpacker > Register
typedef used to simplify template syntax in ParallelUnpacker_registry.C
Definition: ParallelUnpacker.h:86
uint64_t bytes_storage() const override
The number of bytes of additional storage used by the operation.
Definition: ParallelUnpacker.C:59
Manages an array of Unpacker objects to be process in parallel.
Definition: ParallelUnpacker.h:28
virtual void match(const Observation *observation)=0
Specialize the unpackers for the Observation.
static Register & get_register()
Return the list of registered sub-classes.
Definition: ParallelUnpacker_registry.C:38
uint64_t bytes_scratch() const override
The number of bytes of scratch space used by the operation.
Definition: ParallelUnpacker.C:68
bool get_order_supported(TimeSeries::Order) const
Return true if the unpackers support the specified output order.
Definition: ParallelUnpacker.C:78
bool get_device_supported(Memory *) const
Return true if the unpackers can operate on the specified device.
Definition: ParallelUnpacker.C:93
void set_buffering_policy(BufferingPolicy *policy)
Set the policy for buffering input and/or output data.
Definition: ParallelUnpacker.C:140
void set_cerr(std::ostream &os) const
Set verbosity ostream.
Definition: ParallelUnpacker.C:146
virtual bool matches(const Observation *observation) const =0
Return true if the derived class can convert the Observation.
Manages an array of BitSeries to be process in parallel.
Definition: ParallelBitSeries.h:24
Pure virtual base class of objects that manage memory allocation and destruction.
Definition: Memory.h:23
std::string get_machine() const
Return the instrument used to record signal.
Definition: Observation.h:194
@ OrderFPT
Frequency, Polarization, Time (default before 3 October 2008)
Definition: TimeSeries.h:47
ParallelUnpacker(const char *name)
Constructor.
Definition: ParallelUnpacker.C:16

Generated using doxygen 1.8.17