MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / RemoveFunctionEntries

Method RemoveFunctionEntries

eval/public/activation.cc:55–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55bool Activation::RemoveFunctionEntries(
56 const CelFunctionDescriptor& descriptor) {
57 auto map_entry = function_map_.find(descriptor.name());
58 if (map_entry == function_map_.end()) {
59 return false;
60 }
61 std::vector<std::unique_ptr<CelFunction>>& overloads = map_entry->second;
62 bool funcs_removed = false;
63 auto func_iter = overloads.begin();
64 while (func_iter != overloads.end()) {
65 if (descriptor.ShapeMatches(func_iter->get()->descriptor())) {
66 func_iter = overloads.erase(func_iter);
67 funcs_removed = true;
68 } else {
69 ++func_iter;
70 }
71 }
72
73 if (overloads.empty()) {
74 function_map_.erase(map_entry);
75 }
76
77 return funcs_removed;
78}
79
80void Activation::InsertValue(absl::string_view name, const CelValue& value) {
81 value_map_.try_emplace(name, ValueEntry(value));

Callers 1

TESTFunction · 0.80

Calls 6

nameMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
ShapeMatchesMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by 1

TESTFunction · 0.64