Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
UdpStream.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SKA_CHEETAH_RCPT_LOW_UDPSTREAM_H
25 #define SKA_CHEETAH_RCPT_LOW_UDPSTREAM_H
26 
27 #include "cheetah/rcpt_low/Config.h"
28 #include "cheetah/rcpt_low/BeamFormerDataTraits.h"
29 #include "cheetah/utils/ModifiedJulianClock.h"
30 #include <panda/PacketStream.h>
31 #include <panda/ResourceManager.h>
32 #include <boost/units/systems/si/time.hpp>
33 
34 namespace ska {
35 namespace cheetah {
36 namespace rcpt_low {
37 
48 template<typename Producer>
49 class UdpStreamTmpl : public panda::PacketStream<UdpStreamTmpl<Producer>, panda::ConnectionTraits<panda::Udp>, BeamFormerDataTraitsLow, Producer>
50 {
51  typedef panda::ConnectionTraits<panda::Udp> ConnectionTraits;
52  typedef panda::PacketStream<UdpStreamTmpl<Producer>, ConnectionTraits, BeamFormerDataTraitsLow, Producer> BaseT;
54 
55  public:
56  typedef boost::units::quantity<ska::cheetah::data::MegaHertz, double> FrequencyType;
57  typedef boost::units::quantity<ska::cheetah::data::Seconds, double> TsampType;
58  typedef typename ska::cheetah::data::TimeFrequency<Cpu, uint8_t>::TimeType TimeType;
59 
60  public:
61  UdpStreamTmpl(Config const& config);
62  ~UdpStreamTmpl();
63 
67  void init();
68 
69  // initialise the chunk (size etc.)
70  template<typename DataType>
71  std::shared_ptr<DataType> get_chunk(unsigned sequence_number, PacketInspector const& p);
72 
73  private:
74  data::DimensionSize<data::Frequency> _n_channels;
75  data::DimensionSize<data::Time> _n_samples;
76  unsigned _n_time_samples_per_packet;
77  unsigned _n_channels_per_packet;
78  TsampType _tsamp;
79  static ska::cheetah::utils::ModifiedJulianClock::time_point _tstart;
80 };
81 
82 class UdpStream : public UdpStreamTmpl<UdpStream>
83 {
84  public:
85  UdpStream(Config const& config);
86  ~UdpStream();
87 
88 };
89 
90 } // namespace rcpt_low
91 } // namespace cheetah
92 } // namespace ska
93 #include "cheetah/rcpt_low/detail/UdpStream.cpp"
94 
95 #endif // SKA_CHEETAH_RCPT_LOW_UDPSTREAM_H
configurable parameters for the rcpt
Definition: Config.h:42
Some limits and constants for FLDO.
Definition: Brdz.h:35
Traits describing the BeamFormer Data Stream to the panda::PacketSream system.
The UDP stream from the BeamFormer.
Definition: UdpStream.h:49
void init()
post construction initialisation (called by Producer)
Definition: UdpStream.cpp:50
BeamFormerPacket inspection and data extraction.