Skip to content
Snippets Groups Projects
Commit 11c4978a authored by Timon Heim's avatar Timon Heim
Browse files

Move repetetive code to helper class

parent 3a73fe05
No related branches found
No related tags found
No related merge requests found
#include "ScanHelper.h"
#include <iostream>
#include <fstream>
#include <exception>
namespace ScanHelper {
json openJsonFile(std::string filepath) {
std::ifstream file(filepath);
if (!file) {
throw std::runtime_error("could not open file");
}
json j;
try {
j = json::parse(file);
} catch (json::parse_error &e) {
throw std::runtime_error(e.what());
}
return j;
}
}
#ifndef SCANHELPER_H
#define SCANHELPER_H
// #################################
// # Author: Timon Heim
// # Email: timon.heim at cern.ch
// # Project: Yarr
// # Description: Class managing scans
// # Comment: Old scanConsole in a class
// ################################
#include <string>
#include "json.hpp"
using json=nlohmann::basic_json<std::map, std::vector, std::string, bool, std::int32_t, std::uint32_t, float>;
namespace ScanHelper {
json openJsonFile(std::string filepath);
void loadController(json &j);
void loadConnectivity(json &j);
}
#endif
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment