X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c78836d773a51d00f3fb2dec7b602e353b3a833c..21722d01338d0cf9a704fdb226507d1be787871a:/src/cxx/ApplicationHandler.hpp diff --git a/src/cxx/ApplicationHandler.hpp b/src/cxx/ApplicationHandler.hpp index d45032132d..c33cc76925 100644 --- a/src/cxx/ApplicationHandler.hpp +++ b/src/cxx/ApplicationHandler.hpp @@ -6,97 +6,101 @@ #error ApplicationHandler.hpp requires C++ compilation (use a .cxx suffix) #endif -#include -#include -namespace msg +namespace SimGrid { - - struct Compare + namespace Msg { - public bool operator(const string& first, const string& second) + // Declaration of the class ApplicationHandler. + class ApplicationHandler { - return first.compare(second); - } - }; - - typedef vector Strings; - - typedef map Properties; - - -class ApplicationHandler -{ -private : - // Default constructor. - ApplicationHandler(); - - // Copy constructor. - ApplicationHandler(const ApplicationHandler& rApplicationHandler); - - // Destructor - virtual ~ApplicationHandler(); - - class ProcessFactory - { - public: - - Strings* args; - Properties* properties; - - private: - string hostName; - string function; - - public : - - ProcessFactory() - { - this->args = new Strings(); - this->properties = new Properties(); - this->hostName = NULL; - this->function = NULL; - } - - void setProcessIdentity(const string& hostName, const string& function); - - void registerProcessArg(const string& arg) - { - this->args->push_back(arg); - } - - void setProperty(const string& id, const string& value) - { - this->properties->insert(Properties::value_type(id,value)); - } - - const String& getHostName(void) - { - return this->hostName; - } - - void createProcess(void); - - }; - - static ProcessFactory* processFactory; - - public: - - static void onStartDocument(void); - - static void onEndDocument(void); - - static void onBeginProcess(void); - - static void onProcessArg(void); - - static void OnProperty(void); - - static void onEndProcess(void); -}; + private : + + // Desable the default constructor, the copy constructor , the assignement operator + // and the destructor of this class. Assume that this class is static. + + // Default constructor. + ApplicationHandler(); + + // Copy constructor. + ApplicationHandler(const ApplicationHandler& rApplicationHandler); + + // Destructor + virtual ~ApplicationHandler(); + + // Assignement operator. + const ApplicationHandler& operator = (const ApplicationHandler& rApplicationHandler); + + class ProcessFactory + { + public: + + // the list of the argument of the process to create. + xbt_dynar_t args; + // the properties of the process to create + xbt_dict_t properties; + + private: + + // the current host name parsed + const char* hostName; + // the name of the class of the process + const char* function; + + public : + + // Default constructor. + ProcessFactory(); + + // Copy constructor. + ProcessFactory(const ProcessFactory& rProcessFactory); + + // Destructor. + virtual ~ProcessFactory(); + + // Set the identity of the current process. + void setProcessIdentity(const char* hostName, const char* function); + + // Register an argument of the current process. + void registerProcessArg(const char* arg); + + // Set the property of the current process. + void setProperty(const char* id, const char* value); + + // Return the host name of the current process. + const const char* getHostName(void); + + // Create the current process. + void createProcess(void); + + }; + + // the process factory used by the application handler. + static ProcessFactory* processFactory; + + public: + + // Handle the begining of the parsing of the xml file describing the application. + static void onStartDocument(void); + + // Handle at the end of the parsing. + static void onEndDocument(void); + + // Handle the begining of the parsing of a xml process element. + static void onBeginProcess(void); + + // Handle the parsing of an argument of the current xml process element. + static void onProcessArg(void); + + // Handle the parsing of a property of the currnet xml process element. + static void OnProperty(void); + + // Handle the end of the parsing of a xml process element + static void onEndProcess(void); + }; -} + } // namespace Msg +} // namespace SimGrid #endif // !MSG_APPLICATION_HANDLER_HPP \ No newline at end of file