object.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002  * \file
00003  *
00004  * $Id:$
00005  *
00006  * Copyright (C) Brno University of Technology (BUT)
00007  *
00008  * This file is part of software developed by dcgm-robotics@FIT group.
00009  *
00010  * Author: Jan Gorig (xgorig01@stud.fit.vutbr.cz)
00011  * Supervised by: Michal Spanel (spanel@fit.vutbr.cz)
00012  * Date: 12/04/2012
00013  *
00014  * This file is free software: you can redistribute it and/or modify
00015  * it under the terms of the GNU Lesser General Public License as published by
00016  * the Free Software Foundation, either version 3 of the License, or
00017  * (at your option) any later version.
00018  *
00019  * This file is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU Lesser General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this file.  If not, see <http://www.gnu.org/licenses/>.
00026  */
00027 
00028 #include <srs_env_model/but_server/objtree/node.h>
00029 #include <srs_env_model/but_server/objtree/object.h>
00030 
00031 namespace objtree
00032 {
00033 
00037 Object::Object()
00038 {
00039     m_id = -1;
00040 #if HISTORY_ENABLED
00041     m_history = NULL;
00042 #endif
00043 }
00044 
00049 Object::~Object()
00050 {
00051     for(std::list<Node*>::iterator i = m_inNodes.begin(); i != m_inNodes.end(); i++)
00052     {
00053         (*i)->removeObject(this);
00054     }
00055 
00056 #if HISTORY_ENABLED
00057     if(m_history)
00058     {
00059         delete m_history;
00060     }
00061 #endif
00062 }
00063 
00068 Object::Type Object::type() const
00069 {
00070     return m_type;
00071 }
00072 
00077 void Object::setId(unsigned int id)
00078 {
00079     m_id = id;
00080 }
00081 
00086 bool Object::hasId() const
00087 {
00088     return m_id != (unsigned int)-1;
00089 }
00090 
00095 unsigned int Object::id() const
00096 {
00097     return m_id;
00098 }
00099 
00104 void Object::newNode(Node *node)
00105 {
00106     m_inNodes.push_back(node);
00107 }
00108 
00113 void Object::removeNode(Node *node)
00114 {
00115     m_inNodes.remove(node);
00116 }
00117 
00122 unsigned int Object::inNodesCount() const
00123 {
00124     return m_inNodes.size();
00125 }
00126 
00127 }


srs_env_model
Author(s): Vit Stancl (stancl@fit.vutbr.cz), Tomas Lokaj, Jan Gorig, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Mon Oct 6 2014 08:05:05