MessageDefinition.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_H
00024 #define VARIANT_TOPIC_TOOLS_MESSAGE_DEFINITION_H
00025 
00026 #include <iostream>
00027 
00028 #include <boost/enable_shared_from_this.hpp>
00029 
00030 #include <ros/ros.h>
00031 
00032 #include <variant_topic_tools/DataType.h>
00033 #include <variant_topic_tools/Forwards.h>
00034 #include <variant_topic_tools/MessageField.h>
00035 #include <variant_topic_tools/MessageFieldCollection.h>
00036 #include <variant_topic_tools/MessageType.h>
00037 
00038 namespace variant_topic_tools {
00041   class MessageDefinition :
00042     public MessageFieldCollection<DataType>,
00043     public boost::enable_shared_from_this<MessageDefinition> {
00044   public:
00047     MessageDefinition();
00048     
00051     MessageDefinition(const MessageType& messageType);
00052     
00055     MessageDefinition(const MessageDataType& messageDataType);
00056     
00059     MessageDefinition(const MessageDefinition& src);
00060     
00063     ~MessageDefinition();
00064     
00068     void setMessageType(const MessageType& messageType);
00069     
00073     template <typename T> void setMessageType();
00074     
00078     void setMessageDataType(const MessageDataType& messageDataType);
00079     
00083     MessageDataType getMessageDataType() const;
00084     
00087     bool isValid() const;
00088     
00091     template <typename T> static MessageDefinition create();
00092     
00096     void load(const std::string& messageDataType);
00097     
00100     void clear();
00101     
00104     void write(std::ostream& stream) const;
00105     
00106   protected:
00109     DataType messageDataType;
00110     
00113     void fill(const MessageDataType& currentDataType,
00114       MessageFieldCollection<DataType>& currentCollection);    
00115   };
00116   
00119   std::ostream& operator<<(std::ostream& stream, const MessageDefinition&
00120     messageDefinition);
00121 };
00122 
00123 #include <variant_topic_tools/MessageDefinition.tpp>
00124 
00125 #endif


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Fri Aug 5 2016 06:06:27