/home/fwph/code/wurde/modules/examples/turnOff.cpp

Go to the documentation of this file.
00001 #include <CommsManager.H>
00002 
00003 /* This just tells everything that's watching the SimpleControl 
00004    channel to turn off, so that we can shut them down cleanly. */
00005 
00006 using namespace WURDE;
00007 
00008 int main(int argc, char *argv[]){
00009   
00010   CommsManager myManager("Shutoff");
00011   Heartbeat myController("Any");
00012   Logger myLogger("ShutoffLogger");
00013 
00014   myManager.parseOptions(argc,argv);
00015 
00016   myManager.setRealName("Shutdown Module");
00017   //  myManager.setHelpString("\t[module name] If specified, sends quit message to specific module. Otherwise sends quit message to all modules (except MCP)\n");
00018 
00019   myManager.setNoHeartbeat();  
00020   myManager.registerSupplier(&myLogger);
00021   myManager.registerConsumer(&myController);
00022 
00023   myController.requests.target="Any";
00024   myController.requests.mType=MESSAGE_REQUEST;
00025   if(argc<2){
00026          cout << "Turning off everything.\n";
00027          myController.requests.moduleName.setValue("Any");
00028   }else{
00029          cout << "Turning off " << argv[1] << endl;
00030          myController.requests.moduleName.setValue(argv[1]);
00031   }
00032   cout << myController.requests.moduleName.getValue();
00033   myController.requests.managedType.setValue(PROC_UNMANAGED);
00034   myController.requests.state.setValue(STATE_QUIT);
00035   myController.publishRequest();
00036 
00037   myManager.runUpdate();
00038   
00039   myManager.cleanUp();
00040 
00041   return 0;
00042 }

Generated on Thu Feb 1 15:31:52 2007 for WURDE by  doxygen 1.5.1