C++ Server-Side SDK
LaunchDarkly SDK
Public Member Functions | List of all members
launchdarkly::server_side::hooks::EvaluationSeriesContext Class Reference

#include <hook.hpp>

Public Member Functions

 EvaluationSeriesContext (std::string flag_key, Context const &context, Value default_value, std::string method, HookContext const &hook_context, std::optional< std::string > environment_id)
 
std::string_view FlagKey () const
 
Context const & EvaluationContext () const
 
Value const & DefaultValue () const
 
std::string_view Method () const
 
std::optional< std::string_view > EnvironmentId () const
 
HookContext const & HookCtx () const
 

Detailed Description

Context for evaluation series stages. Provides readonly information about the evaluation being performed.

Lifetime: Objects of this type are valid only during the execution of a hook stage. Do not store references, pointers, or string_views from this context. If you need any data beyond the stage execution, copy it to owned types (e.g., std::string, Value).

Constructor & Destructor Documentation

◆ EvaluationSeriesContext()

launchdarkly::server_side::hooks::EvaluationSeriesContext::EvaluationSeriesContext ( std::string  flag_key,
Context const &  context,
Value  default_value,
std::string  method,
HookContext const &  hook_context,
std::optional< std::string >  environment_id 
)

Constructs an evaluation series context.

Parameters
flag_keyThe flag key being evaluated.
contextThe context against which the flag is being evaluated.
default_valueThe default value for the evaluation.
methodThe method being executed.
hook_contextAdditional context data provided by the caller.
environment_idOptional environment ID.

Member Function Documentation

◆ DefaultValue()

Value const & launchdarkly::server_side::hooks::EvaluationSeriesContext::DefaultValue ( ) const

Returns the default value provided to the variation method.

Lifetime: The returned Value reference is valid only during the execution of the current hook stage. If you need the value beyond this call, make a copy.

Returns
Reference to the default value.

◆ EnvironmentId()

std::optional< std::string_view > launchdarkly::server_side::hooks::EvaluationSeriesContext::EnvironmentId ( ) const

Returns the environment ID if available. Only available once initialization has completed.

Lifetime: If present, the returned string_view is valid only during the execution of the current hook stage. If you need the environment ID beyond this call, copy it to a std::string.

Returns
The environment ID as optional string_view, or std::nullopt if not available.

◆ EvaluationContext()

Context const & launchdarkly::server_side::hooks::EvaluationSeriesContext::EvaluationContext ( ) const

Returns the context against which the flag is being evaluated.

Lifetime: The returned Context reference is valid only during the execution of the current hook stage. If you need context data beyond this call, copy the necessary fields.

Returns
The evaluation context.

◆ FlagKey()

std::string_view launchdarkly::server_side::hooks::EvaluationSeriesContext::FlagKey ( ) const

Returns the flag key being evaluated.

Lifetime: The returned string_view is valid only during the execution of the current hook stage. If you need the flag key beyond this call, copy it to a std::string.

Returns
The flag key as a string_view (immutable).

◆ HookCtx()

HookContext const & launchdarkly::server_side::hooks::EvaluationSeriesContext::HookCtx ( ) const

Returns the hook context provided by the caller.

This contains arbitrary data that the caller wants to pass through to hooks, such as OpenTelemetry span parents.

Lifetime: The returned reference is valid only during the execution of the current hook stage.

Returns
Reference to the hook context.

◆ Method()

std::string_view launchdarkly::server_side::hooks::EvaluationSeriesContext::Method ( ) const

Returns the method being executed. Examples: "BoolVariation", "StringVariationDetail"

Lifetime: The returned string_view is valid only during the execution of the current hook stage. If you need the method name beyond this call, copy it to a std::string.

Returns
The method name as a string_view (immutable).

The documentation for this class was generated from the following files: