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

Method getOrCreateStruct

libchigraph/src/GraphModule.cpp:979–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977}
978
979GraphStruct* GraphModule::getOrCreateStruct(std::string name, bool* inserted) {
980 auto str = structFromName(name);
981
982 if (str != nullptr) {
983 if (inserted != nullptr) { *inserted = false; }
984 return str;
985 }
986 // invalidate the cache
987 updateLastEditTime();
988
989 mStructs.push_back(std::make_unique<GraphStruct>(*this, std::move(name)));
990
991 if (inserted != nullptr) { *inserted = true; }
992 return mStructs[mStructs.size() - 1].get();
993}
994
995bool GraphModule::removeStruct(boost::string_view name) {
996 // invalidate the cache

Callers 3

jsonToGraphModuleFunction · 0.80
jsonToGraphStructFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected