Go to the documentation of this file.
7 #ifndef NLOHMANN_PARSERS_H
8 #define NLOHMANN_PARSERS_H
21 const std::string& stamp_fieldname)
23 , _use_message_stamp(use_msg_stamp)
24 , _stamp_fieldname(stamp_fieldname)
29 bool parseMessageImpl(
double& timestamp);
40 const std::string& stamp_fieldname)
45 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
52 const std::string& stamp_fieldname)
57 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
64 const std::string& stamp_fieldname)
69 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
76 bool use_msg_stamp,
const std::string& stamp_fieldname)
81 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
87 #include <QVBoxLayout>
97 QGroupBox::setCheckable(
true);
98 QGroupBox::setChecked(
false);
99 lineedit =
new QLineEdit(
this);
100 QVBoxLayout* vbox =
new QVBoxLayout;
101 vbox->addSpacing(20);
102 vbox->addWidget(lineedit);
103 QGroupBox::setLayout(vbox);
107 qDebug() <<
"Destroying QCheckBoxClose";
116 _encoding = encoding;
117 _checkbox_use_timestamp =
new QCheckBoxClose(
"use field as timestamp if available");
121 template <
typename ParserT>
126 std::string timestamp_name = _checkbox_use_timestamp->lineedit->text().toStdString();
127 return std::make_shared<ParserT>(
128 topic_name,
data, _checkbox_use_timestamp->isChecked(), timestamp_name);
135 return _checkbox_use_timestamp;
146 QString prefix = QString(
"NlohmannParser.") + QString(encoding());
147 bool checked = settings.value(prefix +
".timestampEnabled",
false).toBool();
148 QString
field = settings.value(prefix +
".timestampFieldName",
"").toString();
150 _checkbox_use_timestamp->setChecked(checked);
151 _checkbox_use_timestamp->lineedit->setText(
field);
157 QString prefix = QString(
"NlohmannParser.") + QString(encoding());
158 settings.setValue(prefix +
".timestampEnabled", _checkbox_use_timestamp->isChecked());
159 settings.setValue(prefix +
".timestampFieldName",
160 _checkbox_use_timestamp->lineedit->text());
180 return createParserImpl<JSON_Parser>(topic_name,
data);
182 const char*
name()
const override
184 return "JSON_ParserFactory";
198 return createParserImpl<CBOR_Parser>(topic_name,
data);
200 const char*
name()
const override
202 return "CBOR_ParserFactory";
216 return createParserImpl<BSON_Parser>(topic_name,
data);
218 const char*
name()
const override
220 return "BSON_ParserFactory";
234 return createParserImpl<MessagePack_Parser>(topic_name,
data);
236 const char*
name()
const override
238 return "MessagePack_ParserFactory";
242 #endif // NLOHMANN_PARSERS_H
std::shared_ptr< MessageParser > MessageParserPtr
virtual void saveSettings()
const char * name() const override
Name of the plugin type, NOT the particular instance.
MessageParserPtr createParser(const std::string &topic_name, const std::string &, const std::string &, PlotDataMapRef &data) override
BSON_Parser(const std::string &topic_name, PlotDataMapRef &data, bool use_msg_stamp, const std::string &stamp_fieldname)
MessagePack_ParserFactory()
MessageParserPtr createParserImpl(const std::string &topic_name, PlotDataMapRef &data)
QCheckBoxClose * _checkbox_use_timestamp
MessageParserPtr createParser(const std::string &topic_name, const std::string &, const std::string &, PlotDataMapRef &data) override
virtual void loadSettings()
~QCheckBoxClose() override
const char * name() const override
Name of the plugin type, NOT the particular instance.
virtual QWidget * optionsWidget()
optionsWidget pointer to a persistent widget used to set the plugin options .
The MessageParser is the base class used to parse a message with a specific encoding+schema.
QCheckBoxClose(QString text)
MessagePack_Parser(const std::string &topic_name, PlotDataMapRef &data, bool use_msg_stamp, const std::string &stamp_fieldname)
JSON_Parser(const std::string &topic_name, PlotDataMapRef &data, bool use_msg_stamp, const std::string &stamp_fieldname)
NlohmannParser(const std::string &topic_name, PlotDataMapRef &data, bool use_msg_stamp, const std::string &stamp_fieldname)
const char * name() const override
Name of the plugin type, NOT the particular instance.
MessageParserPtr createParser(const std::string &topic_name, const std::string &, const std::string &, PlotDataMapRef &data) override
a class to store JSON values
const char * name() const override
Name of the plugin type, NOT the particular instance.
CBOR_Parser(const std::string &topic_name, PlotDataMapRef &data, bool use_msg_stamp, const std::string &stamp_fieldname)
static void field(LexState *ls, ConsControl *cc)
MessageParserPtr createParser(const std::string &topic_name, const std::string &, const std::string &, PlotDataMapRef &data) override
NlohmannParserCreator(const char *encoding)
std::string _stamp_fieldname
const char * encoding() const override
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45