Go to the documentation of this file.00001 #ifndef INTROSPECTIONPARSER_H
00002 #define INTROSPECTIONPARSER_H
00003
00004 #include "ros_parser_base.h"
00005 #include <ros_type_introspection/ros_introspection.hpp>
00006
00007 class RosMessageParser : public RosParserBase
00008 {
00009 public:
00010 RosMessageParser();
00011
00012 void clear();
00013
00014 void setMaxArrayPolicy(size_t max_array_size,
00015 bool discard_entire_array);
00016
00017 void addRules( const RosIntrospection::SubstitutionRuleMap& rules)
00018 {
00019 for(const auto& it: rules)
00020 {
00021 _introspection_parser->registerRenamingRules(
00022 RosIntrospection::ROSType(it.first) ,
00023 it.second );
00024 }
00025 }
00026
00027 bool registerSchema(const std::string& topic_name,
00028 const std::string& md5sum,
00029 RosIntrospection::ROSType type,
00030 const std::string& definition);
00031
00032 virtual const std::unordered_set<std::string>& getCompatibleKeys() const override
00033 {
00034 return _registered_md5sum;
00035 }
00036
00037
00038 void pushMessageRef(const std::string& topic_name,
00039 const MessageRef& msg,
00040 double timestamp) override;
00041
00042 void showWarnings();
00043
00044 virtual void extractData(PlotDataMapRef& destination,
00045 const std::string& prefix) override;
00046
00047 typedef std::unordered_map<std::string, std::unique_ptr<RosParserBase> > ParsersMap;
00048
00049 private:
00050 std::unordered_set<std::string> _registered_md5sum;
00051 std::unique_ptr<RosIntrospection::Parser> _introspection_parser;
00052 PlotDataMapRef _plot_map;
00053
00054 ParsersMap _builtin_parsers;
00055
00056 uint32_t _max_array_size;
00057 bool _warnings_enabled;
00058 bool _discard_large_array;
00059
00060 std::unordered_set<std::string> _warn_cancellation;
00061 std::unordered_set<std::string> _warn_max_arraysize;
00062
00063 double extractRealValue( const RosIntrospection::Variant& value,
00064 const std::string& item_name);
00065 };
00066
00067 #endif // INTROSPECTIONPARSER_H