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#

VisionFlow production infomation.

This class is used to describe the production infomation of VisionFlow. 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, one of “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 VisionFlow. With this function, you can get the release version information at runtime.

Returns:

the version information.

Logging Settings#

using LogSinkFunc = void (*)(int, const char*, size_t)#

Log sink interface. with this interface, you can implement your own log sink to receive log messages.

struct LoggerOptions#

VisionFlow Logger Options.

Public Members

const char *file_sink = nullptr#

Log file path, should be encoded in utf-8; after setting this option, VisionFlow will write the log to the file; if the file does not exist, VisionFlow 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.

unsigned int flush_level = 4#

control the refreshing level of log file. The flush_level range in [0, 6], include on_trace=0, on_debug=1, on_info=2, on_warn=3, on_error=4, on_critical=5, on_off=6. And the default value is 4 (on_error), which means the log file will be refreshed when error or more serious situation (eg:critical) occurring. When flush_level greater than or equal to 6 (on_off), the log file will not be refreshed.

void visionflow::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.