applied formatting
Some checks failed
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
2022-01-17 15:58:27 +01:00
parent 975b3cd294
commit 77c45c0de9
206 changed files with 28883 additions and 30263 deletions

View File

@ -1,50 +1,44 @@
#include "NVMParameterBase.h"
#include "fsfw/memory/HasFileSystemIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include <fstream>
NVMParameterBase::NVMParameterBase(std::string fullName): fullName(fullName) {
}
#include "fsfw/memory/HasFileSystemIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
NVMParameterBase::NVMParameterBase(std::string fullName) : fullName(fullName) {}
ReturnValue_t NVMParameterBase::readJsonFile() {
if(std::filesystem::exists(fullName)) {
// Read JSON file content into object
std::ifstream i(fullName);
i >> json;
return HasReturnvaluesIF::RETURN_OK;
}
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
if (std::filesystem::exists(fullName)) {
// Read JSON file content into object
std::ifstream i(fullName);
i >> json;
return HasReturnvaluesIF::RETURN_OK;
}
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
}
ReturnValue_t NVMParameterBase::writeJsonFile() {
std::ofstream o(fullName);
o << std::setw(4) << json;
return HasReturnvaluesIF::RETURN_OK;
std::ofstream o(fullName);
o << std::setw(4) << json;
return HasReturnvaluesIF::RETURN_OK;
}
void NVMParameterBase::setFullName(std::string fullName) {
this->fullName = fullName;
}
void NVMParameterBase::setFullName(std::string fullName) { this->fullName = fullName; }
std::string NVMParameterBase::getFullName() const {
return fullName;
}
std::string NVMParameterBase::getFullName() const { return fullName; }
bool NVMParameterBase::getJsonFileExists() {
return std::filesystem::exists(fullName);
}
bool NVMParameterBase::getJsonFileExists() { return std::filesystem::exists(fullName); }
void NVMParameterBase::printKeys() const {
sif::info << "Printing keys for JSON file " << fullName << std::endl;
for(const auto& key: keys) {
sif::info << key << std::endl;
}
sif::info << "Printing keys for JSON file " << fullName << std::endl;
for (const auto& key : keys) {
sif::info << key << std::endl;
}
}
void NVMParameterBase::print() const {
sif::info << "Printing JSON file " << fullName << std::endl;
for(const auto& key: keys) {
sif::info << key << ": " << json[key] << std::endl;
}
sif::info << "Printing JSON file " << fullName << std::endl;
for (const auto& key : keys) {
sif::info << key << ": " << json[key] << std::endl;
}
}