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

Method getOrCreateFunction

libchigraph/src/GraphModule.cpp:700–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700GraphFunction* GraphModule::getOrCreateFunction(std::string name,
701 std::vector<NamedDataType> dataIns,
702 std::vector<NamedDataType> dataOuts,
703 std::vector<std::string> execIns,
704 std::vector<std::string> execOuts, bool* inserted) {
705 // make sure there already isn't one by this name
706 auto foundFunc = functionFromName(name);
707 if (foundFunc != nullptr) {
708 if (inserted != nullptr) { *inserted = false; }
709 return foundFunc;
710 }
711
712 // invalidate the cache
713 updateLastEditTime();
714
715 mFunctions.push_back(std::make_unique<GraphFunction>(*this, std::move(name), std::move(dataIns),
716 std::move(dataOuts), std::move(execIns),
717 std::move(execOuts)));
718
719 if (inserted != nullptr) { *inserted = true; }
720 return mFunctions[mFunctions.size() - 1].get();
721}
722
723bool GraphModule::removeFunction(boost::string_view name, bool deleteReferences) {
724 // invalidate the cache

Calls 1

getMethod · 0.80

Tested by

no test coverage detected