2011-10-01 18:45:20 +00:00
|
|
|
/*!
|
|
|
|
* \file gnss_block_interface.h
|
|
|
|
* \brief This interface represents a GNSS block.
|
|
|
|
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
|
|
|
*
|
|
|
|
* Abstract class for GNSS block interfaces. Since all its methods are virtual,
|
|
|
|
* this class cannot be instantiated directly, and a subclass can only be
|
|
|
|
* instantiated directly if all inherited pure virtual methods have been
|
|
|
|
* implemented by that class or a parent class.
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2011-10-01 18:45:20 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2011-10-01 18:45:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_GNSS_BLOCK_INTERFACE_H
|
|
|
|
#define GNSS_SDR_GNSS_BLOCK_INTERFACE_H
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <gnuradio/top_block.h>
|
2015-02-27 12:11:06 +00:00
|
|
|
#include <cassert>
|
2014-01-12 20:07:38 +00:00
|
|
|
#include <string>
|
2020-11-03 19:51:57 +00:00
|
|
|
#include <utility> // for std::forward
|
2018-02-26 02:15:53 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Core
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup GNSS_Block_Interfaces
|
|
|
|
* \{ */
|
|
|
|
|
2020-11-06 09:41:20 +00:00
|
|
|
// clang-format off
|
2020-11-03 19:51:57 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
#include <memory>
|
|
|
|
template <typename T>
|
|
|
|
using gnss_shared_ptr = std::shared_ptr<T>;
|
|
|
|
template <typename C, typename... Args>
|
|
|
|
gnss_shared_ptr<C> gnss_make_shared(Args &&... args)
|
|
|
|
{
|
|
|
|
return std::make_shared<C>(std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#include <boost/make_shared.hpp>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
template <typename T>
|
|
|
|
using gnss_shared_ptr = boost::shared_ptr<T>;
|
|
|
|
template <typename C, typename... Args>
|
|
|
|
gnss_shared_ptr<C> gnss_make_shared(Args &&... args)
|
|
|
|
{
|
|
|
|
return boost::make_shared<C>(std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
#endif
|
2020-11-06 09:41:20 +00:00
|
|
|
// clang-format on
|
|
|
|
|
2020-11-03 19:51:57 +00:00
|
|
|
|
2011-10-01 18:45:20 +00:00
|
|
|
/*!
|
|
|
|
* \brief This abstract class represents an interface to GNSS blocks.
|
|
|
|
*
|
|
|
|
* Abstract class for GNSS block interfaces. Since all its methods are virtual,
|
|
|
|
* this class cannot be instantiated directly, and a subclass can only be
|
|
|
|
* instantiated directly if all inherited pure virtual methods have been
|
|
|
|
* implemented by that class or a parent class.
|
|
|
|
*/
|
|
|
|
class GNSSBlockInterface
|
|
|
|
{
|
|
|
|
public:
|
2018-12-03 10:12:10 +00:00
|
|
|
virtual ~GNSSBlockInterface() = default;
|
2016-02-02 21:03:10 +00:00
|
|
|
virtual std::string role() = 0;
|
|
|
|
virtual std::string implementation() = 0;
|
|
|
|
virtual size_t item_size() = 0;
|
|
|
|
virtual void connect(gr::top_block_sptr top_block) = 0;
|
|
|
|
virtual void disconnect(gr::top_block_sptr top_block) = 0;
|
2015-02-18 17:46:00 +00:00
|
|
|
|
2016-02-02 21:03:10 +00:00
|
|
|
virtual gr::basic_block_sptr get_left_block() = 0;
|
|
|
|
virtual gr::basic_block_sptr get_right_block() = 0;
|
2015-02-27 09:36:09 +00:00
|
|
|
|
2016-02-02 21:03:10 +00:00
|
|
|
virtual gr::basic_block_sptr get_left_block(int RF_channel)
|
|
|
|
{
|
|
|
|
assert(RF_channel >= 0);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (RF_channel == 0)
|
|
|
|
{
|
|
|
|
}; // avoid unused param warning
|
|
|
|
return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0;
|
2016-02-02 21:03:10 +00:00
|
|
|
}
|
|
|
|
virtual gr::basic_block_sptr get_right_block(int RF_channel)
|
|
|
|
{
|
|
|
|
assert(RF_channel >= 0);
|
2018-03-03 01:03:39 +00:00
|
|
|
if (RF_channel == 0)
|
|
|
|
{
|
|
|
|
}; // avoid unused param warning
|
|
|
|
return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0;
|
2016-02-02 21:03:10 +00:00
|
|
|
}
|
2020-09-09 08:34:23 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Start the flow of samples if needed.
|
|
|
|
*/
|
|
|
|
virtual void start(){};
|
2011-10-01 18:45:20 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_GNSS_BLOCK_INTERFACE_H
|