Update of /cvsroot/simspark/simspark/spark/plugin/sceneeffector In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2069/sceneeffector Added Files: .cvsignore Makefile.am export.cpp sceneaction.h sceneeffector.cpp sceneeffector.h sceneeffector_c.cpp Log Message: - added sceneeffector plugin --- NEW FILE: .cvsignore --- .deps .libs Makefile Makefile.in *.la *.lo --- NEW FILE: sceneaction.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: sceneaction.h,v 1.1 2005/12/25 14:54:35 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 SCENEACTION_H #define SCENEACTION_H #include <oxygen/gamecontrolserver/actionobject.h> #include <salt/vector.h> class SceneAction : public oxygen::ActionObject { public: SceneAction(const std::string& predicate, const std::string& scene) : ActionObject(predicate), mScene(scene) {} virtual ~SceneAction() {} /** returns the stored scene name */ const std::string& GetScene() { return mScene; } protected: /** the name of the scene to be created by the SceneEffector */ std::string mScene; }; #endif // SCENEACTION_H --- NEW FILE: export.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: export.cpp,v 1.1 2005/12/25 14:54:35 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 "sceneeffector.h" #include <zeitgeist/zeitgeist.h> ZEITGEIST_EXPORT_BEGIN() ZEITGEIST_EXPORT(SceneEffector); ZEITGEIST_EXPORT_END() --- NEW FILE: sceneeffector.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: sceneeffector.cpp,v 1.1 2005/12/25 14:54:35 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 "sceneeffector.h" #include "sceneaction.h" #include <zeitgeist/logserver/logserver.h> #include <oxygen/gamecontrolserver/actionobject.h> #include <oxygen/agentaspect/agentaspect.h> using namespace boost; using namespace oxygen; using namespace zeitgeist; using namespace std; SceneEffector::SceneEffector() : oxygen::Effector() { } SceneEffector::~SceneEffector() { } bool SceneEffector::Realize(boost::shared_ptr<ActionObject> action) { shared_ptr<SceneAction> sceneAction = shared_dynamic_cast<SceneAction>(action); if (sceneAction.get() == 0) { GetLog()->Error() << "(SceneEffector) ERROR: cannot realize " << "an unknown ActionObject\n"; return false; } boost::shared_ptr<AgentAspect> aspect =GetAgentAspect(); if (aspect.get() == 0) { GetLog()->Error() << "(SceneEffector) ERROR: cannot get AgentAspect\n"; return false; } aspect->ImportScene(sceneAction->GetScene(), shared_ptr<ParameterList>()); return true; } shared_ptr<ActionObject> SceneEffector::GetActionObject(const Predicate& predicate) { if (predicate.name != GetPredicate()) { GetLog()->Error() << "(SceneEffector) ERROR: invalid predicate" << predicate.name << "\n"; return shared_ptr<ActionObject>(); } string scene; if (! predicate.GetValue(predicate.begin(), scene)) { GetLog()->Error() << "ERROR: (SceneEffector) scene filename expected\n"; return shared_ptr<ActionObject>(); }; return shared_ptr<ActionObject>(new SceneAction(GetPredicate(),scene)); } --- NEW FILE: Makefile.am --- pkglib_LTLIBRARIES = sceneeffector.la sceneeffector_la_SOURCES = export.cpp \ sceneeffector.cpp sceneeffector.h \ sceneeffector_c.cpp \ sceneaction.h # -module tells automake we're not building a library but a loadable module # so we don't need the "lib" prefix in the module name sceneeffector_la_LDFLAGS = -module -version-info 0:0:0 AM_CPPFLAGS = -I${top_srcdir}/lib @RUBY_CPPFLAGS@ --- NEW FILE: sceneeffector_c.cpp --- /* -*- mode: c++; c-basic-indent: 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: sceneeffector_c.cpp,v 1.1 2005/12/25 14:54:35 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 "sceneeffector.h" using namespace boost; using namespace oxygen; void CLASS(SceneEffector)::DefineClass() { DEFINE_BASECLASS(oxygen/Effector); } --- NEW FILE: sceneeffector.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: sceneeffector.h,v 1.1 2005/12/25 14:54:35 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 SCENEEFFECTOR_H #define SCENEEFFECTOR_H #include <oxygen/agentaspect/effector.h> class SceneEffector : public oxygen::Effector { // // functions // public: SceneEffector(); virtual ~SceneEffector(); /** realizes the action described by the ActionObject */ virtual bool Realize(boost::shared_ptr<oxygen::ActionObject> action); /** returns the name of the predicate this effector implements. */ virtual std::string GetPredicate() { return "scene"; } /** constructs an Actionobject, describing a predicate */ virtual boost::shared_ptr<oxygen::ActionObject> GetActionObject(const oxygen::Predicate& predicate); }; DECLARE_CLASS(SceneEffector); #endif // SCENEEFFECTOR_H |