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

Method Get

common/values/value_builder.cc:306–318  ·  view source on GitHub ↗

Like `operator[](int)` above, but also accepts an arena. Prefer calling this variant if the arena is known.

Source from the content-addressed store, hash-verified

304 // Like `operator[](int)` above, but also accepts an arena. Prefer calling
305 // this variant if the arena is known.
306 CelValue Get(google::protobuf::Arena* arena, int index) const override {
307 if (arena == nullptr) {
308 arena = elements_.get_allocator().arena();
309 }
310 if (ABSL_PREDICT_FALSE(index < 0 || index >= size())) {
311 return CelValue::CreateError(google::protobuf::Arena::Create<absl::Status>(
312 arena, IndexOutOfBoundsError(index).ToStatus()));
313 }
314 return common_internal::UnsafeLegacyValue(
315 elements_[index],
316 /*stable=*/true,
317 arena != nullptr ? arena : elements_.get_allocator().arena());
318 }
319
320 int size() const override { return static_cast<int>(Size()); }
321

Callers

nothing calls this directly

Calls 7

UnsafeLegacyValueFunction · 0.85
IndexOutOfBoundsErrorFunction · 0.70
sizeFunction · 0.50
CreateErrorFunction · 0.50
arenaMethod · 0.45
ToStatusMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected