MessageMember.cpp
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 
24 namespace variant_topic_tools {
25 
26 /*****************************************************************************/
27 /* Constructors and Destructor */
28 /*****************************************************************************/
29 
31 }
32 
34  impl(src.impl) {
35 }
36 
38 }
39 
40 MessageMember::Impl::Impl(const std::string& name) :
41  name(name) {
42 }
43 
45 }
46 
47 /*****************************************************************************/
48 /* Accessors */
49 /*****************************************************************************/
50 
51 const std::string& MessageMember::getName() const {
52  if (!impl) {
53  static std::string name;
54  return name;
55  }
56  else
57  return impl->name;
58 }
59 
61  if (!impl) {
62  static DataType type;
63  return type;
64  }
65  else
66  return impl->getType();
67 }
68 
70  if (impl)
71  return boost::dynamic_pointer_cast<MessageVariable::Impl>(impl) != nullptr;
72  else
73  return false;
74 }
75 
77  if (impl)
78  return boost::dynamic_pointer_cast<MessageConstant::Impl>(impl) != nullptr;
79  else
80  return false;
81 }
82 
83 bool MessageMember::isValid() const {
84  return impl != nullptr;
85 }
86 
87 /*****************************************************************************/
88 /* Methods */
89 /*****************************************************************************/
90 
91 void MessageMember::write(std::ostream& stream) const {
92  if (impl)
93  impl->write(stream);
94 }
95 
96 /*****************************************************************************/
97 /* Operators */
98 /*****************************************************************************/
99 
100 std::ostream& operator<<(std::ostream& stream, const MessageMember&
101  messageMember) {
102  messageMember.write(stream);
103  return stream;
104 }
105 
106 }
Header file providing the DataType class interface.
Impl(const std::string &name)
Constructor.
Header file providing the MessageMember class interface.
Message variable implementation.
std::string name
The name of this message member.
Message constant implementation.
ImplPtr impl
The message member&#39;s implementation.
MessageMember()
Default constructor.
const std::string & getName() const
Retrieve the name of this message member.
std::ostream & operator<<(std::ostream &stream, const DataType &dataType)
Operator for writing the data type to a stream.
Definition: DataType.cpp:190
bool isVariable() const
True, if this message member is a variable member.
Header file providing the MessageConstant class interface.
bool isValid() const
True, if this message member is valid.
const DataType & getType() const
Retrieve the type of this message member.
void write(std::ostream &stream) const
Write the message member to a stream.
Header file providing the MessageVariable class interface.
bool isConstant() const
True, if this message member is a constant member.


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