|
C++ Server-Side SDK
LaunchDarkly SDK
|
#include <hook.hpp>
Public Member Functions | |
| EvaluationSeriesData () | |
| std::optional< std::reference_wrapper< Value const > > | Get (std::string const &key) const |
| std::optional< std::shared_ptr< std::any > > | GetShared (std::string const &key) const |
| bool | Has (std::string const &key) const |
| std::vector< std::string > | Keys () const |
Friends | |
| class | EvaluationSeriesDataBuilder |
Immutable data that can be passed between hook stages. Provides readonly access to data passed between hook stages.
Supports two types of data:
Lifetime: Objects of this type are valid only during the execution of a hook stage. Do not store references or pointers to this data. If you need data beyond the stage execution, copy it.
|
default |
Constructs empty series data.
| std::optional< std::reference_wrapper< Value const > > launchdarkly::server_side::hooks::EvaluationSeriesData::Get | ( | std::string const & | key | ) | const |
Retrieves a Value from the series data.
Lifetime: The returned reference (if present) is valid only during the execution of the current hook stage. If you need the value beyond this call, make a copy.
| key | The key to look up. |
| std::optional< std::shared_ptr< std::any > > launchdarkly::server_side::hooks::EvaluationSeriesData::GetShared | ( | std::string const & | key | ) | const |
Retrieves a shared_ptr to any type from the series data.
Use this for storing arbitrary objects like OpenTelemetry spans that need to be passed from beforeEvaluation to afterEvaluation.
Example:
| key | The key to look up. |
| bool launchdarkly::server_side::hooks::EvaluationSeriesData::Has | ( | std::string const & | key | ) | const |
Checks if a key exists in the series data.
| key | The key to check. |
| std::vector< std::string > launchdarkly::server_side::hooks::EvaluationSeriesData::Keys | ( | ) | const |
Returns all keys in the series data.
Lifetime: The returned vector contains copies of the keys and can be stored safely.