28 : backend{
std::move(backend)}
30 serializationVector.reserve(1024);
31 configuration.reserve(
32 1024 /
sizeof(std::pair<ConfigurationId, EntryStructsUnion>));
37 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
38 if (!backend->start())
46 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
52 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
58 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
59 for (
auto& it : configuration)
60 predicate(it.first, it.second);
65 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
69 if (!backend->load(serializationVector))
73 return serializer.deserializeConfiguration(configuration);
79 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
80 auto iterator = configuration.find(configurationIndex);
81 return !(iterator == configuration.end());
86 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
87 return configuration.empty();
92 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
98 RegistryError error = serializer.serializeConfiguration(configuration);
102 if (!backend->save(serializationVector))
110 const std::lock_guard<std::recursive_mutex> lock(mutexForRegistry);
111 configuration.clear();
RegistryFrontend(std::unique_ptr< RegistryBackend > backend=std::make_unique< DummyBackend >())
Registry front end constructor. Initializes the configuration of the underlying objects and reserves ...
std::function< void(ConfigurationId, EntryStructsUnion &)> EntryFunc
void forEach(const EntryFunc &predicate)
Executes immediately the predicate for each to the configuration applying the callback with the id an...
void disarm()
Enable set methods and memory allocations.
bool isEntryConfigured(const ConfigurationId configurationIndex)
Verify if there is an existing entry given its enum entry.
RegistryError start()
Start function to start frontend and other objects, such as ActiveObjects, needed to write to backend...
RegistryError load()
Loads from the backend the configuration.
void clear()
Clear the configuration actually saved, resetting to empty configuration.
RegistryError save()
Saves the configuration to the backend.
void arm()
Disables the memory registry set and allocations. To be use when the rocket itself is armed and durin...
bool isEmpty()
Verify that the configuration is empty or exists some setted entries.
Serialization and de-serialization class for the registry. It does serialize and deserialize the conf...
This file includes all the types the logdecoder script will decode.
RegistryError
RegistryError enumeration as return type.
@ ARMED
The registry is armed, the operation is not allowed.