GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
byte_to_short.h
Go to the documentation of this file.
1 /*!
2  * \file byte_to_short.h
3  * \brief Adapts an 8-bits sample stream (IF) to a short int stream (IF)
4  * \author Carles Fernandez Prades, cfernandez(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_BYTE_TO_SHORT_H
18 #define GNSS_SDR_BYTE_TO_SHORT_H
19 
20 #include "gnss_block_interface.h"
21 #include <gnuradio/blocks/char_to_short.h>
22 #include <gnuradio/blocks/file_sink.h>
23 #include <cstdint>
24 #include <string>
25 
26 /** \addtogroup Data_Type Data Type Adapters
27  * Classes for data type conversion
28  * \{ */
29 /** \addtogroup Data_type_adapters data_type_adapters
30  * Wrap GNU Radio data tyope adapter blocks with a GNSSBlockInterface
31  * \{ */
32 
33 
35 
36 /*!
37  * \brief Adapts an 8-bits sample stream (IF) to a short int stream (IF)
38  *
39  */
41 {
42 public:
43  ByteToShort(const ConfigurationInterface* configuration,
44  std::string role, unsigned int in_streams,
45  unsigned int out_streams);
46 
47  ~ByteToShort() = default;
48 
49  inline std::string role() override
50  {
51  return role_;
52  }
53 
54  //! Returns "Byte_To_Short"
55  inline std::string implementation() override
56  {
57  return "Byte_To_Short";
58  }
59 
60  inline size_t item_size() override
61  {
62  return sizeof(int8_t);
63  }
64 
65  void connect(gr::top_block_sptr top_block) override;
66  void disconnect(gr::top_block_sptr top_block) override;
67  gr::basic_block_sptr get_left_block() override;
68  gr::basic_block_sptr get_right_block() override;
69 
70 private:
71  gr::blocks::char_to_short::sptr gr_char_to_short_;
72  gr::blocks::file_sink::sptr file_sink_;
73  std::string dump_filename_;
74  std::string input_item_type_;
75  std::string output_item_type_;
76  std::string role_;
77  unsigned int in_streams_;
78  unsigned int out_streams_;
79  bool dump_;
80 };
81 
82 
83 /** \} */
84 /** \} */
85 #endif // GNSS_SDR_BYTE_TO_SHORT_H
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
std::string implementation() override
Returns "Byte_To_Short".
Definition: byte_to_short.h:55
This abstract class represents an interface to GNSS blocks.
Adapts an 8-bits sample stream (IF) to a short int stream (IF)
Definition: byte_to_short.h:40