Loading data-access/engine/src/common/include/cutout.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ struct coordinates std::vector<std::string> pol; // polarization states FIXME pol should be Set<enums> }; coordinates parse_coordinates(const std::string region_string); coordinates to_coordinates(const position pos, const band bnd, const time_axis time, const std::vector<std::string> pol); Loading data-access/engine/src/common/src/cutout.cpp +14 −0 Original line number Diff line number Diff line #include "json_region.hpp" #include "cutout.hpp" #include "fitsfiles.hpp" #include "fits_header.hpp" Loading Loading @@ -200,6 +201,19 @@ string to_cfitsio_format_with_axis_type(vector<uint_bounds> bounds) } coordinates parse_coordinates(const string region_string) { LOG_trace(string(__func__) + " : " + region_string); json_region reg(region_string); coordinates coord = to_coordinates(reg.get_pos(), reg.get_band(), reg.get_time(), reg.get_pol()); LOG_STREAM << "coord parsed: " << coord << endl; return coord; } coordinates to_coordinates(const position pos, const band bnd, const time_axis time, const std::vector<std::string> pol) { coordinates coord; Loading data-access/engine/src/common/src/json_region.hpp 0 → 100644 +68 −0 Original line number Diff line number Diff line #include "cutout.hpp" #include "cutout_nljson.hpp" #include "mcutout.hpp" #include "mcutout_nljson.hpp" #include "json.hpp" #include "io.hpp" #include <string> #include <vector> using json = nlohmann::json; /* All nlohmann-json exception are json::exception <- std::exception. * So let them be caught by std::excpetion as 'Internal errors' in rpc-call's infinite loop, * assuming all API syntactic errors were caught in servlet API parser */ class json_region { public: json_region(std::string request_json) { LOG_trace(__func__); const bool ASSERTS = true; m_jservice = json::parse(request_json, nullptr, ASSERTS); LOG_STREAM << m_jservice.dump() << std::endl; } position get_pos() { return (m_jservice.contains("pos") ? (position) m_jservice.at("pos") : pos_none ); } band get_band() { return (m_jservice.contains("band") ? (band) m_jservice.at("band") : band_none); } time_axis get_time() { return (m_jservice.contains("time") ? (time_axis) m_jservice.at("time") : time_none); } std::vector<std::string> get_pol() { std::vector<std::string> str; if(m_jservice.contains("pol")) { json j = m_jservice.at("pol"); str = j.get<std::vector<std::string>>(); } return str; } private: json m_jservice; }; data-access/engine/src/vlkb/src/ast.cpp +0 −14 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ #include "cutout_ostream.hpp" #include "service_string.hpp" #include "fitsfiles.hpp" // header-string needed #include "json_request.hpp" // uses json for vlkb-overlap region-string #include "io.hpp" #include "my_assert.hpp" Loading Loading @@ -149,19 +148,6 @@ vector<string> split (const string &s, char delim) } coordinates parse_coordinates(const string region_string) { LOG_trace(string(__func__) + " : " + region_string); json_request req(region_string); coordinates coord = to_coordinates(req.get_pos(), req.get_band(), req.get_time(), req.get_pol()); LOG_STREAM << "coord parsed: " << coord << endl; return coord; } int vlkb_overlap(const string& pathname, const string& region, vector<uint_bounds>& bnds) { LOG_trace(__func__); Loading data-access/engine/src/common/src/json_request.cpp→data-access/engine/src/vlkbd/src/json_request.cpp +0 −0 File moved. View file Loading
data-access/engine/src/common/include/cutout.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ struct coordinates std::vector<std::string> pol; // polarization states FIXME pol should be Set<enums> }; coordinates parse_coordinates(const std::string region_string); coordinates to_coordinates(const position pos, const band bnd, const time_axis time, const std::vector<std::string> pol); Loading
data-access/engine/src/common/src/cutout.cpp +14 −0 Original line number Diff line number Diff line #include "json_region.hpp" #include "cutout.hpp" #include "fitsfiles.hpp" #include "fits_header.hpp" Loading Loading @@ -200,6 +201,19 @@ string to_cfitsio_format_with_axis_type(vector<uint_bounds> bounds) } coordinates parse_coordinates(const string region_string) { LOG_trace(string(__func__) + " : " + region_string); json_region reg(region_string); coordinates coord = to_coordinates(reg.get_pos(), reg.get_band(), reg.get_time(), reg.get_pol()); LOG_STREAM << "coord parsed: " << coord << endl; return coord; } coordinates to_coordinates(const position pos, const band bnd, const time_axis time, const std::vector<std::string> pol) { coordinates coord; Loading
data-access/engine/src/common/src/json_region.hpp 0 → 100644 +68 −0 Original line number Diff line number Diff line #include "cutout.hpp" #include "cutout_nljson.hpp" #include "mcutout.hpp" #include "mcutout_nljson.hpp" #include "json.hpp" #include "io.hpp" #include <string> #include <vector> using json = nlohmann::json; /* All nlohmann-json exception are json::exception <- std::exception. * So let them be caught by std::excpetion as 'Internal errors' in rpc-call's infinite loop, * assuming all API syntactic errors were caught in servlet API parser */ class json_region { public: json_region(std::string request_json) { LOG_trace(__func__); const bool ASSERTS = true; m_jservice = json::parse(request_json, nullptr, ASSERTS); LOG_STREAM << m_jservice.dump() << std::endl; } position get_pos() { return (m_jservice.contains("pos") ? (position) m_jservice.at("pos") : pos_none ); } band get_band() { return (m_jservice.contains("band") ? (band) m_jservice.at("band") : band_none); } time_axis get_time() { return (m_jservice.contains("time") ? (time_axis) m_jservice.at("time") : time_none); } std::vector<std::string> get_pol() { std::vector<std::string> str; if(m_jservice.contains("pol")) { json j = m_jservice.at("pol"); str = j.get<std::vector<std::string>>(); } return str; } private: json m_jservice; };
data-access/engine/src/vlkb/src/ast.cpp +0 −14 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ #include "cutout_ostream.hpp" #include "service_string.hpp" #include "fitsfiles.hpp" // header-string needed #include "json_request.hpp" // uses json for vlkb-overlap region-string #include "io.hpp" #include "my_assert.hpp" Loading Loading @@ -149,19 +148,6 @@ vector<string> split (const string &s, char delim) } coordinates parse_coordinates(const string region_string) { LOG_trace(string(__func__) + " : " + region_string); json_request req(region_string); coordinates coord = to_coordinates(req.get_pos(), req.get_band(), req.get_time(), req.get_pol()); LOG_STREAM << "coord parsed: " << coord << endl; return coord; } int vlkb_overlap(const string& pathname, const string& region, vector<uint_bounds>& bnds) { LOG_trace(__func__); Loading
data-access/engine/src/common/src/json_request.cpp→data-access/engine/src/vlkbd/src/json_request.cpp +0 −0 File moved. View file