Face SDK  1.14.1 Mozart release
Face Recognition Software Development Kit
license.h
1 
4 #ifndef FACE_SDK_LICENSE_H
5 #define FACE_SDK_LICENSE_H
6 
7 #include <face_sdk_base/export.h>
8 #include <face_sdk_base/data_container.h>
9 
10 #include <memory>
11 #include <vector>
12 #include <functional>
13 
14 #define FACE_SDK_REMOTE_LICENSE_DEFAULT "FACE_SDK_REMOTE_LICENSE_DEFAULT"
15 #define FACE_SDK_REMOTE_LICENSE_TOKEN "FACE_SDK_REMOTE_LICENSE_TOKEN"
16 #define FACE_SDK_REMOTE_LICENSE_TIME_BOUND "FACE_SDK_REMOTE_LICENSE_TIME_BOUND"
17 
18 namespace face_sdk
19 {
27  class FACE_SDK_EXPORT license
28  {
29  public:
30  virtual ~license() = default;
31 
34  virtual std::string get_license_info() const = 0;
35 
38  virtual bool is_time_bound() const = 0;
39  };
40 
44  std::shared_ptr<face_sdk::license> FACE_SDK_EXPORT load_licence_from_file();
45 
51  std::shared_ptr<face_sdk::license> FACE_SDK_EXPORT load_licence_from_file(const std::string &license_file);
52 
57  std::shared_ptr<face_sdk::license> FACE_SDK_EXPORT load_licence_from_data(const std::vector<uint8_t> &data);
58 
64  std::vector<uint8_t> FACE_SDK_EXPORT generate_license_request(std::vector<uint32_t> gpu_ids = std::vector<uint32_t>());
65 
66 
70  std::vector<uint8_t> FACE_SDK_EXPORT generate_time_bound_license_request();
71 
74  class FACE_SDK_EXPORT license_callback
75  {
76  public:
77  virtual ~license_callback() = default;
78 
84  virtual std::vector<uint8_t> on_load() = 0;
85 
90  virtual void on_updated(const std::vector<uint8_t> &license_data) = 0;
91  };
92 
95  class FACE_SDK_EXPORT remote_license : public face_sdk::license
96  {
97  public:
98  ~remote_license() override = default;
99 
104  virtual void force_update() = 0;
105  };
106 
113  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token);
114 
122  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
123  const std::string &filename);
124 
132  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
133  const std::shared_ptr<face_sdk::license_callback> &callback);
134 
143  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
144  const std::vector<uint8_t> &request,
145  const std::shared_ptr<face_sdk::license_callback> &callback);
146 
147 
155  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
156  bool time_bound);
157 
166  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
167  const std::string &filename,
168  bool time_bound);
169 
178  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
179  const std::shared_ptr<face_sdk::license_callback> &callback,
180  bool time_bound);
181 
191  std::shared_ptr<face_sdk::remote_license> FACE_SDK_EXPORT make_remote_license(const std::string &token,
192  const std::vector<uint8_t> &request,
193  const std::shared_ptr<face_sdk::license_callback> &callback,
194  bool time_bound);
195 
202  std::shared_ptr<face_sdk::license> FACE_SDK_EXPORT make_default_license();
203 
205 }
206 
207 #endif
std::shared_ptr< face_sdk::remote_license > make_remote_license(const std::string &token, const std::vector< uint8_t > &request, const std::shared_ptr< face_sdk::license_callback > &callback, bool time_bound)
Makes remote license with specified token, request and callback.
std::shared_ptr< face_sdk::license > make_default_license()
Make license depending on environment variables (FACE_SDK_REMOTE_LICENSE_DEFAULT, FACE_SDK_REMOTE_LIC...
Definition: alignment_info.h:8
std::shared_ptr< face_sdk::license > load_licence_from_data(const std::vector< uint8_t > &data)
Load license from memory.
std::vector< uint8_t > generate_time_bound_license_request()
Api function to generate time bound license request (the same time bound only license works on any de...
The license object. A license object provides information about your limits in face_sdk. See Licensing.
Definition: license.h:27
Callback interface for remote license.
Definition: license.h:74
std::vector< uint8_t > generate_license_request(std::vector< uint32_t > gpu_ids=std::vector< uint32_t >())
Api function to generate license request. Usually you can use face_sdk_utils for this purpose...
Remote license. Fetches license from server or from local cache.
Definition: license.h:95
std::shared_ptr< face_sdk::license > load_licence_from_file(const std::string &license_file)
Load license from specified file.