MessageVariable.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 
21 
22 namespace variant_topic_tools {
23 
24 /*****************************************************************************/
25 /* Constructors and Destructor */
26 /*****************************************************************************/
27 
29 }
30 
31 MessageVariable::MessageVariable(const std::string& name, const DataType&
32  type) {
33  impl.reset(new Impl(name, type));
34 }
35 
37  MessageMember(src) {
38 }
39 
41  MessageMember(src) {
42  if (impl)
43  BOOST_ASSERT(boost::dynamic_pointer_cast<MessageVariable::Impl>(impl));
44 }
45 
47 }
48 
49 MessageVariable::Impl::Impl(const std::string& name, const DataType& type) :
50  MessageMember::Impl(name),
51  type(type) {
52  if (!type.isValid())
54 }
55 
57 }
58 
59 /*****************************************************************************/
60 /* Accessors */
61 /*****************************************************************************/
62 
64  return type;
65 }
66 
67 /*****************************************************************************/
68 /* Methods */
69 /*****************************************************************************/
70 
71 void MessageVariable::Impl::write(std::ostream& stream) const {
72  stream << type << " " << name;
73 }
74 
75 }
DataType type
The data type of this message variable.
MessageVariable()
Default constructor.
Exception thrown in case of an invalid data type.
Definition: Exceptions.h:51
Message variable implementation.
std::string name
The name of this message member.
const DataType & getType() const
Retrieve the type of this message member (implementation)
Impl(const std::string &name, const DataType &type)
Constructor.
ImplPtr impl
The message member&#39;s implementation.
bool isValid() const
True, if this data type is valid.
Definition: DataType.cpp:133
Header file defining exceptions for the variant topic tools.
void write(std::ostream &stream) const
Write the message member to a stream (implementation)
Header file providing the MessageVariable class interface.


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