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