MCPcopy Create free account
hub / github.com/chigraph/chigraph / toJSON

Method toJSON

libchigraph/src/GraphModule.cpp:275–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }
274
275 nlohmann::json toJSON() const override {
276 auto j = nlohmann::json{};
277
278 j = nlohmann::json::object();
279 j["code"] = mCCode;
280 j["function"] = mFunctionName;
281
282 auto& jsonExtraFlags = j["extraflags"];
283 jsonExtraFlags = nlohmann::json::array();
284 for (const auto& flag : mExtraArguments) { jsonExtraFlags.push_back(flag); }
285
286 auto& jsonInputs = j["inputs"];
287 jsonInputs = nlohmann::json::array();
288 for (const auto& in : mInputs) {
289 jsonInputs.push_back({{in.name, in.type.qualifiedName()}});
290 }
291
292 if (mOutput.valid()) {
293 j["output"] = mOutput.qualifiedName();
294 } else {
295 j["output"] = nlohmann::json();
296 }
297
298 return j;
299 }
300
301 std::unique_ptr<NodeType> clone() const override {
302 Result res;

Callers 6

renameLocalVariableMethod · 0.45
graphFunctionToJsonFunction · 0.45
connectDataFunction · 0.45
disconnectDataFunction · 0.45

Calls 2

qualifiedNameMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected