namespace ugcs::vsm

Overview

All VSM SDK functionality resides in this namespace. More…

namespace vsm {

// namespaces

namespace ugcs::vsm::callback_internal;
namespace ugcs::vsm::internal;
namespace ugcs::vsm::java_internals;
namespace ugcs::vsm::mavlink;
    namespace ugcs::vsm::mavlink::internal;
namespace ugcs::vsm::param_setter_internal;
namespace ugcs::vsm::sockets;

// typedefs

typedef Position<Wgs84_datum> Wgs84_position;
typedef Bo_value<T, internal::Le_converter> Le_value;
typedef Bo_value<T, internal::Be_converter> Be_value;
typedef Le_value<int8_t> Le_int8;
typedef Le_value<uint8_t> Le_uint8;
typedef Le_value<int16_t> Le_int16;
typedef Le_value<uint16_t> Le_uint16;
typedef Le_value<int32_t> Le_int32;
typedef Le_value<uint32_t> Le_uint32;
typedef Le_value<float> Le_float;
typedef Le_value<double> Le_double;
typedef Be_value<int8_t> Be_int8;
typedef Be_value<uint8_t> Be_uint8;
typedef Be_value<int16_t> Be_int16;
typedef Be_value<uint16_t> Be_uint16;
typedef Be_value<int32_t> Be_int32;
typedef Be_value<uint32_t> Be_uint32;
typedef Be_value<float> Be_float;
typedef Be_value<double> Be_double;
typedef ugcs::vsm::Param_exception<Debug_assert_exception_dummy_struct,> Debug_assert_exception;
typedef ugcs::vsm::Param_exception<Nullptr_exception_dummy_struct,> Nullptr_exception;
typedef ugcs::vsm::Param_exception<Invalid_param_exception_dummy_struct,> Invalid_param_exception;
typedef ugcs::vsm::Param_exception<Invalid_op_exception_dummy_struct,> Invalid_op_exception;
typedef ugcs::vsm::Param_exception<Internal_error_exception_dummy_struct,> Internal_error_exception;
typedef ugcs::vsm::Param_exception<System_exception_dummy_struct,> System_exception;
typedef ugcs::vsm::Param_exception<Altimeter_required_exception_dummy_struct,> Altimeter_required_exception;
typedef Request_container::Request_waiter Request_waiter;
typedef Request_container::Request Request;
typedef Request_context<true> Request_processor;
typedef Request_context<false> Request_completion_context;
typedef Callback_proxy<int, int, char**> Program_init;
typedef Socket_processor::Stream Socket_stream;
typedef Socket_processor::Socket_listener Socket_listener;
typedef std::shared_ptr<proto::Vsm_message> Proto_msg_ptr;
typedef Vehicle_request_spec<Task> Vehicle_task_request;
typedef Vehicle_request_spec<Vehicle_command> Vehicle_command_request;

// enums

enum Io_result;
enum Run_as_service_result;

// structs

struct Altimeter_required_exception_dummy_struct;
struct Debug_assert_exception_dummy_struct;
struct Internal_error_exception_dummy_struct;
struct Invalid_op_exception_dummy_struct;
struct Invalid_param_exception_dummy_struct;
struct Nullptr_exception_dummy_struct;
struct System_exception_dummy_struct;
struct Ucs_info;

// classes

class Action;
class Android_serial_processor;

template <typename T, class Converter>
class Bo_value;

template <class Method, class Class_ptr, typename... Args>
class Callback<Method, typename std::enable_if<callback_internal::Is_method_ptr<Method>()>::type, Class_ptr, Args...>;

template <class Callable, class Enable, typename... Args>
class Callback;

template <typename Result>
class Callback_base;

template <class Callable, class Forced_args_tuple, typename... Args>
class Callback_forced_args;

template <class Result, typename... Args>
class Callback_proxy;

class Camera_control_action;
class Camera_series_by_distance_action;
class Camera_series_by_time_action;
class Camera_trigger_action;
class Cartesian_tuple;
class Change_speed_action;
class Crc32;
class Cucs_processor;

template <class Base_exception, typename Dummy = void>
class Derived_exception;

class Device;

template <typename Enum_type>
class Enum_set;

class Exception;
class File_processor;
class Geodetic_tuple;
class Heading_action;
class Http_parser;
class Io_buffer;
class Io_request;
class Io_stream;
class Java;
class Landing_action;
class Local_interface;
class Log;
class Mavlink_decoder;
class Mavlink_demuxer;
class Mavlink_encoder;
class Mavlink_stream;
class Move_action;
class Operation_waiter;
class Panorama_action;

template <typename Dummy = void, typename TParam = int>
class Param_exception;

class Payload_steering_action;
class Piped_request_waiter;
class Poi_action;

template <class Datum>
class Position;

class Properties;
class Property;
class Property_list;
class Quaternion;
class Read_request;

template <typename Class_ptr>
class Reference_guard;

class Repeat_servo_action;
class Request_container;

template <bool is_processor>
class Request_context;

class Request_temp_completion_context;
class Request_worker;
class Serial_processor;
class Service_discovery_processor;
class Set_home_action;
class Set_servo_action;
class Shared_memory;
class Shared_mutex_file;

template <class T>
class Singleton;

class Socket_processor;
class Subsystem;
class Takeoff_action;
class Task;
class Task_attributes_action;
class Text_stream_filter;
class Timer_processor;
class Ucs_request;
class Vehicle;
class Vehicle_command;
class Vehicle_request;

template <>
class Vehicle_request_spec<void>;

template <class Payload>
class Vehicle_request_spec;

class Vsm_command;
class Vtol_transition_action;
class Wait_action;
class Wgs84_datum;
class Windows_wstring;
class Write_request;

// global variables

static constexpr int MIN_UDP_PAYLOAD_SIZE_TO_READ = 1500 - 60 - 8;
static constexpr int MAX_TCP_PAYLOAD_SIZE_TO_READ = 1500 - 60 - 40;
std::regex_constants::syntax_option_type platform_independent_filename_regex_matching_flag;
static constexpr int DEFAULT_COMMAND_TRY_COUNT = 3;

// global functions

JNIEXPORT void JNICALL Java_com_ugcs_vsm_Vsm_StreamReady(
    JNIEnv* env,
    jobject _this,
    jint streamId
    );

JNIEXPORT void JNICALL Java_com_ugcs_vsm_Vsm_StreamClosed(
    JNIEnv* env,
    jobject _this,
    jint streamId
    );

JNIEXPORT void JNICALL Java_com_ugcs_vsm_Vsm_StreamWriteComplete(
    JNIEnv* env,
    jobject _this,
    jint streamId,
    jboolean succeeded
    );

JNIEXPORT void JNICALL Java_com_ugcs_vsm_Vsm_StreamReadComplete(
    JNIEnv* env,
    jobject _this,
    jint streamId,
    jobject buf
    );

template <class Callable, typename... Args>
Callback<Callable, void, Args...>::Ptr Make_callback(
    Callable&& callable,
    Args&&... args
    );

template <class Result, typename... Args>
callback_internal::Dummy_callback_helper<Result, Args...>::Callback_type::Ptr Make_dummy_callback();

template <class Callback_ptr, typename Result, typename... Args>
constexpr void Callback_check_type();

float Normalize_angle_0_2pi(float a);
float Normalize_angle_minuspi_pi(float a);
const char* Get_vsm_name();
constexpr bool Is_system_le();
constexpr bool Is_system_be();

template <typename T>
constexpr T Convert_be_8(T x);

template <typename T>
constexpr T Convert_be_16(T x);

template <typename T>
constexpr T Convert_be_32(T x);

template <typename T>
constexpr T Convert_be_64(T x);

template <typename T>
constexpr T Convert_le_8(T x);

template <typename T>
constexpr T Convert_le_16(T x);

template <typename T>
constexpr T Convert_le_32(T x);

template <typename T>
constexpr T Convert_le_64(T x);

template <typename T>
constexpr T Convert_nh_8(T x);

template <typename T>
constexpr T Convert_nh_16(T x);

template <typename T>
constexpr T Convert_nh_32(T x);

template <typename T>
constexpr T Convert_nh_64(T x);

constexpr int8_t Ntoh(int8_t x);
constexpr int8_t Hton(int8_t x);
constexpr int8_t Le(int8_t x);
constexpr int8_t Be(int8_t x);
constexpr uint8_t Ntoh(uint8_t x);
constexpr uint8_t Hton(uint8_t x);
constexpr uint8_t Le(uint8_t x);
constexpr uint8_t Be(uint8_t x);
constexpr int16_t Ntoh(int16_t x);
constexpr int16_t Hton(int16_t x);
constexpr int16_t Le(int16_t x);
constexpr int16_t Be(int16_t x);
constexpr uint16_t Ntoh(uint16_t x);
constexpr uint16_t Hton(uint16_t x);
constexpr uint16_t Le(uint16_t x);
constexpr uint16_t Be(uint16_t x);
constexpr int32_t Ntoh(int32_t x);
constexpr int32_t Hton(int32_t x);
constexpr int32_t Le(int32_t x);
constexpr int32_t Be(int32_t x);
constexpr uint32_t Ntoh(uint32_t x);
constexpr uint32_t Hton(uint32_t x);
constexpr uint32_t Le(uint32_t x);
constexpr uint32_t Be(uint32_t x);
constexpr int64_t Ntoh(int64_t x);
constexpr int64_t Hton(int64_t x);
constexpr int64_t Le(int64_t x);
constexpr int64_t Be(int64_t x);
constexpr uint64_t Ntoh(uint64_t x);
constexpr uint64_t Hton(uint64_t x);
constexpr uint64_t Le(uint64_t x);
constexpr uint64_t Be(uint64_t x);
constexpr float Hton(float x);
constexpr float Ntoh(float x);
constexpr double Hton(double x);
constexpr double Ntoh(double x);
constexpr float Le(float x);
constexpr float Be(float x);
constexpr double Le(double x);
constexpr double Be(double x);

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(Make_write_callback, (Io_result), (Io_result::OTHER_FAILURE));

template <typename... Params>
Callback<param_setter_internal::Param_setter<Params...>, void, Params...>::Ptr Make_setter(Params&... params);

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(
    Make_program_init_handler,
    (int, char**),
    (0, nullptr)
    );

Run_as_service_result Run_as_service(
    const char* service_name,
    int argc,
    char* argv[],
    Program_init prog_init,
    Program_done prog_done
    );

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_connect_callback,
    (Socket_stream::Ref, Io_result),
    (nullptr, Io_result::OTHER_FAILURE)
    );

typename __Args __DEFINE_CALLBACK_BUILDER_BODY(Make_socket_listen_callback, (Socket_listener::Ref, Io_result), (nullptr, Io_result::OTHER_FAILURE));
typename __Args typename __Args __DEFINE_CALLBACK_BUILDER_BODY(Make_socket_accept_callback, (Socket_stream::Ref, Io_result), (nullptr, Io_result::OTHER_FAILURE));

typename __Args typename __Args typename __Args __DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_read_from_callback,
    (Io_buffer::Ptr, Io_result, Socket_address::Ptr),
    (nullptr, Io_result::OTHER_FAILURE, nullptr)
    );

uint32_t Get_unique_id();
uint32_t Get_application_instance_id();
uint64_t Get_random_seed();
std::string& Ltrim(std::string& str);
std::string& Rtrim(std::string& str);
std::string& Trim(std::string& str);
static constexpr std::chrono::milliseconds DEFAULT_COMMAND_TIMEOUT(1000);
void Initialize(const std::string& props_file = "vsm.conf");
void Initialize(int argc, char* argv[], const std::string& default_conf_file = "vsm.conf");
void Terminate(bool save_config = false);

} // namespace vsm

Detailed Documentation

All VSM SDK functionality resides in this namespace.

Typedefs

typedef Position<Wgs84_datum> Wgs84_position

Position defined in WGS84 geodetic system.

typedef Bo_value<T, internal::Le_converter> Le_value

Little-endian value wrapper.

Parameters:

T

Underlying primitive type.

typedef Bo_value<T, internal::Be_converter> Be_value

Big-endian value wrapper.

Parameters:

T

Underlying primitive type.

typedef Le_value<int8_t> Le_int8

Standard primitive types for little-endian byte order.

typedef Be_value<int8_t> Be_int8

Standard primitive types for big-endian byte order.

typedef Request_container::Request_waiter Request_waiter

Request waiter type for convenient usage.

typedef Request_container::Request Request

Request type for convenient usage.

typedef Request_context<true> Request_processor

Request processor is a request execution context where request are processed.

typedef Request_context<false> Request_completion_context

Request completion context is a request execution context where notification about request completions are processed.

typedef Callback_proxy<int, int, char**> Program_init

Signature for program initialization routine.

int Program_init(int, char **, …); This function is called from the service main thread when program is run as a service. The function should be used to initialize the service functionality and should return within reasonable time - less than 10 seconds. Return result: 0: Tells that service initialized correctly. Service is reported as RUNNING to sc manager. non-zero: Service initialization failed. Service is reported as STOPPED to sc manager.

typedef Socket_processor::Stream Socket_stream

Convenience types aliases.

typedef Vehicle_request_spec<Task> Vehicle_task_request

Vehicle request for ugcs::vsm::Task payload.

typedef Vehicle_request_spec<Vehicle_command> Vehicle_command_request

Vehicle request for ugcs::vsm::Vehicle_command payload.

Global Variables

std::regex_constants::syntax_option_type platform_independent_filename_regex_matching_flag

This flag is used to support case insensitive file systems in regular expression matching.

defined as regex::regex_constants::icase on windows (Ignore case when matching patterns) defined as regex::regex_constants::none on linux (All matching is case sensitive)

Global Functions

template <class Callable, typename... Args>
Callback<Callable, void, Args...>::Ptr Make_callback(
    Callable&& callable,
    Args&&... args
    )

Create a callback.

Parameters:

callable

Any callable object type (function, lambda, class with overloaded call operator etc.). It may be a class member function pointer. In this case the first argument should be object instance pointer (may be any object which can be used with pointer semantic).

args

Arguments pack.

Returns:

Callback specified with user arguments.

See also:

Callback

template <class Result, typename... Args>
callback_internal::Dummy_callback_helper<Result, Args...>::Callback_type::Ptr Make_dummy_callback()

Create dummy callback.

Such callback can be used as placeholder, for example, in default value for handler argument. It uses default constructor for mandatory arguments and return value. It does nothing when fired. Template parameters:

  • Result Type of return value.

  • Args Types for mandatory arguments if any.

template <class Callback_ptr, typename Result, typename... Args>
constexpr void Callback_check_type()

Check if the specified callback type corresponds to the partial prototype.

All types are checked for implicit conversion possibility from real type to the expected one.

Template parameters:

  • Callback_ptr Type of callback pointer.

  • Result Expected result type.

  • Args Expected first arguments type.

constexpr bool Is_system_le()

Check if the system is little-endian.

constexpr bool Is_system_be()

Check if the system is big-endian.

template <typename T>
constexpr T Convert_be_8(T x)

Stub for easier conversion functions generalization.

template <typename T>
constexpr T Convert_be_16(T x)

Convert 16 bits value byte order from BE to host byte order and vice versa.

Template parameters:

  • T 16-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_be_32(T x)

Convert 32 bits value byte order from BE to host byte order and vice versa.

Template parameters:

  • T 32-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_be_64(T x)

Convert 64 bits value byte order from BE to host byte order and vice versa.

Template parameters:

  • T 64-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_le_8(T x)

Stub for easier conversion functions generalization.

template <typename T>
constexpr T Convert_le_16(T x)

Convert 16 bits value byte order from LE to host byte order and vice versa.

Template parameters:

  • T 16-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_le_32(T x)

Convert 32 bits value byte order from LE to host byte order and vice versa.

Template parameters:

  • T 32-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_le_64(T x)

Convert 64 bits value byte order from LE to host byte order and vice versa.

Template parameters:

  • T 64-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_nh_8(T x)

Stub for easier conversion functions generalization.

template <typename T>
constexpr T Convert_nh_16(T x)

Convert 16 bits value byte order from network to host byte order and vice versa.

Template parameters:

  • T 16-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_nh_32(T x)

Convert 32 bits value byte order from network to host byte order and vice versa.

Template parameters:

  • T 32-bits integer type.

Parameters:

x

Value to convert.

template <typename T>
constexpr T Convert_nh_64(T x)

Convert 64 bits value byte order from network to host byte order and vice versa.

Template parameters:

  • T 64-bits integer type.

Parameters:

x

Value to convert.

constexpr int8_t Ntoh(int8_t x)

Convert value from network to host byte order.

constexpr int8_t Hton(int8_t x)

Convert value from host to network byte order.

constexpr int8_t Le(int8_t x)

Convert value from LE to host byte order and vice versa.

constexpr int8_t Be(int8_t x)

Convert value from BE to host byte order and vice versa.

constexpr uint8_t Ntoh(uint8_t x)

Convert value from network to host byte order.

constexpr uint8_t Hton(uint8_t x)

Convert value from host to network byte order.

constexpr uint8_t Le(uint8_t x)

Convert value from LE to host byte order and vice versa.

constexpr uint8_t Be(uint8_t x)

Convert value from BE to host byte order and vice versa.

constexpr int16_t Ntoh(int16_t x)

Convert value from network to host byte order.

constexpr int16_t Hton(int16_t x)

Convert value from host to network byte order.

constexpr int16_t Le(int16_t x)

Convert value from LE to host byte order and vice versa.

constexpr int16_t Be(int16_t x)

Convert value from BE to host byte order and vice versa.

constexpr uint16_t Ntoh(uint16_t x)

Convert value from network to host byte order.

constexpr uint16_t Hton(uint16_t x)

Convert value from host to network byte order.

constexpr uint16_t Le(uint16_t x)

Convert value from LE to host byte order and vice versa.

constexpr uint16_t Be(uint16_t x)

Convert value from BE to host byte order and vice versa.

constexpr int32_t Ntoh(int32_t x)

Convert value from network to host byte order.

constexpr int32_t Hton(int32_t x)

Convert value from host to network byte order.

constexpr int32_t Le(int32_t x)

Convert value from LE to host byte order and vice versa.

constexpr int32_t Be(int32_t x)

Convert value from BE to host byte order and vice versa.

constexpr uint32_t Ntoh(uint32_t x)

Convert value from network to host byte order.

constexpr uint32_t Hton(uint32_t x)

Convert value from host to network byte order.

constexpr uint32_t Le(uint32_t x)

Convert value from LE to host byte order and vice versa.

constexpr uint32_t Be(uint32_t x)

Convert value from BE to host byte order and vice versa.

constexpr int64_t Ntoh(int64_t x)

Convert value from network to host byte order.

constexpr int64_t Hton(int64_t x)

Convert value from host to network byte order.

constexpr int64_t Le(int64_t x)

Convert value from LE to host byte order and vice versa.

constexpr int64_t Be(int64_t x)

Convert value from BE to host byte order and vice versa.

constexpr uint64_t Ntoh(uint64_t x)

Convert value from network to host byte order.

constexpr uint64_t Hton(uint64_t x)

Convert value from host to network byte order.

constexpr uint64_t Le(uint64_t x)

Convert value from LE to host byte order and vice versa.

constexpr uint64_t Be(uint64_t x)

Convert value from BE to host byte order and vice versa.

constexpr float Hton(float x)

Convert float type from host to network format.

constexpr float Ntoh(float x)

Convert float type from network to host format.

constexpr double Hton(double x)

Convert double type from host to network format.

constexpr double Ntoh(double x)

Convert double type from network to host format.

constexpr float Le(float x)

Convert float type from LE to host format.

constexpr float Be(float x)

Convert float type from BE to host format.

constexpr double Le(double x)

Convert float type from LE to host format.

constexpr double Be(double x)

Convert float type from BE to host format.

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(
    Make_write_callback,
    (Io_result),
    (Io_result::OTHER_FAILURE)
    )

Convenience builder for write operation callbacks.

Convenience builder for read operation callbacks.

template <typename... Params>
Callback<param_setter_internal::Param_setter<Params...>, void, Params...>::Ptr Make_setter(Params&... params)

Make setter callback for provided parameters.

It can be used as a convenience callback which just sets all provided parameters to the arguments values when invoked.

Parameters:

params

References to the parameters storage.

Returns:

Callback object which returns void type and accepts values for the provided parameters.

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(
    Make_program_init_handler,
    (int, char**),
    (0, nullptr)
    )

Builder for init handler.

Programs’ deinit routine. Called when service is about to get stopped. Use this routine to cleanup resources.

Run_as_service_result Run_as_service(
    const char* service_name,
    int argc,
    char* argv[],
    Program_init prog_init,
    Program_done prog_done
    )

Entry point for running program as a service.

This function should be the first called from program’s main(). argc and argv from main() should be passed unchanged to the function.

The program must be run as Administrator for service commands to succeed.

When launched from command line (not as a service) this function recognizes the following arguments from argv array: service create|delete|start|stop|restart [service-startup-mode auto|manual] service-description “Quoted text describing the service” config <path_to_vsm_config_file>

-service create 1) Creates the service with given name and sets startup mode according to “–service-startup-mode” argument. Starts the service if startup mode is set to auto. 2) Saves the rest of given parameters in registry (excluding the “-service <action>” and “–service-startup-mode <mode>”). 3) config <file> is treated in a special way: a) “vsm.conf” is used when config parameter not present. b) File name is converted to absolute path. 4) If config file is not accessible the service is not created and the call fails.

service delete Stops and removes the service from registry. (The same as running Windows command ‘sc delete <service_name>’)

service start Starts the service (The same as running Windows command ‘sc start <service_name>’)

service stop Stop the service (The same as running Windows command ‘sc stop <service_name>’)

service restart Stop and start the service. Used when config has changed. (The same as running Windows commands ‘sc stop <service_name>’ and then ‘sc start <service_name>’) To run the service with different config file path it must be reinstalled using -service delete and -service create calls

service state Display current state of service: Running, Stopped, …

service-startup-mode manual (default) Used together with “–service create” command Service will require manual start with ‘sc start <service_name>’ command or ‘<program> service start’ command. This is the default mode when service-startup-mode parameter not given.

service-startup-mode auto Used together with “–service create” command Start service automatically when Windows starts

service-description “quoted string” Used to specify service description. This text will appear in Windows Service manager console

service-account “quoted string” Used to specify account which will run the service.

service-password “quoted string” Used to specify password for service account.

When the program main is invoked as a service then Run_as_windows_service() returns only when the service is stopped. The return value is SERVICE_RESULT_OK.

Parameters:

service_name

Name of the service this program will implement.

argc

Parameter count.

argv

Parameter string values (ANSI only, localized strings not supported)

prog_init

Function to call on service startup (required)

prog_done

Function to call on service stop. Can be NULL.

Returns:

true - service specific parameters were found and handled successfully. when run as service, the program is going to stop. Basically, your main function should exit right after this call returned true. false - no service specific parameters found and not invoked as service In this case your program can continue as normal console app.

template <class __Callable, typename... __Args>
__DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_connect_callback,
    (Socket_stream::Ref, Io_result),
    (nullptr, Io_result::OTHER_FAILURE)
    )

Convenience builder for socket connect operation callbacks.

Convenience builder for socket listen operation callbacks.

typename __Args __DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_listen_callback,
    (Socket_listener::Ref, Io_result),
    (nullptr, Io_result::OTHER_FAILURE)
    )

Convenience builder for socket accept operation callbacks.

typename __Args typename __Args __DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_accept_callback,
    (Socket_stream::Ref, Io_result),
    (nullptr, Io_result::OTHER_FAILURE)
    )

Convenience builder for socket Read_from operation callbacks.

typename __Args typename __Args typename __Args __DEFINE_CALLBACK_BUILDER_BODY(
    Make_socket_read_from_callback,
    (Io_buffer::Ptr, Io_result, Socket_address::Ptr),
    (nullptr, Io_result::OTHER_FAILURE, nullptr)
    )

Convenience builder for Read operation callbacks.

uint32_t Get_application_instance_id()

Return instance id which is randomly generated on the first call.

uint64_t Get_random_seed()

Return a random number on each call.

Can be used to seed PRNG.

void Initialize(const std::string& props_file = "vsm.conf")

Initialize VSM SDK.

This function should be called before using any API.

Parameters:

props_file

Name of the configuration file, ‘vsm.conf’ is the default.

Invalid_param_exception

if configuration file cannot be opened.

Properties::Parse_exception

if the configuration file has invalid format.

Properties::Not_found_exception

if required entries are missing in the configuration file.

Properties::Not_convertible_exception

if configuration entries has invalid format (e.g. invalid string where integer value is required).

void Initialize(
    int argc,
    char* argv[],
    const std::string& default_conf_file = "vsm.conf"
    )

Initialize VSM SDK.

This function should be called before using any API. This function parses the argument list and initializes vsm according to them. Supported arguments:

config <confguration file name>

Parameters:

argc

argument count in argv array

argv

argument list

default_conf_file

Default configuration file name if not specified via arguments.

Invalid_param_exception

if configuration file cannot be opened.

Properties::Parse_exception

if the configuration file has invalid format.

Properties::Not_found_exception

if required entries are missing in the configuration file.

Properties::Not_convertible_exception

if configuration entries has invalid format (e.g. invalid string where integer value is required).

void Terminate(bool save_config = false)

Terminate VSM SDK.

This function should be called when VSM is termination. VSM SDK API cannot be used after that.

Parameters:

save_config

Indicates that VSM configuration file should be saved so that changes done in run-time will be persisted.