23 #ifndef VARIANT_TOPIC_TOOLS_MESSAGE_FIELD_COLLECTION_H 24 #define VARIANT_TOPIC_TOOLS_MESSAGE_FIELD_COLLECTION_H 28 #include <boost/unordered_map.hpp> 37 template <
typename T>
class MessageFieldCollection {
58 MessageField<T>&
getField(
int index);
63 const MessageField<T>&
getField(
int index)
const;
68 MessageField<T>&
getField(
const std::string& name);
73 const MessageField<T>&
getField(
const std::string& name)
const;
78 bool hasField(
const std::string& name)
const;
91 void appendField(
const std::string& name,
const T& value = T());
96 void merge(
const MessageFieldCollection<T>& collection);
100 virtual void clear();
104 virtual void write(std::ostream& stream,
const std::string& indent =
105 std::string())
const;
115 const MessageField<T>&
operator[](
int index)
const;
120 MessageField<T>&
operator[](
const std::string& name);
125 const MessageField<T>&
operator[](
const std::string& name)
const;
129 MessageFieldCollection<T>&
operator+=(
const MessageField<T>& field);
134 bool operator==(
const MessageFieldCollection<T>& collection)
const;
139 bool operator!=(
const MessageFieldCollection<T>& collection)
const;
166 bool hasField(
const std::string& name,
size_t pos)
const;
171 template <
typename T> std::ostream&
operator<<(std::ostream& stream,
175 #include <variant_topic_tools/MessageFieldCollection.tpp>
Header file providing forward declarations for the variant topic tools.