Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

objectstate.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2004 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: objectstate.cpp,v 1.3 2004/04/08 14:32:30 markelic Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #include "objectstate.h"
00023 #include <soccer/soccerbase/soccerbase.h>
00024 
00025 using namespace oxygen;
00026 
00027 ObjectState::ObjectState() : BaseNode()
00028 {
00029 }
00030 
00031 ObjectState::~ObjectState()
00032 {
00033 }
00034 
00035 void
00036 ObjectState::SetPerceptName(const std::string& name, TPerceptType pt)
00037 {
00038     mPerceptNames[pt] = name;
00039 }
00040 
00041 void
00042 ObjectState::SetPerceptName(const std::string& name, TPerceptType pt1, TPerceptType pt2)
00043 {
00044     mPerceptNames[pt1] = "Player";
00045     mPerceptNames[pt2] = name;
00046  
00047 }
00048 
00049 
00050 
00051 std::string
00052 ObjectState::GetPerceptName(TPerceptType pt) const
00053 {
00054     TPerceptStringMap::const_iterator i = mPerceptNames.find(pt);
00055     if (i == mPerceptNames.end())
00056         return std::string();
00057 
00058     return i->second;
00059 }
00060 
00061 void
00062 ObjectState::SetID(const std::string& id, TPerceptType pt)
00063 {
00064     mIDs[pt] = id;
00065 }
00066 
00067 std::string
00068 ObjectState::GetID(TPerceptType pt) const
00069 {
00070     TPerceptStringMap::const_iterator i = mIDs.find(pt);
00071     if (i == mIDs.end())
00072         return std::string();
00073 
00074     return i->second;
00075 }
00076 
00077 boost::shared_ptr<oxygen::Transform>
00078 ObjectState::GetTransformParent() const
00079 {
00080     return mTransformParent;
00081 }
00082 
00083 void
00084 ObjectState::OnLink()
00085 {
00086     BaseNode::OnLink();
00087     SoccerBase::GetTransformParent(*this,mTransformParent);
00088 }
00089 
00090 void
00091 ObjectState::OnUnlink()
00092 {
00093     BaseNode::OnUnlink();
00094     mTransformParent.reset();
00095 }

Generated on Thu Apr 6 15:25:39 2006 for rcssserver3d by  doxygen 1.4.4