From: Oliver O. <fr...@us...> - 2007-03-07 10:39:47
|
Update of /cvsroot/simspark/simspark/simulations/soccer/plugin/soccercontrolaspect In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24718/soccercontrolaspect Added Files: Tag: projectx soccercontrolaspect.cpp soccercontrolaspect.h soccercontrolaspect_c.cpp Log Message: soccer plugins from rcssserver3D --- NEW FILE: soccercontrolaspect.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: soccercontrolaspect.cpp,v 1.1.2.1 2007/03/07 10:39:43 fruit 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 "soccercontrolaspect.h" #include <zeitgeist/logserver/logserver.h> #include <zeitgeist/scriptserver/scriptserver.h> #include <oxygen/sceneserver/scene.h> #include <oxygen/physicsserver/recorderhandler.h> #include <oxygen/physicsserver/body.h> #include <soccer/ball/ball.h> using namespace oxygen; using namespace boost; using namespace std; using namespace salt; SoccerControlAspect::SoccerControlAspect() : ControlAspect() { } SoccerControlAspect::~SoccerControlAspect() { } void SoccerControlAspect::OnLink() { shared_ptr<Scene> scene = GetActiveScene(); if (scene.get() == 0) { GetLog()->Error() << "(SoccerControlAspect) found no active scene node\n"; return; } mScenePath = scene->GetFullPath(); } shared_ptr<RecorderHandler> SoccerControlAspect::GetBallRecorder() { shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler> (GetCore()->Get(mScenePath + "Ball/geometry/recorder")); if (node.get() == 0) { GetLog()->Error() << "(SoccerControlAspect) found no ball collision recorder\n"; } return node; } shared_ptr<RecorderHandler> SoccerControlAspect::GetFieldRecorder() { shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler> (GetCore()->Get(mScenePath + "FieldBox/recorder")); if (node.get() == 0) { GetLog()->Error() << "(SoccerControlAspect) found no field collision recorder\n"; } return node; } shared_ptr<RecorderHandler> SoccerControlAspect::GetLeftGoalRecorder() { shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler> (GetCore()->Get(mScenePath + "GoalBoxL/recorder")); if (node.get() == 0) { GetLog()->Error() << "(SoccerControlAspect) found no left goal collision recorder\n"; } return node; } shared_ptr<RecorderHandler> SoccerControlAspect::GetRightGoalRecorder() { shared_ptr<RecorderHandler> node = shared_dynamic_cast<RecorderHandler> (GetCore()->Get(mScenePath + "GoalBoxR/recorder")); if (node.get() == 0) { GetLog()->Error() << "(SoccerControlAspect) found no right goal collision recorder\n"; } return node; } --- NEW FILE: soccercontrolaspect_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: soccercontrolaspect_c.cpp,v 1.1.2.1 2007/03/07 10:39:43 fruit 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 "soccercontrolaspect.h" using namespace oxygen; void CLASS(SoccerControlAspect)::DefineClass() { DEFINE_BASECLASS(oxygen/ControlAspect); } --- NEW FILE: soccercontrolaspect.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) 2003 RoboCup Soccer Server 3D Maintenance Group $Id: soccercontrolaspect.h,v 1.1.2.1 2007/03/07 10:39:43 fruit 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 SOCCERCONTROLASPECT_H #define SOCCERCONTROLASPECT_H #include <oxygen/controlaspect/controlaspect.h> #include <soccer/soccertypes.h> class GameStateAspect; class BallStateAspect; class Ball; namespace oxygen { class RecorderHandler; class Body; } /** \class SoccerControlAspect is the base class for all ControlAspects implemented in the soccer bundle. It serves as a place to collect utility functions and type definitions common to all ControlAspects in the soccer simulation */ class SoccerControlAspect : public oxygen::ControlAspect { public: SoccerControlAspect(); virtual ~SoccerControlAspect(); /** returns a reference to the RecorderHandler registered to the Ball node */ boost::shared_ptr<oxygen::RecorderHandler> GetBallRecorder(); /** returns a reference to the RecorderHandler registered to the FieldBox */ boost::shared_ptr<oxygen::RecorderHandler> GetFieldRecorder(); /** returns a reference to the RecorderHandler registered to the left goal box */ boost::shared_ptr<oxygen::RecorderHandler> GetLeftGoalRecorder(); /** returns a reference to the RecorderHandler registered to the left goal box */ boost::shared_ptr<oxygen::RecorderHandler> GetRightGoalRecorder(); protected: /** queries the SceneServer for the currently active scene */ virtual void OnLink(); protected: /** cached scene path */ std::string mScenePath; }; DECLARE_ABSTRACTCLASS(SoccerControlAspect); #endif // SOCCERCONTROLASPECT_H |