MessageConstant.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_CONSTANT_H
24 #define VARIANT_TOPIC_TOOLS_MESSAGE_CONSTANT_H
25 
28 
29 namespace variant_topic_tools {
33  public MessageMember {
34  friend class MessageDataType;
35  friend class MessageMember;
36  public:
40 
43  MessageConstant(const MessageConstant& src);
44 
47  MessageConstant(const MessageMember& src);
48 
52 
55  const Variant& getValue() const;
56 
57  protected:
60  class Impl :
61  public MessageMember::Impl {
62  public:
65  Impl(const std::string& name, const Variant& value);
66 
69  virtual ~Impl();
70 
73  const DataType& getType() const;
74 
77  void write(std::ostream& stream) const;
78 
82  };
83 
87  MessageConstant(const std::string& name, const Variant& value);
88 
92  MessageConstant(const std::string& name, const DataType& type,
93  const std::string& value);
94 
97  template <typename T> static MessageConstant create(const std::string&
98  name, const T& value);
99  };
100 };
101 
102 #include <variant_topic_tools/MessageConstant.tpp>
103 
104 #endif
static MessageConstant create(const std::string &name, const T &value)
Create a message constant.
void write(std::ostream &stream) const
Write the message member to a stream (implementation)
Header file providing the MessageMember class interface.
std::string name
The name of this message member.
Header file providing the Variant class interface.
Message constant implementation.
Variant value
The value of this message constant.
const Variant & getValue() const
Retrieve the value of this message constant.
Impl(const std::string &name, const Variant &value)
Constructor.
const DataType & getType() const
Retrieve the type of this message member (implementation)
Message member implementation.
Definition: MessageMember.h:79
MessageConstant()
Default constructor.


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