Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F10704299
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/apps/ccam/configuration.h b/apps/ccam/configuration.h
index 7c5e22b..c8a5722 100644
--- a/apps/ccam/configuration.h
+++ b/apps/ccam/configuration.h
@@ -1,87 +1,75 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include "rosa/config/version.h"
#include "rosa/deluxe/DeluxeContext.hpp"
#include "json.hpp"
#include <fstream>
using namespace rosa;
using nlohmann::json;
struct SignalConfiguration {
std::string Name;
bool Output;
float InnerBound;
float OuterBound;
float InnerBoundDrift;
float OuterBoundDrift;
+ uint32_t Length;
};
struct AppConfiguration {
std::string InputFilePath;
std::string OutputFilePath;
uint32_t BrokenCounter;
- uint32_t Length;
std::vector<SignalConfiguration> SignalConfigurations;
};
-/*
-void to_json(json& J, const AppConfiguration& AC) {
- //This direction is not needed
- (void)J;
- (void)AC;
-}
-
-void to_json(json& J, const SignalConfiguration& SC) {
- //This direction is not needed
- (void)J;
- (void)SC;
-}
-
-void from_json(json& J, const AppConfiguration& AC) {
- J.at("InputFilePath").get_to(AC.InputFilePath);
- J.at("OutputFilePath").get_to(AC.OutputFilePath);
- J.at("BrokenCounter").get_to(AC.BrokenCounter);
- J.at("Length").get_to(AC.Length);
- //J.at("SignalConfigurations").get_to(AC.SignalConfigurations);
-}
-void from_json(json& J, const SignalConfiguration& SC) {
+void from_json(const json& J, SignalConfiguration& SC) {
J.at("Name").get_to(SC.Name);
J.at("Output").get_to(SC.Output);
J.at("InnerBound").get_to(SC.InnerBound);
J.at("OuterBound").get_to(SC.OuterBound);
J.at("InnerBoundDrift").get_to(SC.InnerBoundDrift);
J.at("OuterBoundDrift").get_to(SC.OuterBoundDrift);
+ J.at("Length").get_to(SC.Length);
+}
+
+void from_json(const json& J, AppConfiguration& AC) {
+ J.at("InputFilePath").get_to(AC.InputFilePath);
+ J.at("OutputFilePath").get_to(AC.OutputFilePath);
+ J.at("BrokenCounter").get_to(AC.BrokenCounter);
+ J.at("SignalConfigurations").get_to(AC.SignalConfigurations);
}
-*/
-AppConfiguration AppConfig = {"in.csv", "out.csv", 10, 10, {{"sig1", false, 0.1, 0.25, 0.4, 0.6},{"sig2", false, 0.1, 0.25, 0.4, 0.6},{"sig3", true, 0.1, 0.25, 0.4, 0.6}}};
+
+AppConfiguration AppConfig = {"in.csv", "out.csv", 10, {{"sig1", false, 0.1, 0.25, 0.4, 0.6, 10},{"sig2", false, 0.1, 0.25, 0.4, 0.6, 10},{"sig3", true, 0.1, 0.25, 0.4, 0.6, 10}}};
bool readConfigFile(std::string ConfigPath) {
LOG_INFO("READING CONFIG FILE");
LOG_INFO_STREAM << "Looking for config file at \"" << ConfigPath << "\"\n";
std::ifstream ConfigFile;
ConfigFile.open(ConfigPath);
if (!ConfigFile) {
LOG_ERROR("Unable to open config file");
return false;
}
json ConfigObj;
ConfigFile >> ConfigObj;
- std::cout << ConfigObj << std::endl;
+ LOG_INFO_STREAM << "Read JSON file as \"" << ConfigObj << "\"\n";
try {
- //ConfigObj.get_to(AppConfig);
+ ConfigObj.get_to(AppConfig);
} catch (nlohmann::detail::type_error ex) {
LOG_ERROR("Misformatted Config File");
return false;
}
return true;
}
#endif // CONFIGURATION_H
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, May 31, 4:31 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
330936
Default Alt Text
(3 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment