// SNF4CGP/ExecutiveProcess.hpp // Copyright (C) 2009 ARM Research Labs, LLC // See www.armresearch.com for more information. // // SNF4CGP Execuitive Process (Application Object) // The ExecutiveProcess is responsible for constructing the application, connecting // it's components, and peforming an orderly startup and shutdown. #ifndef IncludedExecutiveProcess #define IncludedExecutiveProcess #include "JobPool.hpp" #include "WorkerPool.hpp" #include "InputProcessor.hpp" #include "OutputProcessor.hpp" #include "Command.hpp" #include class ExecutiveProcess { // The executive process... private: const string VersionInfo; // Knows Version and const string ConfigInfo; // Configuration. JobPool Jobs; // Keeps pointers to the apps WorkerPool Workers; // components so they can be InputProcessor Input; // created, destroyed and OutputProcessor Output; // connected together. unsigned int QuitJobNumber; // Quit job number 0 until QUIT. void initializeOutput(); // These do what they say. void initializeJobPool(); void initializeWorkerPool(); void shutdownWorkerPool(); void shutdownJobPool(); void shutdownOutput(); void dispatchCommand(Command& C); // Job + Worker + Command; go! void dispatchWakeupCommand(); void notifyQUIT(); void notifyNOTGOOD(); public: ExecutiveProcess(const string& Version, const string& Config); // Simple construction. The d'tor needs ~ExecutiveProcess(); // to deal with uncerimoneous shutdowns. void doStartup(); // The main thread calls these in sequence. void doProcessing(); void doShutdown(); }; #endif