Arduino Mavlink
Loading...
Searching...
No Matches
ParameterMapStore.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 pschatzmann
3
4#pragma once
5#include <stdint.h>
6#include <map>
8
9namespace mavlink_controller {
10
11/**
12 * @class ParameterMapStore
13 * @brief Parameter storage using std::map for dynamic parameter IDs.
14 *
15 * This implementation allows storing and retrieving parameter values
16 * using a map, so you are not limited to a fixed set or range of IDs.
17 */
19 public:
20 ParameterMapStore() = default;
21 ~ParameterMapStore() = default;
22
23 float getValue(uint16_t id) const {
24 //MAV_DEBUG("ParameterMapStore::getValue(%d)", id);
25 auto it = values.find(id);
26 return (it != values.end()) ? it->second : 0.0f;
27 }
28
29 void setValue(uint16_t id, float value) {
30 MAV_DEBUG("ParameterMapStore::setValue(%d,%f)", id, value);
31 values[id] = value;
32 }
33
34 private:
35 std::map<uint16_t, float> values;
36};
37
38} // namespace mavlink_controller
#define MAV_DEBUG(...)
Definition: MavlinkLogger.h:124