C++ Server-Side SDK
LaunchDarkly SDK
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
launchdarkly::EvaluationReason Class Reference

#include <evaluation_reason.hpp>

Public Types

enum class  Kind {
  kOff = 0 , kFallthrough = 1 , kTargetMatch = 2 , kRuleMatch = 3 ,
  kPrerequisiteFailed = 4 , kError = 5
}
 
enum class  ErrorKind {
  kClientNotReady = 0 , kUserNotSpecified = 1 , kFlagNotFound = 2 , kWrongType = 3 ,
  kMalformedFlag = 4 , kException = 5
}
 
enum class  BigSegmentsStatus {
  kNone = 0 , kHealthy = 1 , kStale = 2 , kNotConfigured = 3 ,
  kStoreError = 4
}
 

Public Member Functions

enum Kind const & Kind () const
 
std::optional< ErrorKindErrorKind () const
 
enum BigSegmentsStatus BigSegmentsStatus () const
 
std::optional< std::string > BigSegmentStatus () const
 
std::optional< std::size_t > RuleIndex () const
 
std::optional< std::string > RuleId () const
 
std::optional< std::string > PrerequisiteKey () const
 
bool InExperiment () const
 
 EvaluationReason (enum Kind kind, std::optional< enum ErrorKind > error_kind, std::optional< std::size_t > rule_index, std::optional< std::string > rule_id, std::optional< std::string > prerequisite_key, bool in_experiment, enum BigSegmentsStatus big_segments_status)
 
 EvaluationReason (enum Kind kind, std::optional< enum ErrorKind > error_kind, std::optional< std::size_t > rule_index, std::optional< std::string > rule_id, std::optional< std::string > prerequisite_key, bool in_experiment, std::optional< std::string > big_segment_status)
 
 EvaluationReason (enum ErrorKind error_kind)
 

Static Public Member Functions

static EvaluationReason Off ()
 
static EvaluationReason PrerequisiteFailed (std::string prerequisite_key)
 
static EvaluationReason TargetMatch ()
 
static EvaluationReason Fallthrough (bool in_experiment)
 
static EvaluationReason RuleMatch (std::size_t rule_index, std::optional< std::string > rule_id, bool in_experiment)
 
static EvaluationReason MalformedFlag ()
 

Friends

std::ostream & operator<< (std::ostream &out, Kind const &kind)
 
std::ostream & operator<< (std::ostream &out, ErrorKind const &kind)
 
std::ostream & operator<< (std::ostream &out, BigSegmentsStatus const &status)
 
std::ostream & operator<< (std::ostream &out, EvaluationReason const &reason)
 
bool operator== (EvaluationReason const &lhs, EvaluationReason const &rhs)
 

Detailed Description

Describes the reason that a flag evaluation produced a particular value.

Member Enumeration Documentation

◆ BigSegmentsStatus

Do not change these values. They must remain stable for the C API.

◆ ErrorKind

Do not change these values. They must remain stable for the C API.

◆ Kind

Do not change these values. They must remain stable for the C API.

Constructor & Destructor Documentation

◆ EvaluationReason()

launchdarkly::EvaluationReason::EvaluationReason ( enum Kind  kind,
std::optional< enum ErrorKind error_kind,
std::optional< std::size_t >  rule_index,
std::optional< std::string >  rule_id,
std::optional< std::string >  prerequisite_key,
bool  in_experiment,
std::optional< std::string >  big_segment_status 
)

Deprecated; use the overload taking BigSegmentsStatus instead.

Member Function Documentation

◆ BigSegmentsStatus()

The validity of the Big Segment information used in this evaluation, or BigSegmentsStatus::kNone if the evaluation did not query any Big Segments.

◆ BigSegmentStatus()

std::optional< std::string > launchdarkly::EvaluationReason::BigSegmentStatus ( ) const

Deprecated; use BigSegmentsStatus() instead. Returns the string passed to the deprecated string-typed constructor, or std::nullopt otherwise.

◆ ErrorKind()

A further description of the error condition, if the Kind was Kind::kError.

◆ Fallthrough()

EvaluationReason launchdarkly::EvaluationReason::Fallthrough ( bool  in_experiment)
static

The flag evaluated to its fallthrough value.

Parameters
in_experimentWhether the flag is part of an experiment.

◆ InExperiment()

bool launchdarkly::EvaluationReason::InExperiment ( ) const

Whether the evaluation was part of an experiment.

This is true if the evaluation resulted in an experiment rollout and served one of the variations in the experiment. Otherwise it is false or undefined.

◆ Kind()

Returns
The general category of the reason.

◆ MalformedFlag()

EvaluationReason launchdarkly::EvaluationReason::MalformedFlag ( )
static

The flag data was malformed.

◆ Off()

EvaluationReason launchdarkly::EvaluationReason::Off ( )
static

The flag was off.

◆ PrerequisiteFailed()

EvaluationReason launchdarkly::EvaluationReason::PrerequisiteFailed ( std::string  prerequisite_key)
static

The flag didn't return a variation due to a prerequisite failing.

◆ PrerequisiteKey()

std::optional< std::string > launchdarkly::EvaluationReason::PrerequisiteKey ( ) const

The key of the failed prerequisite flag, if the kind was "PREREQUISITE_FAILED".

◆ RuleId()

std::optional< std::string > launchdarkly::EvaluationReason::RuleId ( ) const

The unique identifier of the matched rule, if the kind was "RULE_MATCH".

◆ RuleIndex()

std::optional< std::size_t > launchdarkly::EvaluationReason::RuleIndex ( ) const

The index of the matched rule (0 for the first), if the kind was "RULE_MATCH".

◆ RuleMatch()

EvaluationReason launchdarkly::EvaluationReason::RuleMatch ( std::size_t  rule_index,
std::optional< std::string >  rule_id,
bool  in_experiment 
)
static

The flag evaluated to a particular variation because it matched a rule.

Parameters
rule_indexIndex of the rule.
rule_idID of the rule.
in_experimentWhether the flag is part of an experiment.

◆ TargetMatch()

EvaluationReason launchdarkly::EvaluationReason::TargetMatch ( )
static

The flag evaluated to a particular variation due to a target match.


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