Skip to content

Commit

Permalink
Expose details within invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mullen authored and Jim Mullen committed Feb 9, 2017
1 parent f8a6de2 commit 5643c9b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ ipch/
*.opensdf
*.sdf
*.cachefile

# IntelliJ/Clion
.idea/
cmake-build-*/
24 changes: 24 additions & 0 deletions autobahn/wamp_invocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,29 @@ class wamp_invocation_impl
template <typename Map>
void get_kw_arguments(Map& kw_args) const;

/*!
* The details field of the invocation, converted to a map type.
*
* @tparam Map The map type.
*
* @return A Map type populated with the details of the invocation.
*
* @throw std::bad_cast
*/
template <typename Map>
Map details() const;

/*!
* Convert and assign the keyword arguments to the given @p details.
*
* @tparam Map The map type.
*
* @param details A reference to a Map type object to receive the
* invocation details.
*/
template <typename Map>
void get_details(Map& details) const;

/*!
* Checks if caller expects progressive results.
*/
Expand Down Expand Up @@ -274,6 +297,7 @@ class wamp_invocation_impl

msgpack::zone m_zone;
msgpack::object m_arguments;
msgpack::object m_details;
msgpack::object m_kw_arguments;
send_result_fn m_send_result_fn;
std::uint64_t m_request_id;
Expand Down
13 changes: 13 additions & 0 deletions autobahn/wamp_invocation.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ inline void wamp_invocation_impl::get_kw_arguments(Map& kw_args) const
m_kw_arguments.convert(kw_args);
}

template <typename Map>
inline Map wamp_invocation_impl::details() const
{
return m_details.as<Map>();
}

template <typename Map>
inline void wamp_invocation_impl::get_details(Map& details) const
{
m_details.convert(details);
}

inline bool wamp_invocation_impl::progressive_results_expected() const
{
return m_progressive_results_expected;
Expand Down Expand Up @@ -347,6 +359,7 @@ inline void wamp_invocation_impl::set_details(const msgpack::object& details)
{
m_uri = value_for_key_or<std::string>(details, "procedure", std::string());
m_progressive_results_expected = value_for_key_or<bool>(details, "receive_progress", false);
m_details = details;
}

inline void wamp_invocation_impl::set_request_id(std::uint64_t request_id)
Expand Down

0 comments on commit 5643c9b

Please sign in to comment.