GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
gnss_sdr_valve.h
Go to the documentation of this file.
1 /*!
2  * \file gnss_sdr_valve.h
3  * \brief Interface of a GNU Radio block that sends a STOP message to the
4  * control queue right after a specific number of samples have passed through it.
5  * \author Javier Arribas, 2018. jarribas(at)cttc.es
6  * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 
20 #ifndef GNSS_SDR_GNSS_SDR_VALVE_H
21 #define GNSS_SDR_GNSS_SDR_VALVE_H
22 
23 #include "concurrent_queue.h"
24 #include "gnss_block_interface.h"
25 #include <gnuradio/sync_block.h> // for sync_block
26 #include <gnuradio/types.h> // for gr_vector_const_void_star
27 #include <pmt/pmt.h>
28 #include <cstddef> // for size_t
29 #include <cstdint>
30 
31 /** \addtogroup Signal_Source
32  * \{ */
33 /** \addtogroup Signal_Source_libs
34  * \{ */
35 
36 
37 class Gnss_Sdr_Valve;
38 
39 gnss_shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
40  size_t sizeof_stream_item,
41  uint64_t nitems,
43 
44 gnss_shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
45  size_t sizeof_stream_item,
46  uint64_t nitems,
48  bool stop_flowgraph);
49 
50 /*!
51  * \brief Implementation of a GNU Radio block that sends a STOP message to the
52  * control queue right after a specific number of samples have passed through it.
53  */
54 class Gnss_Sdr_Valve : public gr::sync_block
55 {
56 public:
57  void open_valve();
58 
59  int work(int noutput_items,
60  gr_vector_const_void_star& input_items,
61  gr_vector_void_star& output_items);
62 
63 private:
64  friend gnss_shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
65  size_t sizeof_stream_item,
66  uint64_t nitems,
68 
69  friend gnss_shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
70  size_t sizeof_stream_item,
71  uint64_t nitems,
73  bool stop_flowgraph);
74 
75  Gnss_Sdr_Valve(size_t sizeof_stream_item,
76  uint64_t nitems,
77  Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph);
78 
79  uint64_t d_nitems;
80  uint64_t d_ncopied_items;
82  bool d_stop_flowgraph;
83  bool d_open_valve;
84 };
85 
86 
87 /** \} */
88 /** \} */
89 #endif // GNSS_SDR_GNSS_SDR_VALVE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
Implementation of a GNU Radio block that sends a STOP message to the control queue right after a spec...