Неизвестный тип, полученный в функции void

#c #types #mqtt #document #rapidjson

#c #типы #mqtt #документ #rapidjson

Вопрос:

Я получаю аргумент pr , и при печати его тип отображается St10shared_ptrIKN4mqtt7messageEE . Вы знаете, какой это тип? Я хочу получить аргумент типа mqtt.

cpp

 #define RAPIDJSON_HAS_STDSTRING 1
#include <boost/units/cmath.hpp>
#include <boost/units/systems/si/prefixes.hpp>
#include <chrono>
#include <exception>
#include <functional>
#include <iostream>
#include <INTEGER.h>
#include <fstream>
#include <string>

#include <rapidjson/document.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/istreamwrapper.h>
#include <rapidjson/ostreamwrapper.h>


using namespace rapidjson;
Document doc; 


void MqttApplication::mqttReceive()
  

{

 try {
    cout << "subscribing to topics..." << endl;
    mqttClient->start_consuming();
    mqttClient->subscribe(TOPIC, QOS)->wait();
    cout << "...OK" << endl;
}
catch (const mqtt::exceptionamp; exc) {
    cerr << exc.what() << endl;
    return;
}

while (true) {
    auto msg = mqttClient->consume_message();
    if (!msg) {
        if (!mqttClient->is_connected()) {
            cout << "lost connection" << endl;
            if (mqttTryReconnect(*mqttClient)) {
                mqttClient->subscribe(TOPIC, QOS);
                cout << "application reconnected" << endl;
                continue;
            }
            else {
                cout << "application reconnect failed." << endl;
            }
        }
        else {
            cout << "error occurred." << endl;
        }
        break;
    }

    try {
        send(mqttClient->consume_message());
    }
    catch (const mqtt::exceptionamp; exc) {
        cerr << exc.what() << endl;
        return;
    }

    if (msg->get_topic() == "command" amp;amp; msg->to_string() == "exit") {
        cout << "Exit command received" << endl;
        break;
    }

    cout << msg->get_topic() << ": " << msg->to_string() << endl;
}
}

void MqttApplication::send(const mqtt::const_message_ptramp; pr)
{

if (pr)
{
    cout <<  typeid(pr).name()  << endl;
}

}
  

hpp

 void send(const mqtt::const_message_ptramp; pr);
  

Я получаю эту печать:

  socktap-mqtt: /usr/include/rapidjson/document.h:1154: rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::FindMember(const rapidjson::GenericValue<Encoding, SourceAllocator>amp;) [with SourceAllocator = rapidjson::MemoryPoolAllocator<>; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; rapidjson::GenericValue<Encoding, Allocator>::MemberIterator = rapidjson::GenericMemberIterator<false, rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >]: Assertion `IsObject()' failed.
Aborted
  

Спасибо

Комментарии:

1. Похоже на искаженное название для std::shared_ptr<mqtt::message>

2. решено! я мог бы получить контент, выполнив pr->to_string() . Однако выполнение прерывается, как указано выше, есть какие-либо подсказки?