C++ Client-Side SDK
LaunchDarkly SDK
sdk.h
Go to the documentation of this file.
1 
4 // NOLINTBEGIN modernize-use-using
5 #pragma once
6 
8 
19 
20 #include <stddef.h>
21 #include <stdint.h>
22 #include <time.h>
23 
24 #ifdef __cplusplus
25 extern "C" { // only need to export C interface if
26 // used by C++ source code
27 #endif
28 
29 typedef struct _LDClientSDK* LDClientSDK;
30 
44 LD_EXPORT(LDClientSDK)
45 LDClientSDK_New(LDClientConfig config, LDContext context);
46 
51 LD_EXPORT(char const*)
53 
101 LD_EXPORT(bool)
102 LDClientSDK_Start(LDClientSDK sdk,
103  unsigned int milliseconds,
104  bool* out_succeeded);
105 
124 LD_EXPORT(bool)
125 LDClientSDK_Initialized(LDClientSDK sdk);
126 
132 LD_EXPORT(void)
133 LDClientSDK_TrackEvent(LDClientSDK sdk, char const* event_name);
134 
149 LD_EXPORT(void)
150 LDClientSDK_TrackMetric(LDClientSDK sdk,
151  char const* event_name,
152  double metric_value,
153  LDValue data);
154 
165 LD_EXPORT(void)
166 LDClientSDK_TrackData(LDClientSDK sdk, char const* event_name, LDValue data);
167 
176 LD_EXPORT(void)
177 LDClientSDK_Flush(LDClientSDK sdk, unsigned int reserved);
178 
230 LD_EXPORT(bool)
231 LDClientSDK_Identify(LDClientSDK sdk,
232  LDContext context,
233  unsigned int milliseconds,
234  bool* out_succeeded);
235 
244 LD_EXPORT(bool)
245 LDClientSDK_BoolVariation(LDClientSDK sdk,
246  char const* flag_key,
247  bool default_value);
248 
261 LD_EXPORT(bool)
262 LDClientSDK_BoolVariationDetail(LDClientSDK sdk,
263  char const* flag_key,
264  bool default_value,
265  LDEvalDetail* out_detail);
266 
277 LD_EXPORT(char*)
278 LDClientSDK_StringVariation(LDClientSDK sdk,
279  char const* flag_key,
280  char const* default_value);
281 
296 LD_EXPORT(char*)
297 LDClientSDK_StringVariationDetail(LDClientSDK sdk,
298  char const* flag_key,
299  char const* default_value,
300  LDEvalDetail* out_detail);
301 
310 LD_EXPORT(int)
311 LDClientSDK_IntVariation(LDClientSDK sdk,
312  char const* flag_key,
313  int default_value);
314 
327 LD_EXPORT(int)
328 LDClientSDK_IntVariationDetail(LDClientSDK sdk,
329  char const* flag_key,
330  int default_value,
331  LDEvalDetail* out_detail);
332 
341 LD_EXPORT(int)
342 LDClientSDK_DoubleVariation(LDClientSDK sdk,
343  char const* flag_key,
344  double default_value);
345 
358 LD_EXPORT(int)
359 LDClientSDK_DoubleVariationDetail(LDClientSDK sdk,
360  char const* flag_key,
361  double default_value,
362  LDEvalDetail* out_detail);
363 
374 LD_EXPORT(LDValue)
375 LDClientSDK_JsonVariation(LDClientSDK sdk,
376  char const* flag_key,
377  LDValue default_value);
378 
393 LD_EXPORT(LDValue)
394 LDClientSDK_JsonVariationDetail(LDClientSDK sdk,
395  char const* flag_key,
396  LDValue default_value,
397  LDEvalDetail* out_detail);
398 
420 LD_EXPORT(LDValue)
421 LDClientSDK_AllFlags(LDClientSDK sdk);
422 
427 LD_EXPORT(void)
428 LDClientSDK_Free(LDClientSDK sdk);
429 
447 LD_EXPORT(LDListenerConnection)
449  char const* flag_key,
450  struct LDFlagListener listener);
451 
452 typedef struct _LDDataSourceStatus* LDDataSourceStatus;
453 
468 
479 
491 
496 
506 
507  LD_DATASOURCESTATUS_STATE_UNUSED_MAXVALUE =
508  INT32_MAX /* Used to ensure the underlying type is
509  * at least 32 bits. */
510 };
511 
518 LD_EXPORT(char const*)
520  char const* default_if_unknown);
521 
526 LD_EXPORT(enum LDDataSourceStatus_State)
527 LDDataSourceStatus_GetState(LDDataSourceStatus status);
528 
545 LD_EXPORT(LDDataSourceStatus_ErrorInfo)
546 LDDataSourceStatus_GetLastError(LDDataSourceStatus status);
547 
566 LD_EXPORT(time_t)
567 LDDataSourceStatus_StateSince(LDDataSourceStatus status);
568 
569 typedef void (*DataSourceStatusCallbackFn)(LDDataSourceStatus status,
570  void* user_data);
571 
587  DataSourceStatusCallbackFn StatusChanged;
588 
592  void* UserData;
593 };
594 
610 LD_EXPORT(void)
612 
624 LD_EXPORT(LDListenerConnection)
626  LDClientSDK sdk,
627  struct LDDataSourceStatusListener listener);
628 
634 LD_EXPORT(LDDataSourceStatus)
635 LDClientSDK_DataSourceStatus_Status(LDClientSDK sdk);
636 
641 LD_EXPORT(void)
642 LDDataSourceStatus_Free(LDDataSourceStatus status);
643 
644 #ifdef __cplusplus
645 }
646 #endif
647 
648 // NOLINTEND modernize-use-using
LaunchDarkly Server-side C Bindings for Data Source Error Info.
Export macros for C bindings.
struct _LDListenerConnection * LDListenerConnection
Definition: listener_connection.h:23
LDClientSDK_Initialized(LDClientSDK sdk)
LDDataSourceStatus_StateSince(LDDataSourceStatus status)
LDClientSDK_Flush(LDClientSDK sdk, unsigned int reserved)
Definition: sdk.cpp:141
LDClientSDK_TrackEvent(LDClientSDK sdk, char const *event_name)
Definition: sdk.cpp:104
LDClientSDK_IntVariation(LDClientSDK sdk, char const *flag_key, int default_value)
Definition: sdk.cpp:226
LDClientSDK_DataSourceStatus_OnStatusChange(LDClientSDK sdk, struct LDDataSourceStatusListener listener)
Definition: sdk.cpp:391
LDClientSDK_JsonVariationDetail(LDClientSDK sdk, char const *flag_key, LDValue default_value, LDEvalDetail *out_detail)
Definition: sdk.cpp:286
LDClientSDK_JsonVariation(LDClientSDK sdk, char const *flag_key, LDValue default_value)
Definition: sdk.cpp:272
LDClientSDK_BoolVariationDetail(LDClientSDK sdk, char const *flag_key, bool default_value, LDEvalDetail *out_detail)
Definition: sdk.cpp:186
LDClientSDK_Free(LDClientSDK sdk)
LDClientSDK_TrackMetric(LDClientSDK sdk, char const *event_name, double metric_value, LDValue data)
Definition: sdk.cpp:112
LDClientSDK_Identify(LDClientSDK sdk, LDContext context, unsigned int milliseconds, bool *out_succeeded)
Definition: sdk.cpp:148
LDClientSDK_AllFlags(LDClientSDK sdk)
Definition: sdk.cpp:303
LDDataSourceStatus_GetLastError(LDDataSourceStatus status)
Definition: sdk.cpp:364
LDDataSourceStatus_GetState(LDDataSourceStatus status)
Definition: sdk.cpp:349
LDClientSDK_BoolVariation(LDClientSDK sdk, char const *flag_key, bool default_value)
Definition: sdk.cpp:176
LDClientSDK_DoubleVariation(LDClientSDK sdk, char const *flag_key, double default_value)
Definition: sdk.cpp:249
LDClientSDK_DataSourceStatus_Status(LDClientSDK sdk)
Definition: sdk.cpp:410
LDClientSDK_Start(LDClientSDK sdk, unsigned int milliseconds, bool *out_succeeded)
Definition: sdk.cpp:75
LDClientSDK_FlagNotifier_OnFlagChange(LDClientSDK sdk, char const *flag_key, struct LDFlagListener listener)
Definition: sdk.cpp:322
LDClientSDK_TrackData(LDClientSDK sdk, char const *event_name, LDValue data)
Definition: sdk.cpp:128
LDClientSDK_IntVariationDetail(LDClientSDK sdk, char const *flag_key, int default_value, LDEvalDetail *out_detail)
Definition: sdk.cpp:236
LDDataSourceStatusListener_Init(struct LDDataSourceStatusListener *listener)
Definition: sdk.cpp:385
LDClientSDK_StringVariationDetail(LDClientSDK sdk, char const *flag_key, char const *default_value, LDEvalDetail *out_detail)
Definition: sdk.cpp:211
LDClientSDK_Version(void)
Definition: sdk.cpp:70
LDClientSDK_DoubleVariationDetail(LDClientSDK sdk, char const *flag_key, double default_value, LDEvalDetail *out_detail)
Definition: sdk.cpp:259
LDDataSourceStatus_State
Definition: sdk.h:457
@ LD_DATASOURCESTATUS_STATE_SHUTDOWN
Definition: sdk.h:505
@ LD_DATASOURCESTATUS_STATE_INTERRUPTED
Definition: sdk.h:490
@ LD_DATASOURCESTATUS_STATE_VALID
Definition: sdk.h:478
@ LD_DATASOURCESTATUS_STATE_INITIALIZING
Definition: sdk.h:467
@ LD_DATASOURCESTATUS_STATE_OFFLINE
Definition: sdk.h:495
LDClientSDK_StringVariation(LDClientSDK sdk, char const *flag_key, char const *default_value)
Definition: sdk.cpp:199
LDDataSourceStatus_State_Name(enum LDDataSourceStatus_State state, char const *default_if_unknown)
Definition: sdk.cpp:356
LDClientSDK_New(LDClientConfig config, LDContext context)
Definition: sdk.cpp:54
LDDataSourceStatus_Free(LDDataSourceStatus status)
Definition: sdk.h:578
void * UserData
Definition: sdk.h:592
Definition: flag_listener.h:24
struct _LDValue * LDValue
Definition: value.h:64