GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
gnss_block_interface.h
Go to the documentation of this file.
1/*!
2 * \file gnss_block_interface.h
3 * \brief This interface represents a GNSS block.
4 * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
5 *
6 * Abstract class for GNSS block interfaces. Since all its methods are virtual,
7 * this class cannot be instantiated directly, and a subclass can only be
8 * instantiated directly if all inherited pure virtual methods have been
9 * implemented by that class or a parent class.
10 *
11 * -----------------------------------------------------------------------------
12 *
13 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
14 * This file is part of GNSS-SDR.
15 *
16 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
17 * SPDX-License-Identifier: GPL-3.0-or-later
18 *
19 * -----------------------------------------------------------------------------
20 */
21
22
23#ifndef GNSS_SDR_GNSS_BLOCK_INTERFACE_H
24#define GNSS_SDR_GNSS_BLOCK_INTERFACE_H
25
26#include <gnuradio/top_block.h>
27#include <cassert>
28#include <string>
29#include <utility> // for std::forward
30
31/** \addtogroup Core
32 * \{ */
33/** \addtogroup GNSS_Block_Interfaces
34 * \{ */
35
36// clang-format off
37#if GNURADIO_USES_STD_POINTERS
38#include <memory>
39template <typename T>
40using gnss_shared_ptr = std::shared_ptr<T>;
41template <typename C, typename... Args>
42gnss_shared_ptr<C> gnss_make_shared(Args &&... args)
43{
44 return std::make_shared<C>(std::forward<Args>(args)...);
45}
46#else
47#include <boost/make_shared.hpp>
48#include <boost/shared_ptr.hpp>
49template <typename T>
50using gnss_shared_ptr = boost::shared_ptr<T>;
51template <typename C, typename... Args>
52gnss_shared_ptr<C> gnss_make_shared(Args &&... args)
53{
54 return boost::make_shared<C>(std::forward<Args>(args)...);
55}
56#endif
57// clang-format on
58
59
60/*!
61 * \brief This abstract class represents an interface to GNSS blocks.
62 *
63 * Abstract class for GNSS block interfaces. Since all its methods are virtual,
64 * this class cannot be instantiated directly, and a subclass can only be
65 * instantiated directly if all inherited pure virtual methods have been
66 * implemented by that class or a parent class.
67 */
69{
70public:
71 virtual ~GNSSBlockInterface() = default;
72 virtual std::string role() = 0;
73 virtual std::string implementation() = 0;
74 virtual size_t item_size() = 0;
75 virtual void connect(gr::top_block_sptr top_block) = 0;
76 virtual void disconnect(gr::top_block_sptr top_block) = 0;
77
78 virtual gr::basic_block_sptr get_left_block() = 0;
79 virtual gr::basic_block_sptr get_right_block() = 0;
80
81 virtual gr::basic_block_sptr get_left_block(int RF_channel)
82 {
83 assert(RF_channel >= 0);
84 if (RF_channel == 0)
85 {
86 }; // avoid unused param warning
87 return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0;
88 }
89 virtual gr::basic_block_sptr get_right_block(int RF_channel)
90 {
91 assert(RF_channel >= 0);
92 if (RF_channel == 0)
93 {
94 }; // avoid unused param warning
95 return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0;
96 }
97
98 /*!
99 * \brief Start the flow of samples if needed.
100 */
101 virtual void start() {};
102};
103
104
105/** \} */
106/** \} */
107#endif // GNSS_SDR_GNSS_BLOCK_INTERFACE_H
This abstract class represents an interface to GNSS blocks.
virtual void start()
Start the flow of samples if needed.