Public Member Functions | |
| wamp_call_result (msgpack::zone &&zone) | |
| wamp_call_result (const wamp_call_result &other)=delete | |
| wamp_call_result (wamp_call_result &&other) | |
| wamp_call_result & | operator= (const wamp_call_result &other)=delete |
| wamp_call_result & | operator= (wamp_call_result &&other) |
| std::size_t | number_of_arguments () const |
| The number of positional arguments returned from the call. | |
| std::size_t | number_of_kw_arguments () const |
| The number of keyword arguments returned from the call. | |
| template<typename T > | |
| T | argument (std::size_t index) const |
The positional argument returned from the call with the given index, converted to type T. More... | |
| template<typename List > | |
| List | arguments () const |
| The positional arguments returned from the call, converted to a list type. More... | |
| template<typename List > | |
| void | get_arguments (List &args) const |
Convert and assign the positional arguments returned from the call to the given args list. More... | |
| template<typename... T> | |
| void | get_each_argument (T &...args) const |
| Convert and assign the positional arguments to a given list of individual parameters. More... | |
| template<typename T > | |
| T | kw_argument (const std::string &key) const |
The keyword argument returned from the call with the given key, converted to type T. More... | |
| template<typename T > | |
| T | kw_argument (const char *key) const |
| template<typename T > | |
| T | kw_argument_or (const std::string &key, const T &fallback) const |
The keyword argument returned from the call with the given key, converted to type T, or the given fallback if no such key was passed. More... | |
| template<typename T > | |
| T | kw_argument_or (const char *key, const T &fallback) const |
| template<typename Map > | |
| Map | kw_arguments () const |
| The keyword arguments returned from the call, converted to a map type. More... | |
| template<typename Map > | |
| void | get_kw_arguments (Map &kw_args) const |
Convert and assign the keyword arguments returned from the call to the given kw_args map. More... | |
| void | set_arguments (const msgpack::object &arguments) |
| void | set_kw_arguments (const msgpack::object &kw_arguments) |
Detailed Description
Definition at line 39 of file wamp_call_result.hpp.
Member Function Documentation
| T autobahn::wamp_call_result::argument | ( | std::size_t | index | ) | const |
The positional argument returned from the call with the given index, converted to type T.
Example: std::string id = result.argument<std::string>(0); // first positional argument
- Exceptions
-
std::out_of_range std::bad_cast
| List autobahn::wamp_call_result::arguments | ( | ) | const |
The positional arguments returned from the call, converted to a list type.
Example: auto args = result.arguments<std::tuple<std::string>>();
- Exceptions
-
std::bad_cast
| void autobahn::wamp_call_result::get_arguments | ( | List & | args | ) | const |
Convert and assign the positional arguments returned from the call to the given args list.
Example:
- Exceptions
-
std::bad_cast
|
inline |
Convert and assign the positional arguments to a given list of individual parameters.
Enables a syntax that lets you declare variables individually, but list them in a single space to empathize parameter order. This will also throw if the number of arguments to the invocation doesn't match the number of given parameters.
Example:
- Exceptions
-
std::bad_cast
| void autobahn::wamp_call_result::get_kw_arguments | ( | Map & | kw_args | ) | const |
Convert and assign the keyword arguments returned from the call to the given kw_args map.
Example:
- Exceptions
-
std::bad_cast
| T autobahn::wamp_call_result::kw_argument | ( | const std::string & | key | ) | const |
The keyword argument returned from the call with the given key, converted to type T.
Overloads are provided for std::string and char* as key type.
This function uses key string comparisons to find the matching value, O(n) with n being the number of map elements. Memory allocation for keys is avoided though. For larger maps, you might want to prioritize look-up performance by using std::map, std::unordered_map or custom types with custom deserialization. To do this, use kw_arguments<Map>() or get_kw_arguments<Map>(map), then access the items from there.
Example: std::string id = result.kw_argument<std::string>("id");
- Exceptions
-
std::out_of_range std::bad_cast
| T autobahn::wamp_call_result::kw_argument_or | ( | const std::string & | key, |
| const T & | fallback | ||
| ) | const |
The keyword argument returned from the call with the given key, converted to type T, or the given fallback if no such key was passed.
Overloads are provided for std::string and char* as key type.
This function uses key string comparisons to find the matching value, O(n) with n being the number of map elements. Memory allocation for keys is avoided though. For larger maps, you might want to prioritize look-up performance by using std::map, std::unordered_map or custom types with custom deserialization. To do this, use kw_arguments<Map>() or get_kw_arguments<Map>(map), then access the items from there.
Example: std::string id = result.kw_argument_or("id", std::string());
- Exceptions
-
std::bad_cast
| Map autobahn::wamp_call_result::kw_arguments | ( | ) | const |
The keyword arguments returned from the call, converted to a map type.
Example: auto kw_args = result.kw_arguments<std::unordered_map<std::string, msgpack::object>>();
- Exceptions
-
std::bad_cast

1.8.11