Global Settings#
The following settings are used to configure the global settings of the application. Generally, you’d better to configure them when you start the application and do not change them during the running time, although some of them can be changed at any time.
Product Information#
-
struct ProductInfo#
AIDI-SDK production infomation.
This class is used to describe the production infomation of AIDI-SDK. include the version, build date, and so on.
Public Members
-
int version_major#
The major version, such as 1.
-
int version_minor#
The minor version, such as 2.
-
int version_patch#
The patch version, such as 35.
-
uint64_t version_num#
The version number, equal to (version_major * 1000000 + version_minor * 1000 + version_patch). e.g. 1.2.35 is 001002035.
-
std::string version#
The version string, such as “1.2.35”.
-
std::string version_full#
The full version string with revision, e.g. “1.2.35.beta.a0f8b8b.0”.
-
std::string file_hash#
The file hash, e.g. “a0f8b8b.0”.
-
std::string file_full_hash#
The full file hash.
-
std::string release_tag#
The release tag, oneof “alpha”, “beta”, “preview”, “release”.
-
int64_t build_timestamp#
The build timestamp, e.g. 1514098983.
-
std::string copyright#
The copyright, e.g. “Copyright (c) 2017-present, Aqrose Technology,
Ltd. All rights reserved.”.
Public Static Functions
-
static const ProductInfo &Get()#
Get the release version information of AIDI-SDK. With this function, you can get the release version information at runtime.
- Returns:
the version information.
-
int version_major#
Locale and Encoding Settings#
-
struct LocaleOptions#
AIDI-SDK’s locale options, see init_locale for more usage.
Public Members
-
const char *language = ""#
Language used in AIDI-SDK. Currently, there are two language you can choose : Chinese (zh_CN) or English (en_US). By default, AIDI-SDK will use the language consistent with the operating system settings if you don’t set any language or set an empty string.
-
const char *mo_dir = ""#
AIDI-SDK’s binary message (the mo file) catalog. By default, AIDI-SDK will look for binary message catalog in “language” directory under the binary library directory. If you do not use default path, You must give a directory that complies with the gettext’s binary message catalog specification. for example, if you set mo_dir to
, there must exist files such like"C:/language"
or"C:/language/en_US/LC_MESSAGES/aidi-sdk.mo"
."C:/language/zh_CN/LC_MESSAGES/aidi-sdk.mo"
-
const char *encoding = "UTF-8"#
AIDI-SDK only support utf-8 codeing, do not change this option.
-
const char *domain = "aidi-sdk"#
Binary message file (mo file) name, use “aidi-sdk” by default. Do not change this option if you do not know what you are doing.
-
const char *language = ""#
-
void aidi::init_locale(const LocaleOptions &options)#
Set AIDI-SDK’s locale options.
- Parameters:
options – locale options about language, encoding, binary message catalog. see LocaleOptions for more details.
Logging Settings#
-
using LogSinkFunc = void (*)(int, const char*, size_t)#
Log sink interface. with this interface, you can implement your own log sink to recieve log messages.
-
struct LoggerOptions#
AIDI-SDK Logger Options.
Public Members
-
const char *file_sink = nullptr#
Log file path; after setting this option, AIDI-SDK will write the log to the file; if the file does not exist, AIDI will try to create it automatically; if the file already exists , The log information will be appended to the file; the default path is empty, which means that the log will not be output to any file.
-
LogSinkFunc func_sink = nullptr#
Pass in the function pointer used to receive the log, and output the log to your custom function.
-
bool stdout_sink = true#
print the log to the standard output device, this option is enabled by default.
-
bool msvc_sink = false#
When debugging on the Windows platform, you can enable this option to print the log to the debug output window of Visual Studio.
-
const char *file_sink = nullptr#
-
void aidi::init_logger(const LoggerOptions &options)#
Environment Variables#
-
class Environment#
Environment stores the configurations of environmental variables with a global map.
Public Static Functions
-
static const std::string &Get(const std::string &key)#
Get the value of the environment with key.
- Parameters:
key – The environment key.
- Throws:
excepts::DataNotFound – Throws if key not exists in the map.
- Returns:
const std::string& the environment value of the key.
-
static void Set(const std::string &key, const std::string &value)#
Set the environment variable. If the key not exists, it will be added into map. Otherwise, the map will be updated with the new value.
- Parameters:
key – The key of the environment variable.
value – The value of the environment variable.
-
static bool Exists(const std::string &key)#
Check if the environment variable with the key exists.
- Parameters:
key – The key of the environment variable.
- Returns:
true
- Returns:
false
-
static void Erase(const std::string &key)#
Erase the environment variable in the map with the key.
Note
Nothing will happen if the key not exists in the map.
- Parameters:
key – The key of the environment variable.
-
static void Clear()#
Clear all the environmental variables.
-
static std::vector<std::string> AllEnvKeys()#
Get all environment variables’ keys in the map.
- Returns:
std::vector<std::string>
-
static bool MeetRequirements(const std::map<std::string, std::string> &env_vars)#
Check if the current configurations of the Environment Management System meets the environmental conditions with a map of environment variables.
Note
The current Environment system meets requirements means all key-value pairs in the env_vars exist in Environment system.
- Parameters:
env_vars – The map of environment variables to be checked.
- Returns:
true The current environment system meets the requirements of the param’s environmental condition.
- Returns:
false The current environment system does not meet the requirements of the param’s environmental condition.
-
static std::map<std::string, std::string> GetAllEnvironmentVariables()#
Get the All Environment Variables key-value pairs.
- Returns:
std::map<std::string, std::string> The key-value pairs of all Environment Variables.
-
static const std::string &Get(const std::string &key)#