3.2.1. Proximie common types

The Proximie namespace contains some fundamental types used throughout the SDK, as well as being the container for further namespaces for the various SDK features. See the main SDK reference for the feature namespaces.

Commonly used and fundamental types are defined in a Proximie::PxTypes namespace, but these are also exported to the top-level Proximie namespace for convenience.

namespace PxTypes

Typedefs

using string_view = boost::string_view
using error_code = boost::system::error_code
using error_condition = boost::system::error_condition
template<typename T>
using shared_not_null = gsl::not_null<std::shared_ptr<T>>
template<typename T>
using KeyMap = std::map<std::string, T, std::less<>>
template<typename T>
using KeySharedMap = KeyMap<std::shared_ptr<T>>
template<typename T>
using KeyNotNullMap = KeyMap<shared_not_null<T>>
template<typename T>
using FutureOutcome = std::future<outcome::result<T>>
template<typename T>
using PromiseOutcome = std::promise<outcome::result<T>>
template<typename T>
using SharedOutcome = outcome::result<std::shared_ptr<T>>
template<typename T>
using NotNullOutcome = outcome::result<shared_not_null<T>>
using json_object = boost::json::object
using json_value = boost::json::value

Functions

template<typename T>
inline error_code outcome_error_code(const outcome::result<T> &result)

Return the error code from the outcome result, or a “success” error_code value if result is successful.

By default, outcome only allows error to be called when there is an actual error condition Sometimes though, it’s convenient to obtain the error (if any), or the default-constructed “success” error_code value for error handling logic.

inline outcome::result<void> voidOutcomeFromError(error_code error)

Returns a void outcome result from an error code. including return a successful outcome where the error code itself indicates success. Correctly, but rather counter-intuitively, void outcomes created with a error_code, even indicating successful error code value, will indicate an error/failed outcome, where we might expect them to indicate a successful outcome.