From: Markus R. <rol...@us...> - 2007-02-18 12:55:16
|
Update of /cvsroot/simspark/simspark/contrib/plugin/soccer/objectstate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30785/objectstate Added Files: Tag: WIN32 objectstate.cpp objectstate.h objectstate_c.cpp Log Message: - added minimal set off socces classes to support hoap2 bot. Rebased all nodes on 'SoccerNode' class --- NEW FILE: objectstate.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2004 RoboCup Soccer Server 3D Maintenance Group $Id: objectstate.cpp,v 1.1.2.1 2007/02/18 12:55:09 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "objectstate.h" using namespace oxygen; ObjectState::ObjectState() : SoccerNode() { } ObjectState::~ObjectState() { } void ObjectState::SetPerceptName(const std::string& name, TPerceptType pt) { mPerceptNames[pt] = name; } void ObjectState::SetPerceptName(const std::string& name, TPerceptType pt1, TPerceptType pt2) { mPerceptNames[pt1] = "Player"; mPerceptNames[pt2] = name; } std::string ObjectState::GetPerceptName(TPerceptType pt) const { TPerceptStringMap::const_iterator i = mPerceptNames.find(pt); if (i == mPerceptNames.end()) return std::string(); return i->second; } void ObjectState::SetID(const std::string& id, TPerceptType pt) { mIDs[pt] = id; } std::string ObjectState::GetID(TPerceptType pt) const { TPerceptStringMap::const_iterator i = mIDs.find(pt); if (i == mIDs.end()) return std::string(); return i->second; } --- NEW FILE: objectstate_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group $Id: objectstate_c.cpp,v 1.1.2.1 2007/02/18 12:55:11 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "objectstate.h" using namespace boost; using namespace oxygen; using namespace std; FUNCTION(ObjectState,setPerceptName) { string inName; if ( (in.GetSize() != 1) || (! in.GetValue(in.begin(),inName)) ) { return false; } obj->SetPerceptName(inName); return true; } FUNCTION(ObjectState,setID) { string inId; if ( (in.GetSize() != 1) || (! in.GetValue(in.begin(), inId)) ) { return false; } obj->SetID(inId); return true; } void CLASS(ObjectState)::DefineClass() { DEFINE_BASECLASS(SoccerNode); DEFINE_FUNCTION(setPerceptName); DEFINE_FUNCTION(setID); } --- NEW FILE: objectstate.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2004 RoboCup Soccer Server 3D Maintenance Group $Id: objectstate.h,v 1.1.2.1 2007/02/18 12:55:10 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef OBJECTSTATE_H #define OBJECTSTATE_H #include <soccer/soccernode/soccernode.h> class ObjectState : public SoccerNode { public: typedef enum TPerceptType { PT_Default, PT_TooFar, PT_Player }; public: ObjectState(); virtual ~ObjectState(); /** set the object name for perceptors */ virtual void SetPerceptName(const std::string& name, TPerceptType pt = PT_Default); /** set the object name for perceptors */ virtual void SetPerceptName(const std::string& name, TPerceptType pt1 , TPerceptType pt2 ); /** returns the object name for perceptors */ virtual std::string GetPerceptName(TPerceptType pt = PT_Default) const; /** set the object id for perceptors */ virtual void SetID(const std::string& id, TPerceptType pt = PT_Default); /** returns the object id */ virtual std::string GetID(TPerceptType pt = PT_Default) const; protected: typedef std::map<TPerceptType, std::string> TPerceptStringMap; /** object names */ TPerceptStringMap mPerceptNames; /** object ids */ TPerceptStringMap mIDs; }; DECLARE_CLASS(ObjectState); #endif // OBJECTSTATE_H |