Source.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/Source.h
10 
11 #ifndef __dsp_Kernel_Classes_Source_h
12 #define __dsp_Kernel_Classes_Source_h
13 
14 #include "dsp/Operation.h"
15 #include "dsp/TimeSeries.h"
16 
17 class ThreadContext;
18 
19 namespace dsp {
20 
22  class Source : public Operation
23  {
24 
25  public:
26 
28  Source (const char* name) : Operation(name) {}
29 
31  virtual ~Source () {}
32 
34  virtual Source* clone() const = 0;
35 
37  Operation::Function get_function () const override { return Operation::Producer; }
38 
40  virtual const Observation* get_info() const = 0;
41 
43  virtual Observation* get_info() = 0;
44 
46  virtual void set_output (TimeSeries* data) = 0;
47 
49  virtual TimeSeries* get_output () = 0;
50 
52  virtual bool has_output () const = 0;
53 
55  virtual uint64_t get_total_samples () const = 0;
56 
58  virtual uint64_t get_current_sample () const = 0;
59 
61  virtual double get_current_time () const = 0;
62 
64 
65  virtual void seek_time (double second) = 0;
66 
68 
69  virtual void set_total_time (double second) = 0;
70 
72  virtual bool end_of_data () const = 0;
73 
75  virtual void restart () = 0;
76 
78  virtual void set_block_size (uint64_t) = 0;
79 
81 
82  virtual uint64_t get_block_size () const = 0;
83 
85  virtual void set_overlap (uint64_t) = 0;
86 
88  virtual uint64_t get_overlap () const = 0;
89 
91  virtual bool get_order_supported (TimeSeries::Order) const = 0;
92 
94  virtual void set_output_order (TimeSeries::Order) = 0;
95 
97  virtual bool get_device_supported (Memory*) const = 0;
98 
100  virtual void set_device (Memory*) = 0;
101 
103  virtual void share (Source*) = 0;
104 
106  virtual void set_context (ThreadContext* context) = 0;
107  };
108 
109 }
110 
111 #endif // !defined(__dsp_Kernel_Classes_Source_h)
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
virtual void share(Source *)=0
Share any resources that can/should be shared between threads.
Order
Order of the dimensions.
Definition: TimeSeries.h:39
virtual ~Source()
Destructor.
Definition: Source.h:31
virtual uint64_t get_total_samples() const =0
Get the total number of time samples available (return 0 if unknown)
virtual const Observation * get_info() const =0
Get the const Observation attributes that describe the source.
virtual uint64_t get_overlap() const =0
Set the number of time samples by which segments of output TimeSeries data overlap.
std::string name
Operation name.
Definition: Operation.h:153
Source(const char *name)
Constructor.
Definition: Source.h:28
Defines the interface by which operations are performed on data.
Definition: Operation.h:37
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
virtual bool get_device_supported(Memory *) const =0
Return true if the source can operate on the specified device.
virtual void set_output(TimeSeries *data)=0
Set the TimeSeries object used to store output data.
virtual TimeSeries * get_output()=0
Get the TimeSeries object used to store output data.
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
Operation::Function get_function() const override
Each Source object is classified as a Producer Operation.
Definition: Source.h:37
virtual bool end_of_data() const =0
Return true when the end of data has been reached.
virtual void seek_time(double second)=0
Seek to the specified time in seconds.
virtual void restart()=0
Return to the start of data, if possible.
virtual uint64_t get_block_size() const =0
Get the number of time samples per segment output by the source.
virtual void set_output_order(TimeSeries::Order)=0
Set the order of the dimensions in the output TimeSeries.
virtual void set_block_size(uint64_t)=0
Set the desired number of time samples per segment output by the source.
virtual void set_overlap(uint64_t)=0
Set the number of time samples by which segments of output TimeSeries data overlap.
virtual void set_context(ThreadContext *context)=0
Set the mutual exclusion and condition used to protect shared resources.
virtual void set_total_time(double second)=0
Truncate the time series at the specified second.
virtual double get_current_time() const =0
Get the current time offset from the start of data in seconds.
virtual void set_device(Memory *)=0
Set the device on which the source will operate.
virtual bool get_order_supported(TimeSeries::Order) const =0
Return true if the source supports the specified output order.
Abstract interface to sources of TimeSeries data.
Definition: Source.h:22
Pure virtual base class of objects that manage memory allocation and destruction.
Definition: Memory.h:23
Function
The function of the operator.
Definition: Operation.h:113
virtual uint64_t get_current_sample() const =0
Get the current time sample offset from the start of data.
virtual Source * clone() const =0
Return a default constructed clone of self.
virtual bool has_output() const =0
Return true if this object has a TimeSeries object to store output data.

Generated using doxygen 1.8.17