GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
in_memory_configuration.h
Go to the documentation of this file.
1/*!
2 * \file in_memory_configuration.h
3 * \brief A ConfigurationInterface for testing purposes.
4 * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
5 *
6 * This implementation accepts configuration parameters upon instantiation and
7 * it is intended to be used in unit testing.
8 *
9 * -----------------------------------------------------------------------------
10 *
11 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12 * This file is part of GNSS-SDR.
13 *
14 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15 * SPDX-License-Identifier: GPL-3.0-or-later
16 *
17 * -----------------------------------------------------------------------------
18 */
19
20
21#ifndef GNSS_SDR_IN_MEMORY_CONFIGURATION_H
22#define GNSS_SDR_IN_MEMORY_CONFIGURATION_H
23
25#include "string_converter.h"
26#include <cstdint>
27#include <map>
28#include <memory>
29#include <string>
30
31/** \addtogroup Core
32 * \{ */
33/** \addtogroup Core_Receiver
34 * \{ */
35
36
37/*!
38 * \brief This class is an implementation of the interface ConfigurationInterface.
39 *
40 * This implementation accepts configuration parameters upon instantiation and
41 * it is intended to be used in unit testing.
42 */
43class InMemoryConfiguration : public ConfigurationInterface
44{
45public:
46 InMemoryConfiguration();
47 ~InMemoryConfiguration();
48 std::string property(std::string property_name, std::string default_value) const override;
49 bool property(std::string property_name, bool default_value) const override;
50 int64_t property(std::string property_name, int64_t default_value) const override;
51 uint64_t property(std::string property_name, uint64_t default_value) const override;
52 int32_t property(std::string property_name, int32_t default_value) const override;
53 uint32_t property(std::string property_name, uint32_t default_value) const override;
54 int16_t property(std::string property_name, int16_t default_value) const override;
55 uint16_t property(std::string property_name, uint16_t default_value) const override;
56 float property(std::string property_name, float default_value) const override;
57 double property(std::string property_name, double default_value) const override;
58 void set_property(std::string property_name, std::string value) override;
59 void supersede_property(const std::string& property_name, const std::string& value);
60 bool is_present(const std::string& property_name) const override;
61
62private:
63 std::map<std::string, std::string> properties_;
64 std::unique_ptr<StringConverter> converter_;
65};
66
67
68/** \} */
69/** \} */
70#endif // GNSS_SDR_IN_MEMORY_CONFIGURATION_H
This abstract class represents an interface to configuration parameters.
This class represents an interface to configuration parameters.
Interface of a class that interprets the contents of a string and converts it into different types.