ros2_parser.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <QCheckBox>
6 #include <QDebug>
7 #include <string>
8 
10 #include "ros_parser.h"
11 #include "PlotJuggler/fmt/format.h"
12 
13 using namespace PJ;
14 
16 {
17  Q_OBJECT
18  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.ParserFactoryPlugin")
19  Q_INTERFACES(PJ::ParserFactoryPlugin)
20 
21 public:
22  ParserFactoryROS2() = default;
23 
24  const char* name() const override
25  {
26  return "ParserFactoryROS2";
27  }
28  const char* encoding() const override
29  {
30  return "cdr";
31  }
32 
33  MessageParserPtr createParser(const std::string& topic_name,
34  const std::string& type_name,
35  const std::string& schema,
36  PlotDataMapRef& data) override
37  {
38  if(schema.empty())
39  {
40  throw std::runtime_error("ParserFactoryROS2 requires a schema (message definition)");
41  }
42  std::string msg_type = QString::fromStdString(type_name).replace("/msg/", "/").toStdString();
43 
44  return std::make_shared<ParserROS>(topic_name, msg_type, schema,
46  }
47 };
48 
49 
50 
FastCDR_Deserializer ROS2_Deserializer
const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: ros2_parser.h:24
std::shared_ptr< MessageParser > MessageParserPtr
std::string type_name(lua_State *L, type t)
Definition: sol.hpp:8079
MessageParserPtr createParser(const std::string &topic_name, const std::string &type_name, const std::string &schema, PlotDataMapRef &data) override
Definition: ros2_parser.h:33
def msg_type(f)
dictionary data
Definition: mqtt_test.py:22
Definition: format.h:895
const char * encoding() const override
Definition: ros2_parser.h:28


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:39