MessageVariable.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2014 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00019 #include "variant_topic_tools/Exceptions.h"
00020 #include "variant_topic_tools/MessageVariable.h"
00021 
00022 namespace variant_topic_tools {
00023 
00024 /*****************************************************************************/
00025 /* Constructors and Destructor                                               */
00026 /*****************************************************************************/
00027 
00028 MessageVariable::MessageVariable() {
00029 }
00030 
00031 MessageVariable::MessageVariable(const std::string& name, const DataType&
00032     type) {
00033   impl.reset(new Impl(name, type));
00034 }
00035 
00036 MessageVariable::MessageVariable(const MessageVariable& src) :
00037   MessageMember(src) {
00038 }
00039 
00040 MessageVariable::MessageVariable(const MessageMember& src) :
00041   MessageMember(src) {
00042   if (impl)
00043     BOOST_ASSERT(boost::dynamic_pointer_cast<MessageVariable::Impl>(impl));
00044 }
00045 
00046 MessageVariable::~MessageVariable() {
00047 }
00048 
00049 MessageVariable::Impl::Impl(const std::string& name, const DataType& type) :
00050   MessageMember::Impl(name),
00051   type(type) {
00052   if (!type.isValid())
00053     throw InvalidDataTypeException();
00054 }
00055 
00056 MessageVariable::Impl::~Impl() {
00057 }
00058 
00059 /*****************************************************************************/
00060 /* Accessors                                                                 */
00061 /*****************************************************************************/
00062 
00063 const DataType& MessageVariable::Impl::getType() const {
00064   return type;
00065 }
00066 
00067 /*****************************************************************************/
00068 /* Methods                                                                   */
00069 /*****************************************************************************/
00070 
00071 void MessageVariable::Impl::write(std::ostream& stream) const {
00072   stream << type << " " << name;
00073 }
00074 
00075 }


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Tue Jul 9 2019 03:18:42