Update of /cvsroot/simspark/simspark/spark/oxygen/simulationserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25267/simulationserver Modified Files: Tag: WIN32 agentcontrol.cpp agentcontrol.h monitorcontrol.cpp monitorcontrol.h simulationserver.cpp simulationserver.h Log Message: - cleanup - use CachedPath objects to cache references Index: simulationserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.cpp,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** simulationserver.cpp 8 Jan 2006 14:07:38 -0000 1.3 --- simulationserver.cpp 16 Feb 2007 15:42:56 -0000 1.3.2.1 *************** *** 22,28 **** #include "simulationserver.h" #include "simcontrolnode.h" - #include <oxygen/monitorserver/monitorserver.h> - #include <oxygen/sceneserver/sceneserver.h> - #include <oxygen/gamecontrolserver/gamecontrolserver.h> #include <zeitgeist/logserver/logserver.h> #include <signal.h> --- 22,25 ---- *************** *** 65,81 **** void SimulationServer::OnLink() { ! mMonitorServer = shared_dynamic_cast<MonitorServer> ! (GetCore()->Get("/sys/server/monitor")); ! ! if (mMonitorServer.get() == 0) ! { ! GetLog()->Error() ! << "(SimulationServer) ERROR: MonitorServer not found.\n"; ! } ! ! mGameControlServer = shared_dynamic_cast<GameControlServer> ! (GetCore()->Get("/sys/server/gamecontrol")); ! if (mGameControlServer.get() == 0) { GetLog()->Error() --- 62,68 ---- void SimulationServer::OnLink() { ! RegisterCachedPath(mGameControlServer, "/sys/server/gamecontrol"); ! if (mGameControlServer.expired()) { GetLog()->Error() *************** *** 83,90 **** } ! mSceneServer = shared_dynamic_cast<SceneServer> ! (GetCore()->Get("/sys/server/scene")); ! ! if (mSceneServer.get() == 0) { GetLog()->Error() --- 70,75 ---- } ! RegisterCachedPath(mSceneServer, "/sys/server/scene"); ! if (mSceneServer.expired()) { GetLog()->Error() *************** *** 93,104 **** } - - void SimulationServer::OnUnlink() - { - mMonitorServer.reset(); - mGameControlServer.reset(); - mSceneServer.reset(); - } - void SimulationServer::Quit() { --- 78,81 ---- *************** *** 203,208 **** { if ( ! (mSceneServer.get() == 0) || ! (mGameControlServer.get() == 0) ) { --- 180,185 ---- { if ( ! (mSceneServer.expired()) || ! (mGameControlServer.expired()) ) { *************** *** 336,352 **** } - shared_ptr<GameControlServer> SimulationServer::GetGameControlServer() - { - return mGameControlServer; - } - - shared_ptr<MonitorServer> SimulationServer::GetMonitorServer() - { - return mMonitorServer; - } - shared_ptr<SceneServer> SimulationServer::GetSceneServer() { ! return mSceneServer; } --- 313,319 ---- } shared_ptr<SceneServer> SimulationServer::GetSceneServer() { ! return mSceneServer.get(); } Index: monitorcontrol.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/monitorcontrol.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** monitorcontrol.h 5 Dec 2005 21:21:18 -0000 1.1 --- monitorcontrol.h 16 Feb 2007 15:42:56 -0000 1.1.2.1 *************** *** 22,25 **** --- 22,26 ---- #include "netcontrol.h" + #include <oxygen/monitorserver/monitorserver.h> namespace oxygen *************** *** 56,64 **** protected: virtual void OnLink(); - virtual void OnUnlink(); protected: /** cached reference to the MonitorServer */ ! boost::shared_ptr<MonitorServer> mMonitorServer; /** the update interval for the connected monitors in cycles */ --- 57,64 ---- protected: virtual void OnLink(); protected: /** cached reference to the MonitorServer */ ! CachedPath<MonitorServer> mMonitorServer; /** the update interval for the connected monitors in cycles */ Index: agentcontrol.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/agentcontrol.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** agentcontrol.h 5 Dec 2005 21:21:18 -0000 1.1 --- agentcontrol.h 16 Feb 2007 15:42:55 -0000 1.1.2.1 *************** *** 22,25 **** --- 22,26 ---- #include "netcontrol.h" + #include <oxygen/gamecontrolserver/gamecontrolserver.h> namespace oxygen *************** *** 53,61 **** protected: virtual void OnLink(); - virtual void OnUnlink(); protected: /** cached reference to the GameControlServer */ ! boost::shared_ptr<GameControlServer> mGameControlServer; }; --- 54,61 ---- protected: virtual void OnLink(); protected: /** cached reference to the GameControlServer */ ! CachedPath<GameControlServer> mGameControlServer; }; Index: monitorcontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/monitorcontrol.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** monitorcontrol.cpp 5 Dec 2005 21:21:18 -0000 1.1 --- monitorcontrol.cpp 16 Feb 2007 15:42:55 -0000 1.1.2.1 *************** *** 22,26 **** #include "netmessage.h" #include <zeitgeist/logserver/logserver.h> - #include <oxygen/monitorserver/monitorserver.h> #include <oxygen/sceneserver/sceneserver.h> #include <oxygen/sceneserver/scene.h> --- 22,25 ---- *************** *** 44,62 **** { NetControl::OnLink(); ! shared_ptr<SimulationServer> sim = GetSimulationServer(); ! if (sim.get() == 0) { GetLog()->Error() ! << "(MonitorControl) ERROR: SimulationServer not found\n"; return; } - - mMonitorServer = sim->GetMonitorServer(); - } - - void MonitorControl::OnUnlink() - { - NetControl::OnUnlink(); - mMonitorServer.reset(); } --- 43,54 ---- { NetControl::OnLink(); ! RegisterCachedPath(mMonitorServer, "/sys/server/monitor"); ! ! if (mMonitorServer.expired() == 0) { GetLog()->Error() ! << "(MonitorControl) ERROR: MonitorServer not found\n"; return; } } Index: simulationserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** simulationserver.h 2 Jan 2006 20:37:41 -0000 1.2 --- simulationserver.h 16 Feb 2007 15:42:57 -0000 1.2.2.1 *************** *** 24,34 **** #include <zeitgeist/node.h> namespace oxygen { ! class GameControlServer; ! class MonitorServer; ! class SceneServer; ! class SimControlNode; class SimulationServer : public zeitgeist::Node --- 24,33 ---- #include <zeitgeist/node.h> + #include <oxygen/gamecontrolserver/gamecontrolserver.h> + #include <oxygen/sceneserver/sceneserver.h> namespace oxygen { ! class SimControlNode; class SimulationServer : public zeitgeist::Node *************** *** 121,130 **** virtual void Run(int argc = 0, char** argv = 0); - /** returns the cached MonitorServer reference */ - boost::shared_ptr<MonitorServer> GetMonitorServer(); - - /** returns the cached GameControlServer reference */ - boost::shared_ptr<GameControlServer> GetGameControlServer(); - /** returns thr cached SceneServer reference */ boost::shared_ptr<SceneServer> GetSceneServer(); --- 120,123 ---- *************** *** 135,139 **** protected: virtual void OnLink(); - virtual void OnUnlink(); /** advances the simulation mSumDeltaTime seconds. If mSimStep is --- 128,131 ---- *************** *** 180,191 **** int mCycle; - /** a cached reference to the monitor server */ - boost::shared_ptr<MonitorServer> mMonitorServer; - /** a cached reference to the GameControlServer */ ! boost::shared_ptr<GameControlServer> mGameControlServer; /** a cached reference to the SceneServer */ ! boost::shared_ptr<SceneServer> mSceneServer; }; --- 172,180 ---- int mCycle; /** a cached reference to the GameControlServer */ ! CachedPath<GameControlServer> mGameControlServer; /** a cached reference to the SceneServer */ ! CachedPath<SceneServer> mSceneServer; }; Index: agentcontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/agentcontrol.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** agentcontrol.cpp 5 Dec 2005 21:21:18 -0000 1.1 --- agentcontrol.cpp 16 Feb 2007 15:42:54 -0000 1.1.2.1 *************** *** 22,26 **** #include "netmessage.h" #include <zeitgeist/logserver/logserver.h> - #include <oxygen/gamecontrolserver/gamecontrolserver.h> #include <oxygen/agentaspect/agentaspect.h> --- 22,25 ---- *************** *** 42,60 **** { NetControl::OnLink(); ! shared_ptr<SimulationServer> sim = GetSimulationServer(); ! if (sim.get() == 0) ! { ! GetLog()->Error() ! << "(AgentControl) ERROR: SimulationServer not found\n"; ! return; ! } ! ! mGameControlServer = sim->GetGameControlServer(); ! } ! void AgentControl::OnUnlink() ! { ! NetControl::OnUnlink(); ! mGameControlServer.reset(); } --- 41,51 ---- { NetControl::OnLink(); ! RegisterCachedPath(mGameControlServer, "/sys/server/gamecontrol"); ! if (mGameControlServer.expired()) ! { ! GetLog()->Error() ! << "(AgentControl) ERROR: GameControlServer not found.\n"; ! } } |