-#ifndef MSG_APPLICATION_HANDLER_HPP\r
-#define MSG_APPLICATION_HANDLER_HPP\r
-\r
-// Compilation C++ recquise\r
-#ifndef __cplusplus\r
- #error ApplicationHandler.hpp requires C++ compilation (use a .cxx suffix)\r
-#endif\r
-\r
-#include <vector>\r
-#include <map>\r
-\r
-namespace msg\r
-{\r
- \r
- struct Compare\r
- {\r
- public bool operator(const string& first, const string& second)\r
- {\r
- return first.compare(second);\r
- }\r
- };\r
- \r
- typedef vector<string> Strings;\r
- \r
- typedef map<string, string, Compare> Properties;\r
- \r
- \r
-class ApplicationHandler\r
-{\r
-private :\r
- // Default constructor.\r
- ApplicationHandler();\r
- \r
- // Copy constructor.\r
- ApplicationHandler(const ApplicationHandler& rApplicationHandler);\r
- \r
- // Destructor\r
- virtual ~ApplicationHandler();\r
- \r
- class ProcessFactory \r
- {\r
- public:\r
- \r
- Strings* args;\r
- Properties* properties;\r
- \r
- private:\r
- string hostName;\r
- string function;\r
- \r
- public :\r
- \r
- ProcessFactory() \r
- {\r
- this->args = new Strings();\r
- this->properties = new Properties();\r
- this->hostName = NULL;\r
- this->function = NULL;\r
- } \r
- \r
- void setProcessIdentity(const string& hostName, const string& function);\r
- \r
- void registerProcessArg(const string& arg) \r
- {\r
- this->args->push_back(arg);\r
- }\r
-\r
- void setProperty(const string& id, const string& value)\r
- {\r
- this->properties->insert(Properties::value_type(id,value)); \r
- }\r
-\r
- const String& getHostName(void)\r
- {\r
- return this->hostName;\r
- }\r
-\r
- void createProcess(void); \r
- \r
- };\r
- \r
- static ProcessFactory* processFactory;\r
- \r
- public:\r
- \r
- static void onStartDocument(void);\r
- \r
- static void onEndDocument(void);\r
- \r
- static void onBeginProcess(void);\r
- \r
- static void onProcessArg(void);\r
- \r
- static void OnProperty(void);\r
- \r
- static void onEndProcess(void);\r
-};\r
-\r
-}\r
-\r
-#endif // !MSG_APPLICATION_HANDLER_HPP\r
-
\ No newline at end of file
+/*
+ * ApplicationHandler.hpp
+ *
+ * This file contains the declaration of the wrapper class of the native MSG task type.
+ *
+ * Copyright 2006,2007 Martin Quinson, Malek Cherier
+ * All right reserved.
+ *
+ * This program is free software; you can redistribute
+ * it and/or modify it under the terms of the license
+ *(GNU LGPL) which comes with this package.
+ *
+ */
+
+#ifndef MSG_APPLICATION_HANDLER_HPP
+#define MSG_APPLICATION_HANDLER_HPP
+
+// Compilation C++ recquise
+#ifndef __cplusplus
+ #error ApplicationHandler.hpp requires C++ compilation (use a .cxx suffix)
+#endif
+
+#include <xbt/dict.h>
+#include <xbt/dynar.h>
+
+#include <ClassNotFoundException.hpp>
+#include <HostNotFoundException.hpp>
+
+namespace SimGrid
+{
+ namespace Msg
+ {
+ class Process;
+
+ // Declaration of the class ApplicationHandler (Singleton).
+ class SIMGRIDX_EXPORT ApplicationHandler
+ {
+ //friend Process;
+
+ public:
+
+ 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 char* getHostName(void);
+
+ // Create the current process.
+ void createProcess(void)
+ throw (ClassNotFoundException, HostNotFoundException);
+
+ static void freeCstr(void* cstr);
+
+ };
+
+ 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);
+
+ // 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
+