C++ Client-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
flag_notifier.hpp
1#pragma once
2
3#include <launchdarkly/client_side/flag_change_event.hpp>
4#include <launchdarkly/connection.hpp>
5#include <launchdarkly/value.hpp>
6
7#include <functional>
8#include <memory>
9
10namespace launchdarkly::client_side::flag_manager {
11
19 public:
20 // The FlagValueChangeEvent is in a shared pointer so that all handlers
21 // can use the same instance, and the lifetime is tied to how the consumer
22 // uses the event.
23 using ChangeHandler =
24 std::function<void(std::shared_ptr<FlagValueChangeEvent>)>;
25
32 virtual std::unique_ptr<IConnection> OnFlagChange(
33 std::string const& key,
34 ChangeHandler handler) = 0;
35
36 virtual ~IFlagNotifier() = default;
37 IFlagNotifier(IFlagNotifier const& item) = delete;
38 IFlagNotifier(IFlagNotifier&& item) = delete;
39 IFlagNotifier& operator=(IFlagNotifier const&) = delete;
40 IFlagNotifier& operator=(IFlagNotifier&&) = delete;
41
42 protected:
43 IFlagNotifier() = default;
44};
45
46} // namespace launchdarkly::client_side::flag_manager
virtual std::unique_ptr< IConnection > OnFlagChange(std::string const &key, ChangeHandler handler)=0