inline std::vector<msgpack::object> wamp_publish_message::marshal() const
{
    std::vector<msgpack::object> fields;

    if (!m_arguments_kw.is_nil()) {
        if (!m_arguments.is_nil()) {
            fields = { m_type, m_request_id, m_options, m_topic, m_arguments, m_arguments_kw };
        } else {
            fields = { m_type, m_request_id, m_options, m_topic, msgpack_empty_map(), m_arguments_kw };
        }
    } else if (!m_arguments.is_nil()) {
        fields = { m_type, m_request_id, m_options, m_topic, m_arguments };
    } else {
        fields = { m_type, m_request_id, m_options, m_topic };
    }

    return fields;
}
Example #2
0
inline std::vector<msgpack::object> wamp_event_message::marshal() const
{
    std::vector<msgpack::object> fields;

    if (!m_arguments_kw.is_nil()) {
        if (!m_arguments.is_nil()) {
            fields = { m_type, m_subscription_id, m_publication_id, m_details,
                    m_arguments, m_arguments_kw };
        } else {
            fields = { m_type, m_subscription_id, m_publication_id, m_details,
                    msgpack_empty_map(), m_arguments_kw };
        }
    } else if (!m_arguments.is_nil()) {
        fields = { m_type, m_subscription_id, m_publication_id, m_details, m_arguments };
    } else {
        fields = { m_type, m_subscription_id, m_publication_id, m_details };
    }

    return fields;
}
Example #3
0
 std::optional<T> operator()(msgpack::object const& o) const {
     if(o.is_nil()) return std::nullopt;
     return o.as<T>();
 }