Public Member Functions | |
| bool | isInitialized () |
| Returns true if the client has been initialized. | |
| bool | awaitInitialized (unsigned int timeoutmilli) |
| Block until initialized up to timeout; returns true if initialized. | |
| bool | boolVariation (const std::string &flagKey, bool fallback) |
| Evaluate Bool flag. | |
| int | intVariation (const std::string &flagKey, int fallback) |
| Evaluate Int flag. If the flag value is actually a float, it will be truncated. | |
| double | doubleVariation (const std::string &flagKey, double fallback) |
| Evaluate Double flag. | |
| std::string | stringVariation (const std::string &flagKey, const std::string &fallback) |
| Evaluate String flag. | |
| char * | stringVariation (const std::string &flagKey, const std::string &fallback, char *resultBuffer, size_t resultBufferSize) |
| Evaluate String flag, storing result in provided buffer. | |
| struct LDJSON * | JSONVariation (const std::string &flagKey, const struct LDJSON *fallback) |
| Evaluate JSON flag. More... | |
| bool | boolVariationDetail (const std::string &flagKey, bool fallback, LDVariationDetails *details) |
| Evaluate Bool flag and obtain additional details. | |
| int | intVariationDetail (const std::string &flagKey, int fallback, LDVariationDetails *details) |
| Evaluate Int flag and obtain additional details. | |
| double | doubleVariationDetail (const std::string &flagKey, double fallback, LDVariationDetails *details) |
| Evaluate Double flag and obtain additional details. | |
| std::string | stringVariationDetail (const std::string &flagKey, const std::string &fallback, LDVariationDetails *details) |
| Evaluate String flag and obtain additional details. | |
| char * | stringVariationDetail (const std::string &flagKey, const std::string &fallback, char *resultBuffer, size_t resultBufferSize, LDVariationDetails *details) |
| Evaluate String flag, obtaining additional details. The result is stored in the provided buffer. | |
| struct LDJSON * | JSONVariationDetail (const std::string &flagKey, const struct LDJSON *fallback, LDVariationDetails *details) |
| Evaluate JSON flag and obtain additional details. | |
| struct LDJSON * | getAllFlags () |
Returns an object of all flags. This must be freed with LDJSONFree. | |
| void | setOffline () |
| Make the client operate in offline mode. No network traffic. | |
| void | setOnline () |
| Return the client to online mode. | |
| bool | isOffline () |
| Returns the offline status of the client. | |
| void | setBackground (bool background) |
| Enable or disable polling mode. | |
| std::string | saveFlags () |
| Get JSON string containing all flags. | |
| void | restoreFlags (const std::string &flags) |
| Set flag store from JSON string. | |
| void | identify (LDUser *user) |
| Update the client with a new user. More... | |
| void | alias (const struct LDUser *currentUser, const struct LDUser *previousUser) |
| Record an alias event for a user. | |
| void | track (const std::string &name) |
| Record a custom event. | |
| void | track (const std::string &name, struct LDJSON *data) |
| Record a custom event and include custom data. | |
| void | track (const std::string &name, struct LDJSON *data, double metric) |
| Record a custom event and include a metric. | |
| void | flush () |
| Send any pending events to the server. More... | |
| void | close () |
| Close the client, free resources, and generally shut down. More... | |
| bool | registerFeatureFlagListener (const std::string &name, LDlistenerfn fn) |
| Register a callback for when a flag is updated. | |
| void | unregisterFeatureFlagListener (const std::string &name, LDlistenerfn fn) |
Unregister a callback registered with LDClientRegisterFeatureFlagListener. | |
Static Public Member Functions | |
| static LDClientCPP * | Get () |
Obtain pointer to LDClientCPP singleton. To initialize the singleton, see LDClientCPP::Init. More... | |
| static LDClientCPP * | Init (struct LDConfig *config, struct LDUser *user, unsigned int maxwaitmilli) |
Initialize the client. After this call, the config and user must not be modified. More... | |
| void LDClientCPP::close | ( | ) |
Close the client, free resources, and generally shut down.
This will additionally close all secondary environments. Do not attempt to manage secondary environments directly.
| void LDClientCPP::flush | ( | ) |
Send any pending events to the server.
They will normally be flushed after a timeout, but may also be flushed manually. This operation does not block.
|
static |
Obtain pointer to LDClientCPP singleton. To initialize the singleton, see LDClientCPP::Init.
| void LDClientCPP::identify | ( | LDUser * | user | ) |
Update the client with a new user.
The old user is freed. This will re-fetch feature flag settings from LaunchDarkly. For performance reasons, user contexts should not be changed frequently.
|
static |
Initialize the client. After this call, the config and user must not be modified.
Only a single initialized client may exist at one time. To initialize another instance you must first cleanup the previous client with LDClientCPP::close.
Should you initialize while another client exists abort will be called.
Neither LDClientCPP::Init nor LDClientCPP::close are thread safe.
| config | Configuration for the client. |
| user | Initial user for the client. |
| maxwaitmilli | The max amount of time the client will wait to be fully initialized. If the timeout is hit, the client will be available for feature flag evaluation, but the results will be fallbacks. The client will continue attempts to connect to LaunchDarkly in the background. If maxwaitmilli is set to 0, then LDClientCPP::Init will wait indefinitely. |
| struct LDJSON* LDClientCPP::JSONVariation | ( | const std::string & | flagKey, |
| const struct LDJSON * | fallback | ||
| ) |
Evaluate JSON flag.
LDJSONFree.