DocSDK  2.4.1
settings.h
Go to the documentation of this file.
1 /* Copyright 2022 ID R&D Inc. All Rights Reserved. */
2 
8 #pragma once
9 
10 #include <ostream>
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 #include "config.h"
16 
17 namespace docsdk {
18 
29 DOCSDK_API void SetNumThreads(unsigned int num_threads) noexcept;
30 
34 enum class AttackType {
36  kPrintedCopy,
39  kOther
40 };
41 
45 struct DocSdkFeature {
47  std::string pipeline_name;
48  std::string expiration_date;
50  DocSdkFeature(AttackType attack_type, std::string pipeline_name, std::string expiration_date)
51  : attack_type(attack_type),
52  pipeline_name(std::move(pipeline_name)),
53  expiration_date(std::move(expiration_date)) {}
54 
55  friend std::ostream& operator<<(std::ostream& os, const DocSdkFeature& feature) {
56  os << "DocSdkFeature[ attack_type: ";
57 #define PRINT_ATTACK_TYPE(t) case AttackType::t: os << #t; break;
58  switch (feature.attack_type) {
63  PRINT_ATTACK_TYPE(kOther);
64  }
65 #undef PRINT_ATTACK_TYPE
66  os << ", pipeline_name: " << feature.pipeline_name
67  << ", expiration_date: " << feature.expiration_date << " ]";
68  return os;
69  }
70 };
71 
77 DOCSDK_API std::vector<DocSdkFeature> GetLicenseInfo();
78 
86 DOCSDK_API void SetRuntimeLicense(const std::string& license_str);
87 
91 class LicenseException : public std::runtime_error {
92  public:
93  explicit LicenseException(const std::string& message) : std::runtime_error(message) {}
94  explicit LicenseException(const char* message) : std::runtime_error(message) {}
95 };
96 
97 } // namespace docsdk
DOCSDK_API std::vector< DocSdkFeature > GetLicenseInfo()
Returns information (e.g. supported features and expiration dates) about the installed license if ava...
LicenseException(const char *message)
Definition: settings.h:94
LicenseException(const std::string &message)
Definition: settings.h:93
#define PRINT_ATTACK_TYPE(t)
friend std::ostream & operator<<(std::ostream &os, const DocSdkFeature &feature)
Definition: settings.h:55
#define DOCSDK_API
Definition: config.h:24
AttackType
Document spoofing attack type.
Definition: settings.h:34
DocSDK feature information.
Definition: settings.h:45
AttackType attack_type
Definition: settings.h:46
DOCSDK_API void SetRuntimeLicense(const std::string &license_str)
Sets the runtime license. Only takes effect in "Lambda" SDK distribution and should be called before ...
DOCSDK_API void SetNumThreads(unsigned int num_threads) noexcept
Sets the maximum number of CPU threads available for DocSDK. If 0 is passed, then the optimal number ...
std::string expiration_date
Definition: settings.h:48
std::string pipeline_name
Definition: settings.h:47
Definition: image.h:16
A type for exception which is thrown on license expiration or absence.
Definition: settings.h:91
DocSdkFeature(AttackType attack_type, std::string pipeline_name, std::string expiration_date)
Definition: settings.h:50