|
From: <sgv...@us...> - 2011-03-02 18:04:58
|
Revision: 249
http://simspark.svn.sourceforge.net/simspark/?rev=249&view=rev
Author: sgvandijk
Date: 2011-03-02 18:04:51 +0000 (Wed, 02 Mar 2011)
Log Message:
-----------
- killsim command to kill the server through trainer protocol
Modified Paths:
--------------
trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp
trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h
Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp
===================================================================
--- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2011-03-02 17:22:58 UTC (rev 248)
+++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.cpp 2011-03-02 18:04:51 UTC (rev 249)
@@ -50,7 +50,7 @@
mCommandMap["select"] = CT_SELECT;
mCommandMap["kill"] = CT_KILL;
mCommandMap["repos"] = CT_REPOS;
-
+ mCommandMap["killsim"] = CT_KILLSIM;
// setup team index map
// Originally team sides were "L","R" and "N"
// But this seems to be unused
@@ -120,6 +120,15 @@
GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get GameControlServer\n";
}
+ mSimServer = shared_dynamic_cast<SimulationServer>
+ (GetCore()->Get("/sys/server/simulation"));
+
+ if (mGameControl.get() == 0)
+ {
+ GetLog()->Error() << "ERROR: (TrainerCommandParser) Unable to get SimulationServer\n";
+ }
+
+
}
void TrainerCommandParser::OnUnlink()
@@ -212,6 +221,9 @@
case CT_REPOS:
ParseReposCommand(predicate);
break;
+ case CT_KILLSIM:
+ ParseKillSimCommand(predicate);
+ break;
default:
return false;
}
@@ -699,3 +711,7 @@
}
}
+void TrainerCommandParser::ParseKillSimCommand(const oxygen::Predicate & predicate)
+{
+ mSimServer->Quit();
+}
Modified: trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h
===================================================================
--- trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2011-03-02 17:22:58 UTC (rev 248)
+++ trunk/rcssserver3d/plugin/soccer/trainercommandparser/trainercommandparser.h 2011-03-02 18:04:51 UTC (rev 249)
@@ -32,6 +32,7 @@
#include <salt/vector.h>
#include <soccertypes.h>
#include <soccerruleaspect/soccerruleaspect.h>
+#include <oxygen/simulationserver/simulationserver.h>
namespace oxygen
{
@@ -52,7 +53,8 @@
CT_ACK,
CT_SELECT,
CT_KILL,
- CT_REPOS
+ CT_REPOS,
+ CT_KILLSIM
};
typedef std::map<std::string, ECommandType> TCommandMap;
@@ -123,6 +125,12 @@
predicate
*/
void ParseReposCommand(const oxygen::Predicate & predicate);
+
+ /** parses and executes the killsim command contained in the given
+ predicate
+ */
+ void ParseKillSimCommand(const oxygen::Predicate & predicate);
+
protected:
TCommandMap mCommandMap;
@@ -138,7 +146,9 @@
boost::shared_ptr<oxygen::BaseParser> mSexpParser;
//! cached reference to the game control server
boost::shared_ptr<oxygen::GameControlServer> mGameControl;
-
+ //! cached reference to the simulation server
+ boost::shared_ptr<oxygen::SimulationServer> mSimServer;
+
bool mGetAck;
std::string mAckString;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|