Skyward boardcore
Loading...
Searching...
No Matches
RegistryBackend.h
Go to the documentation of this file.
1/* Copyright (c) 2024 Skyward Experimental Rocketry
2 * Authors: Nicolò Caruso, Davide Mor
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25#include <vector>
26
27#include "RegistryTypes.h"
28
29namespace Boardcore
30{
31
37{
38public:
45 virtual bool start() = 0;
46
56 virtual bool load(std::vector<uint8_t>& buf) = 0;
57
65 virtual bool save(std::vector<uint8_t>& buf) = 0;
66};
67
71class DummyBackend final : public RegistryBackend
72{
73public:
74 bool start() override { return true; }
75
76 bool load(std::vector<uint8_t>& buf) override { return true; }
77
78 bool save(std::vector<uint8_t>& buf) override { return true; }
79};
80
81} // namespace Boardcore
Dummy no-op backend.
bool save(std::vector< uint8_t > &buf) override
Saves the data in the buf to the storage/memory.
bool load(std::vector< uint8_t > &buf) override
Loads into the buffer the saved configuration from the storage/memory.
bool start() override
Starts the backend, eventually used in backends that need to start classes and other things e....
Registry Backend class used to save and load data to the designated storage/memory.
virtual bool load(std::vector< uint8_t > &buf)=0
Loads into the buffer the saved configuration from the storage/memory.
virtual bool save(std::vector< uint8_t > &buf)=0
Saves the data in the buf to the storage/memory.
virtual bool start()=0
Starts the backend, eventually used in backends that need to start classes and other things e....
This file includes all the types the logdecoder script will decode.