00001 00002 #include "Component/ModelManager.H" 00003 #include "Component/ModelComponent.H" 00004 #include "Component/ModelOptionDef.H" 00005 #include "Robots/SeaBeeIII/SaliencyModuleI.H" 00006 #include <Ice/Ice.h> 00007 #include <Ice/Service.h> 00008 #include "Ice/RobotSimEvents.ice.H" 00009 #include "Ice/RobotBrainObjects.ice.H" 00010 #include "Ice/SimEventsUtils.H" 00011 #include "Ice/IceImageUtils.H" 00012 00013 00014 class RobotBrainServiceService : public Ice::Service { 00015 protected: 00016 virtual bool start(int, char* argv[]); 00017 virtual bool stop() { 00018 if (itsMgr) 00019 delete itsMgr; 00020 return true; 00021 } 00022 00023 private: 00024 Ice::ObjectAdapterPtr itsAdapter; 00025 ModelManager *itsMgr; 00026 }; 00027 00028 bool RobotBrainServiceService::start(int argc, char* argv[]) 00029 { 00030 char adapterStr[255]; 00031 00032 //Create the topics 00033 SimEventsUtils::createTopic(communicator(), "SalientPointMessageTopic"); 00034 00035 //Create the adapter 00036 sprintf(adapterStr, "default -p %i", RobotBrainObjects::RobotBrainPort); 00037 itsAdapter = communicator()->createObjectAdapterWithEndpoints("SaliencyModule", 00038 adapterStr); 00039 00040 //Create the manager and its objects 00041 itsMgr = new ModelManager("SaliencyModuleService"); 00042 00043 LINFO("Starting SaliencyModule"); 00044 nub::ref<SaliencyModuleI> ret(new SaliencyModuleI(*itsMgr)); 00045 itsMgr->addSubComponent(ret); 00046 00047 ret->init(communicator(), itsAdapter); 00048 00049 itsMgr->parseCommandLine((const int)argc, (const char**)argv, "", 0, 0); 00050 00051 itsAdapter->activate(); 00052 00053 itsMgr->start(); 00054 00055 return true; 00056 } 00057 00058 // ###################################################################### 00059 int main(int argc, char** argv) { 00060 00061 RobotBrainServiceService svc; 00062 return svc.main(argc, argv); 00063 } 00064 00065