VoiceSDK  5.0.2
settings.h
Go to the documentation of this file.
1 /* Copyright 2020 ID R&D Inc. All Rights Reserved. */
2 
3 #pragma once
4 
5 #include <iostream>
6 #include <stdexcept>
7 #include <string>
8 #include <vector>
9 
10 #include <voicesdk/core/config.h>
11 
12 namespace voicesdk {
16  class LicenseException : public std::runtime_error {
17  public:
18  explicit LicenseException(const std::string& message) : std::runtime_error(message) {}
19  explicit LicenseException(const char* message) : std::runtime_error(message) {}
20  };
21 
25  enum class LicenseFeature : unsigned int {
26  kCore = 7,
27  kVerification = 2,
30  kQualityChecking = 6
31  };
32 
33  inline std::ostream& operator<<(std::ostream& os, const LicenseFeature& feature) {
34 #define PRINT_FEATURE(t) case LicenseFeature::t: os << #t; break;
35  switch (feature) {
41  }
42 #undef PRINT_FEATURE
43  return os;
44  }
45 
51  std::string expiration_date;
54 
55  LicenseFeatureInfo(LicenseFeature feature, std::string expiration_date)
56  : feature(feature),
57  expiration_date(std::move(expiration_date)) {}
58 
59  friend std::ostream& operator<<(std::ostream& os, const LicenseFeatureInfo& info) {
60  os << "LicenseFeatureInfo["
61  << " feature: " << info.feature << ", expiration_date: " << info.expiration_date << " ]";
62  return os;
63  }
64  };
65 
71  VOICE_SDK_API std::vector<LicenseFeatureInfo> getLicenseInfo();
72 
80  VOICE_SDK_API void setNumThreads(unsigned int numThreads) noexcept;
81 
86  VOICE_SDK_API void setAllowMobileGPU(bool allowMobileGPU) noexcept;
87 
92  VOICE_SDK_API void setAllowMobileNNAPI(bool allowMobileNNAPI) noexcept;
93 
99  VOICE_SDK_API void setUseVoiceTemplateCompression(bool useVoiceTemplateCompression) noexcept;
100 
105  VOICE_SDK_API void setMobileLicense(const std::string& mobile_license_string);
106 }
LicenseFeature
VoiceSDK licensed features.
Definition: settings.h:25
friend std::ostream & operator<<(std::ostream &os, const LicenseFeatureInfo &info)
Definition: settings.h:59
VoiceSDK feature information.
Definition: settings.h:49
std::string expiration_date
Definition: settings.h:51
VOICE_SDK_API void setUseVoiceTemplateCompression(bool useVoiceTemplateCompression) noexcept
Sets whether to compress voice templates serialization. Voice template compression is not used by def...
VOICE_SDK_API void setAllowMobileGPU(bool allowMobileGPU) noexcept
Sets whether GPU delegate allowed to be used for VoiceSDK (for Android devices only).
LicenseException(const std::string &message)
Definition: settings.h:18
Definition: intervals.h:8
#define PRINT_FEATURE(t)
A type for exception which is thrown on license expiration or absence.
Definition: settings.h:16
LicenseFeatureInfo(LicenseFeature feature, std::string expiration_date)
Definition: settings.h:55
VOICE_SDK_API void setMobileLicense(const std::string &mobile_license_string)
Sets the mobile SDK license (only can be used for Android and iOS SDKs).
LicenseFeatureInfo()
Definition: settings.h:53
std::ostream & operator<<(std::ostream &os, const LicenseFeature &feature)
Definition: settings.h:33
VOICE_SDK_API void setAllowMobileNNAPI(bool allowMobileNNAPI) noexcept
Sets whether NNAPI delegate allowed to be used for VoiceSDK (for Android devices only).
#define VOICE_SDK_API
Definition: config.h:21
LicenseException(const char *message)
Definition: settings.h:19
VOICE_SDK_API std::vector< LicenseFeatureInfo > getLicenseInfo()
Returns information (enabled features and expiration dates) about the installed license if available...
LicenseFeature feature
Definition: settings.h:50
VOICE_SDK_API void setNumThreads(unsigned int numThreads) noexcept
Sets the maximum number of threads available for VoiceSDK. If 0 passed, then the optimal number of th...