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

Function RegisterModernLists

extensions/sets_functions_benchmark_test.cc:166–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166absl::StatusOr<std::unique_ptr<ListStorage>> RegisterModernLists(
167 bool overlap, int len, google::protobuf::Arena* absl_nonnull arena,
168 Activation& activation) {
169 auto x_builder = cel::NewListValueBuilder(arena);
170 auto y_builder = cel::NewListValueBuilder(arena);
171
172 x_builder->Reserve(len + 1);
173 y_builder->Reserve(len + 1);
174
175 if (overlap) {
176 CEL_RETURN_IF_ERROR(x_builder->Add(cel::IntValue(2)));
177 CEL_RETURN_IF_ERROR(y_builder->Add(cel::IntValue(1)));
178 }
179
180 for (int i = 0; i < len; i++) {
181 CEL_RETURN_IF_ERROR(x_builder->Add(cel::IntValue(1)));
182 CEL_RETURN_IF_ERROR(y_builder->Add(cel::IntValue(2)));
183 }
184
185 auto x = std::move(*x_builder).Build();
186 auto y = std::move(*y_builder).Build();
187 auto result = std::make_unique<ModernListStorage>(std::move(x), std::move(y));
188 activation.InsertValue("x", result->x());
189 activation.InsertValue("y", result->y());
190
191 return result;
192}
193
194absl::StatusOr<std::unique_ptr<ListStorage>> RegisterLists(
195 bool overlap, int len, bool use_modern, google::protobuf::Arena* absl_nonnull arena,

Callers 1

RegisterListsFunction · 0.85

Calls 7

InsertValueMethod · 0.80
IntValueClass · 0.50
ReserveMethod · 0.45
AddMethod · 0.45
BuildMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected