C++ Server-Side SDK
LaunchDarkly SDK
evaluation_stack.hpp
1 #pragma once
2 
3 #include <optional>
4 #include <string>
5 #include <unordered_set>
6 
7 namespace launchdarkly::server_side::evaluation {
8 
13 struct Guard {
14  Guard(std::unordered_set<std::string>& set, std::string key);
15  ~Guard();
16 
17  Guard(Guard const&) = delete;
18  Guard& operator=(Guard const&) = delete;
19 
20  Guard(Guard&&) = delete;
21  Guard& operator=(Guard&&) = delete;
22 
23  private:
24  std::unordered_set<std::string>& set_;
25  std::string const key_;
26 };
27 
33  public:
34  EvaluationStack() = default;
35 
43  [[nodiscard]] std::optional<Guard> NoticePrerequisite(
44  std::string prerequisite_key);
45 
53  [[nodiscard]] std::optional<Guard> NoticeSegment(std::string segment_key);
54 
55  private:
56  std::unordered_set<std::string> prerequisites_seen_;
57  std::unordered_set<std::string> segments_seen_;
58 };
59 
60 } // namespace launchdarkly::server_side::evaluation
std::optional< Guard > NoticePrerequisite(std::string prerequisite_key)
Definition: evaluation_stack.cpp:14
std::optional< Guard > NoticeSegment(std::string segment_key)
Definition: evaluation_stack.cpp:23
Definition: evaluation_stack.hpp:13