| 698 | } |
| 699 | |
| 700 | GraphFunction* 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 | |
| 723 | bool GraphModule::removeFunction(boost::string_view name, bool deleteReferences) { |
| 724 | // invalidate the cache |
no test coverage detected