diff --git a/pgis/lib/include/MetaData/CgNodeMetaData.h b/pgis/lib/include/MetaData/CgNodeMetaData.h index 83c0f0e..b0042f1 100644 --- a/pgis/lib/include/MetaData/CgNodeMetaData.h +++ b/pgis/lib/include/MetaData/CgNodeMetaData.h @@ -151,9 +151,7 @@ class PiraOneData : public metacg::MetaData::Registrar { } nlohmann::json to_json() const final { - nlohmann::json j; - j["numStatements"] = getNumberOfStatements(); - return j; + return getNumberOfStatements(); }; virtual const char *getKey() const final { return key; } @@ -189,10 +187,6 @@ inline void setPiraOneData(T node, int numStmts = 0, bool hasBody = false, bool } } -inline void to_json(nlohmann::json &j, const PiraOneData &data) { - j = nlohmann::json{{"numStatements", data.getNumberOfStatements()}}; -} - /** * This class holds data relevant to the PIRA II anslyses. * Most notably it encapsulates the Extra-P peformance models diff --git a/pgis/test/unit/PIRAPGISMetadataTest.cpp b/pgis/test/unit/PIRAPGISMetadataTest.cpp index e420eb5..bfa12f6 100644 --- a/pgis/test/unit/PIRAPGISMetadataTest.cpp +++ b/pgis/test/unit/PIRAPGISMetadataTest.cpp @@ -46,12 +46,11 @@ TEST(PIRAPGISMetadataTest, PiraOneData) { const auto &j = origMetadata->to_json(); // Compare all exported values - EXPECT_TRUE(j.contains("numStatements")); - EXPECT_EQ(j.at("numStatements"), origMetadata->getNumberOfStatements()); + EXPECT_EQ(j.get(), origMetadata->getNumberOfStatements()); // Import Json Object // Note: due to historical reasons, PiraOne Data is not a json object, but only a single value - const auto &jsonMetadata = new pira::PiraOneData(j.at("numStatements")); + const auto &jsonMetadata = new pira::PiraOneData(j); // Compare all imported values EXPECT_EQ(jsonMetadata->getNumberOfStatements(), origMetadata->getNumberOfStatements());