git-svn-id: https://svn.microneil.com/svn/SNF4CGP/trunk@44 59e8e3e7-56fa-483b-b4b4-fa6ab0af3dfcmaster
void ExecutiveProcess::notifyQUIT() { | void ExecutiveProcess::notifyQUIT() { | ||||
ostringstream O; | ostringstream O; | ||||
O << "* SNF4CGP[" << QuitJobNumber << "] Received QUIT, shutting down..." << endl; | |||||
O << "* CGPSNF[" << QuitJobNumber << "] Received QUIT, shutting down..." << endl; | |||||
Output.sendString(O.str()); | Output.sendString(O.str()); | ||||
} | } | ||||
void ExecutiveProcess::notifyNOTGOOD() { | void ExecutiveProcess::notifyNOTGOOD() { | ||||
ostringstream O; | ostringstream O; | ||||
O << "* SNF4CGP Input stream has gone bad, shutting down..." << endl; | |||||
O << "* CGPSNF Input stream has gone bad, shutting down..." << endl; | |||||
Output.sendString(O.str()); | Output.sendString(O.str()); | ||||
} | } | ||||
shutdownWorkerPool(); | shutdownWorkerPool(); | ||||
shutdownOutput(); | shutdownOutput(); | ||||
shutdownJobPool(); | shutdownJobPool(); | ||||
cout << "* SNF4CGP Shutdown completed." << endl; | |||||
cout << "* CGPSNF Shutdown completed." << endl; | |||||
if(0 < QuitJobNumber) { // If processing ended with QUIT | if(0 < QuitJobNumber) { // If processing ended with QUIT | ||||
cout << QuitJobNumber << " OK" << endl; // then respond appropriately. | cout << QuitJobNumber << " OK" << endl; // then respond appropriately. | ||||
} | } |
} | } | ||||
void Job::generateCommandCommentPrefix(ostringstream& O) { | void Job::generateCommandCommentPrefix(ostringstream& O) { | ||||
O << "* SNF4CGP[" << CurrentCommand.Number << "] "; | |||||
O << "* CGPSNF[" << CurrentCommand.Number << "] "; | |||||
} | } | ||||
void Job::emitOK() { | void Job::emitOK() { | ||||
} | } | ||||
void Job::doWakeUp() { | void Job::doWakeUp() { | ||||
emitComment("SNF4CGP Waking Up"); | |||||
emitComment("CGPSNF Waking Up"); | |||||
emitComment(CurrentCommand.Data); | emitComment(CurrentCommand.Data); | ||||
} | } | ||||
void Job::doUNKNOWN() { | void Job::doUNKNOWN() { | ||||
ostringstream O; | ostringstream O; | ||||
O << "* SNF4CGP[" << CurrentCommand.Number << "] Does not understand: " | |||||
O << "* CGPSNF[" << CurrentCommand.Number << "] Does not understand: " | |||||
<< formatAsCGPString(CurrentCommand.Data) << endl; | << formatAsCGPString(CurrentCommand.Data) << endl; | ||||
OutputBuffer.append(O.str()); | OutputBuffer.append(O.str()); | ||||
emitFAILURE(); | emitFAILURE(); |
using namespace std; // Introduce standard namespace. | using namespace std; // Introduce standard namespace. | ||||
const string SNF4CGP_VERSION_INFO = "SNF4CGP Version 0.1.0 Build: " __DATE__ " " __TIME__; | |||||
const string SNF4CGP_VERSION_INFO = "CGPSNF Version 0.1.0 Build: " __DATE__ " " __TIME__; | |||||
const int ConfigPathArgNumber = 1; | const int ConfigPathArgNumber = 1; | ||||
const int CorrectArgcNumber = 2; | const int CorrectArgcNumber = 2; | ||||
bool CommandLineIsValid(int argc, char*argv[]) { // Validate the command line. | bool CommandLineIsValid(int argc, char*argv[]) { // Validate the command line. | ||||
if(CorrectArgcNumber != argc) { | if(CorrectArgcNumber != argc) { | ||||
cout << "* SNF4CGP - Bad command line, use SNF4CGP <path_to_config_file>" << endl; | |||||
cout << "* CGPSNF - Bad command line, use CGPSNF <path_to_config_file>" << endl; | |||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
SNF4CGP.doShutdown(); | SNF4CGP.doShutdown(); | ||||
} | } | ||||
catch(exception& e) { // Display standard exceptions. | catch(exception& e) { // Display standard exceptions. | ||||
cout << "* SFN4CGP Exception: " << e.what() << endl; | |||||
cout << "* CGPSNF Exception: " << e.what() << endl; | |||||
} | } | ||||
catch(...) { // Display unusual exceptions. | catch(...) { // Display unusual exceptions. | ||||
cout << "* SNF4CGP Unusual Excetption!" << endl; | |||||
cout << "* CGPSNF Unusual Excetption!" << endl; | |||||
} | } | ||||
} | } | ||||