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

Method Equal

common/values/double_value.cc:107–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107absl::Status DoubleValue::Equal(
108 const Value& other,
109 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
110 google::protobuf::MessageFactory* absl_nonnull message_factory,
111 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
112 ABSL_DCHECK(descriptor_pool != nullptr);
113 ABSL_DCHECK(message_factory != nullptr);
114 ABSL_DCHECK(arena != nullptr);
115 ABSL_DCHECK(result != nullptr);
116
117 if (auto other_value = other.AsDouble(); other_value.has_value()) {
118 *result = BoolValue{NativeValue() == other_value->NativeValue()};
119 return absl::OkStatus();
120 }
121 if (auto other_value = other.AsInt(); other_value.has_value()) {
122 *result =
123 BoolValue{internal::Number::FromDouble(NativeValue()) ==
124 internal::Number::FromInt64(other_value->NativeValue())};
125 return absl::OkStatus();
126 }
127 if (auto other_value = other.AsUint(); other_value.has_value()) {
128 *result =
129 BoolValue{internal::Number::FromDouble(NativeValue()) ==
130 internal::Number::FromUint64(other_value->NativeValue())};
131 return absl::OkStatus();
132 }
133 *result = FalseValue();
134 return absl::OkStatus();
135}
136
137} // namespace cel

Callers

nothing calls this directly

Calls 7

FalseValueFunction · 0.85
NativeValueFunction · 0.70
AsDoubleMethod · 0.45
has_valueMethod · 0.45
NativeValueMethod · 0.45
AsIntMethod · 0.45
AsUintMethod · 0.45

Tested by

no test coverage detected