GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
has_simple_printer.h
Go to the documentation of this file.
1 /*!
2  * \file has_simple_printer.h
3  * \brief Interface of a class that prints HAS messages content in a txt file.
4  * \author Carles Fernandez-Prades, 2021. 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-2021 (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_HAS_SIMPLE_PRINTER_H
18 #define GNSS_SDR_HAS_SIMPLE_PRINTER_H
19 
20 #include <cstddef> // for size_t
21 #include <fstream> // for std::ofstream
22 #include <mutex> // for std::mutex
23 #include <string> // for std::string
24 #include <vector> // for std::vector
25 
26 /** \addtogroup PVT
27  * \{ */
28 /** \addtogroup PVT_libs
29  * \{ */
30 
31 class Galileo_HAS_data;
32 
33 /*!
34  * \brief Prints HAS messages content in a txt file. See HAS-SIS-ICD for a
35  * message description.
36  */
38 {
39 public:
40  explicit Has_Simple_Printer(const std::string& base_path = std::string("."), const std::string& filename = std::string("HAS_Messages"), bool time_tag_name = true);
42  bool print_message(const Galileo_HAS_data* const has_data);
43 
44 private:
45  template <class T>
46  std::string print_vector(const std::vector<T>& vec, float scale_factor = 1) const;
47 
48  template <class T>
49  std::string print_vector_binary(const std::vector<T>& vec, size_t bit_length) const;
50 
51  template <class T>
52  std::string print_matrix(const std::vector<std::vector<T>>& mat, const std::string& filler, float scale_factor = 1) const;
53 
54  std::string print_vector_string(const std::vector<std::string>& vec) const;
55 
56  bool close_file();
57 
58  std::mutex d_mutex;
59  std::ofstream d_has_file;
60  std::string d_has_filename;
61  std::string d_has_base_path;
62  bool d_data_printed;
63 };
64 
65 /** \} */
66 /** \} */
67 #endif // GNSS_SDR_HAS_SIMPLE_PRINTER_H
Prints HAS messages content in a txt file. See HAS-SIS-ICD for a message description.
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...