MessageHeader.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2014 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
23 #ifndef VARIANT_TOPIC_TOOLS_MESSAGE_HEADER_H
24 #define VARIANT_TOPIC_TOOLS_MESSAGE_HEADER_H
25 
26 #include <ros/ros.h>
27 
29 
30 namespace variant_topic_tools {
33  class MessageHeader {
34  friend class Message;
36  public:
39  MessageHeader();
40 
43  MessageHeader(const MessageHeader& src);
44 
48 
51  void setField(const std::string& name, const std::string& value);
52 
55  const std::string& getField(const std::string& name) const;
56 
59  void setPublisher(const std::string& publisher);
60 
63  const std::string& getPublisher() const;
64 
67  void setTopic(const std::string& topic);
68 
71  const std::string& getTopic() const;
72 
76  void setLatched(bool latched);
77 
80  bool isLatched() const;
81 
85  bool hasField(const std::string& name) const;
86 
90  std::string& operator[](const std::string& name);
91 
95  const std::string& operator[](const std::string& name) const;
96 
97  protected:
100  typedef std::map<std::string, std::string> Fields;
101 
105 
108  FieldsPtr fields;
109 
112  MessageHeader(const FieldsPtr& fields);
113  };
114 };
115 
116 #endif
boost::shared_ptr< std::map< std::string, std::string > > FieldsPtr
Definition of the fields pointer type.
std::map< std::string, std::string > Fields
Definition of the fields type.
Generic message type.
Definition: Message.h:43
bool isLatched() const
True, if the message publication is latched.
Header file providing forward declarations for the variant topic tools.
variant_topic_tools::Publisher publisher
Definition: publish.cpp:25
const std::string & getPublisher() const
Retrieve the name of the publishing node.
const std::string & getField(const std::string &name) const
Retrieve a field of the message header.
void setTopic(const std::string &topic)
Set the message publishing topic.
void setPublisher(const std::string &publisher)
Set the name of the publishing node.
void setField(const std::string &name, const std::string &value)
Set a field of the message header.
std::string & operator[](const std::string &name)
Operator for retrieving a field of the message header (non-const version)
void setLatched(bool latched)
Set to true to indicate that the message publication is latched.
const std::string & getTopic() const
Retrieve the message publishing topic.
bool hasField(const std::string &name) const
True, if the message header contains a field with the specified name.
Variant message header.
Definition: MessageHeader.h:33
FieldsPtr fields
The fields of the message header.
MessageHeader()
Default constructor.


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:49