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

Class FunctionResultSet

base/function_result_set.h:39–101  ·  view source on GitHub ↗

Represents a collection of unknown function results at a particular point in execution. Execution should advance further if this set of unknowns are provided. It may not advance if only a subset are provided. Set semantics use |IsEqualTo()| defined on |FunctionResult|.

Source from the content-addressed store, hash-verified

37// provided. It may not advance if only a subset are provided.
38// Set semantics use |IsEqualTo()| defined on |FunctionResult|.
39class FunctionResultSet final {
40 private:
41 using Container = absl::btree_set<FunctionResult>;
42
43 public:
44 using value_type = typename Container::value_type;
45 using size_type = typename Container::size_type;
46 using iterator = typename Container::const_iterator;
47 using const_iterator = typename Container::const_iterator;
48
49 FunctionResultSet() = default;
50 FunctionResultSet(const FunctionResultSet&) = default;
51 FunctionResultSet(FunctionResultSet&&) = default;
52 FunctionResultSet& operator=(const FunctionResultSet&) = default;
53 FunctionResultSet& operator=(FunctionResultSet&&) = default;
54
55 // Merge constructor -- effectively union(lhs, rhs).
56 FunctionResultSet(const FunctionResultSet& lhs, const FunctionResultSet& rhs);
57
58 // Initialize with a single FunctionResult.
59 explicit FunctionResultSet(FunctionResult initial)
60 : function_results_{std::move(initial)} {}
61
62 FunctionResultSet(std::initializer_list<FunctionResult> il)
63 : function_results_(il) {}
64
65 iterator begin() const { return function_results_.begin(); }
66
67 const_iterator cbegin() const { return function_results_.cbegin(); }
68
69 iterator end() const { return function_results_.end(); }
70
71 const_iterator cend() const { return function_results_.cend(); }
72
73 size_type size() const { return function_results_.size(); }
74
75 bool empty() const { return function_results_.empty(); }
76
77 bool operator==(const FunctionResultSet& other) const {
78 return this == &other || function_results_ == other.function_results_;
79 }
80
81 bool operator!=(const FunctionResultSet& other) const {
82 return !operator==(other);
83 }
84
85 private:
86 friend class google::api::expr::runtime::AttributeUtility;
87 friend class UnknownValue;
88 friend class base_internal::UnknownSet;
89
90 void Add(const FunctionResult& function_result) {
91 function_results_.insert(function_result);
92 }
93
94 void Add(const FunctionResultSet& other) {
95 for (const auto& function_result : other) {
96 Add(function_result);

Callers 2

CreateUnknownSetMethod · 0.85
UnknownSetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected