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

Method getOrCreateLocalVariable

libchigraph/src/GraphFunction.cpp:389–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389NamedDataType GraphFunction::getOrCreateLocalVariable(std::string name, DataType type,
390 bool* inserted) {
391 auto local = localVariableFromName(name);
392
393 if (local.valid()) {
394 if (inserted != nullptr) { *inserted = false; }
395 return local;
396 }
397
398 // invalidate the cache
399 module().updateLastEditTime();
400
401 mLocalVariables.emplace_back(name, type);
402 if (inserted != nullptr) { *inserted = true; }
403
404 return mLocalVariables[mLocalVariables.size() - 1];
405}
406
407bool GraphFunction::removeLocalVariable(boost::string_view name) {
408 auto iter = std::find_if(mLocalVariables.begin(), mLocalVariables.end(),

Callers 4

JSONSerializer.cppFile · 0.80
jsonToGraphFunctionFunction · 0.80

Calls 2

updateLastEditTimeMethod · 0.80
validMethod · 0.45

Tested by

no test coverage detected