1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-09-20 19:29:48 +00:00
gnss-sdr/src/algorithms/signal_source/adapters/gen_signal_source.h
Carles Fernandez 81af1a531b
Redesign of pointer management
Avoid indirection caused by passing shared_ptr by reference

The block factory does not have responsability on the lifetime of their inputs

Define std::make_unique when using C++11 and make use of it

Printers are turned into unique_ptr to express ownership

Printers do not participate on the lifelime of the data, so they take const raw pointers

Modernize tests code
2020-06-18 11:49:28 +02:00

66 lines
2.0 KiB
C++

/*!
* \file gen_signal_source.h
* \brief It wraps blocks that generates synthesized GNSS signal and filters
* it.
* \author Marc Molina, 2013. marc.molina.pena@gmail.com
*
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GEN_SIGNAL_SOURCE_H
#define GNSS_SDR_GEN_SIGNAL_SOURCE_H
#include "concurrent_queue.h"
#include "gnss_block_interface.h"
#include <pmt/pmt.h>
#include <memory>
#include <string>
/*!
* \brief This class wraps blocks that generates synthesized GNSS signal and
* filters the signal.
*/
class GenSignalSource : public GNSSBlockInterface
{
public:
//! Constructor
GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator, std::shared_ptr<GNSSBlockInterface> filter,
std::string role, Concurrent_Queue<pmt::pmt_t> *queue);
//! Virtual destructor
virtual ~GenSignalSource() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
inline std::string role() override { return role_; }
//! Returns "Signal Source"
inline std::string implementation() override { return "Signal Source"; }
inline size_t item_size() override { return 0; }
inline std::shared_ptr<GNSSBlockInterface> signal_generator() const { return signal_generator_; }
private:
std::shared_ptr<GNSSBlockInterface> signal_generator_;
std::shared_ptr<GNSSBlockInterface> filter_;
std::string role_;
std::string implementation_;
bool connected_;
};
#endif // GNSS_SDR_GEN_SIGNAL_SOURCE_H