2 * ApplicationHandler.hpp
\r
4 * This file contains the declaration of the wrapper class of the native MSG task type.
\r
6 * Copyright 2006,2007 Martin Quinson, Malek Cherier
\r
7 * All right reserved.
\r
9 * This program is free software; you can redistribute
\r
10 * it and/or modify it under the terms of the license
\r
11 *(GNU LGPL) which comes with this package.
\r
15 #ifndef MSG_APPLICATION_HANDLER_HPP
\r
16 #define MSG_APPLICATION_HANDLER_HPP
\r
18 // Compilation C++ recquise
\r
20 #error ApplicationHandler.hpp requires C++ compilation (use a .cxx suffix)
\r
23 #include <xbt/dict.h>
\r
24 #include <xbt/dynar.h>
\r
26 #include <ClassNotFoundException.hpp>
\r
27 #include <HostNotFoundException.hpp>
\r
35 // Declaration of the class ApplicationHandler (Singleton).
\r
36 class SIMGRIDX_EXPORT ApplicationHandler
\r
42 class ProcessFactory
\r
46 // the list of the argument of the process to create.
\r
48 // the properties of the process to create
\r
49 xbt_dict_t properties;
\r
53 // the current host name parsed
\r
54 const char* hostName;
\r
55 // the name of the class of the process
\r
56 const char* function;
\r
60 // Default constructor.
\r
63 // Copy constructor.
\r
64 ProcessFactory(const ProcessFactory& rProcessFactory);
\r
67 virtual ~ProcessFactory();
\r
69 // Set the identity of the current process.
\r
70 void setProcessIdentity(const char* hostName, const char* function);
\r
72 // Register an argument of the current process.
\r
73 void registerProcessArg(const char* arg);
\r
75 // Set the property of the current process.
\r
76 void setProperty(const char* id, const char* value);
\r
78 // Return the host name of the current process.
\r
79 const char* getHostName(void);
\r
81 // Create the current process.
\r
82 void createProcess(void)
\r
83 throw (ClassNotFoundException, HostNotFoundException);
\r
85 static void freeCstr(void* cstr);
\r
91 // Desable the default constructor, the copy constructor , the assignement operator
\r
92 // and the destructor of this class. Assume that this class is static.
\r
94 // Default constructor.
\r
95 ApplicationHandler();
\r
97 // Copy constructor.
\r
98 ApplicationHandler(const ApplicationHandler& rApplicationHandler);
\r
101 virtual ~ApplicationHandler();
\r
103 // Assignement operator.
\r
104 const ApplicationHandler& operator = (const ApplicationHandler& rApplicationHandler);
\r
106 // the process factory used by the application handler.
\r
107 static ProcessFactory* processFactory;
\r
112 // Handle the begining of the parsing of the xml file describing the application.
\r
113 static void onStartDocument(void);
\r
115 // Handle at the end of the parsing.
\r
116 static void onEndDocument(void);
\r
118 // Handle the begining of the parsing of a xml process element.
\r
119 static void onBeginProcess(void);
\r
121 // Handle the parsing of an argument of the current xml process element.
\r
122 static void onProcessArg(void);
\r
124 // Handle the parsing of a property of the currnet xml process element.
\r
125 static void OnProperty(void);
\r
127 // Handle the end of the parsing of a xml process element
\r
128 static void onEndProcess(void);
\r
132 } // namespace SimGrid
\r
134 #endif // !MSG_APPLICATION_HANDLER_HPP
\r