Class.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 /************************************************************************
00020                         Class.cpp - Copyright klank
00021 
00022 
00023 **************************************************************************/
00024 
00025 #include "Class.h"
00026 #include "XMLTag.h"
00027 
00028 
00029 using namespace cop;
00030 
00031 
00032 // Constructors/Destructors
00033 //
00034 
00035 Class::Class ( ) :
00036 Elem()
00037 {
00038 }
00039 
00040 Class::Class(std::string name, int id) :
00041   Elem(id),
00042   m_name(name)
00043 {
00044   if(name.length() == 0)
00045   {
00046     ROS_WARN("Creating Empty Class with empty name\n");
00047     throw "Error Building Classes";
00048   }
00049 
00050 }
00051 
00052 
00053 void Class::SetData (XMLTag* tag)
00054 {
00055   Elem::SetData(tag);
00056   if(tag == NULL)
00057   {
00058     throw "Error loading class";
00059   }
00060   m_name = tag->GetProperty(XML_ATTRIBUTE_CLASSNAME);
00061   if(m_name.length() == 0)
00062   {
00063     ROS_WARN("Creating Empty Class from xml\n");
00064     throw "Error Building Classes";
00065   }
00066 
00067 }
00068 
00069 
00070 Class::~Class ( ) { }
00071 
00072 //
00073 // Methods
00074 //
00075 
00076 void Class::SaveTo(XMLTag* tag)
00077 {
00078         tag->AddProperty(XML_ATTRIBUTE_CLASSNAME, m_name);
00079 }
00080 
00081 
00082 void Class::SetName(std::string name)
00083 {
00084         m_name = name;
00085 }
00086 
00087 Elem* Class::Duplicate(bool)
00088 {
00089   Class* copy = new Class(m_name, m_ID);
00090   return copy;
00091 } 
00092 
00093 // Accessor methods
00094 //
00095 
00096 
00097 // Other methods
00098 //
00099 
00100 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:34