MessageDefinitionParser.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2014 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00023 #ifndef VARIANT_TOPIC_TOOLS_MESSAGE_DEFINITION_PARSER_H
00024 #define VARIANT_TOPIC_TOOLS_MESSAGE_DEFINITION_PARSER_H
00025 
00026 #include <vector>
00027 
00028 #include <boost/regex.hpp>
00029 
00030 #include <ros/ros.h>
00031 
00032 #include <variant_topic_tools/MessageType.h>
00033 
00034 namespace variant_topic_tools {
00037   class MessageDefinitionParser {
00038   public:
00041     static size_t parse(const std::string& messageDataType, const std::string&
00042       messageDefinition, std::vector<MessageType>& messageTypes);
00043         
00046     static bool matchType(const std::string& expression);
00047     
00050     static bool matchArrayType(const std::string& expression, std::string&
00051       memberType, size_t& size);
00052     
00055     static bool match(const std::string& expression, std::string& name,
00056       std::string& type);
00057     
00060     static bool matchConstant(const std::string& expression, std::string&
00061       name, std::string& type, std::string& value);
00062     
00065     static bool matchVariable(const std::string& expression, std::string&
00066       name, std::string& type);
00067     
00070     static bool matchArray(const std::string& expression, std::string& name,
00071       std::string& memberType, size_t& size);
00072   
00075     static bool matchSeparator(const std::string& expression);
00076     
00077   private:
00080     static const boost::regex commentExpression;
00081     
00084     static const boost::regex separatorExpression;
00085     
00088     static const boost::regex messageTypeExpression;
00089     
00092     static const boost::regex memberNameExpression;
00093     
00096     static const boost::regex memberTypeExpression;
00097     
00100     static const boost::regex memberArrayTypeExpression;
00101     
00104     static const boost::regex memberValueExpression;
00105     
00108     static const boost::regex memberExpression;
00109     
00112     static const boost::regex constantMemberExpression;
00113     
00117     static const boost::regex constantStringMemberExpression;
00118     
00121     static const boost::regex variableMemberExpression;
00122     
00125     static const boost::regex arrayMemberExpression;
00126     
00129     MessageDefinitionParser();
00130     
00133     ~MessageDefinitionParser();    
00134   };  
00135 };
00136 
00137 #endif


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Tue Jul 9 2019 03:18:42