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
24 #include <ClassNotFoundException.hpp>
\r
25 #include <HostNotFoundException.hpp>
\r
31 // Declaration of the class ApplicationHandler (Singleton).
\r
32 class ApplicationHandler
\r
36 // Desable the default constructor, the copy constructor , the assignement operator
\r
37 // and the destructor of this class. Assume that this class is static.
\r
39 // Default constructor.
\r
40 ApplicationHandler();
\r
42 // Copy constructor.
\r
43 ApplicationHandler(const ApplicationHandler& rApplicationHandler);
\r
46 virtual ~ApplicationHandler();
\r
48 // Assignement operator.
\r
49 const ApplicationHandler& operator = (const ApplicationHandler& rApplicationHandler);
\r
51 class ProcessFactory
\r
55 // the list of the argument of the process to create.
\r
57 // the properties of the process to create
\r
58 xbt_dict_t properties;
\r
62 // the current host name parsed
\r
63 const char* hostName;
\r
64 // the name of the class of the process
\r
65 const char* function;
\r
69 // Default constructor.
\r
72 // Copy constructor.
\r
73 ProcessFactory(const ProcessFactory& rProcessFactory);
\r
76 virtual ~ProcessFactory();
\r
78 // Set the identity of the current process.
\r
79 void setProcessIdentity(const char* hostName, const char* function);
\r
81 // Register an argument of the current process.
\r
82 void registerProcessArg(const char* arg);
\r
84 // Set the property of the current process.
\r
85 void setProperty(const char* id, const char* value);
\r
87 // Return the host name of the current process.
\r
88 const const char* getHostName(void);
\r
90 // Create the current process.
\r
91 void createProcess(void)
\r
92 throw (ClassNotFoundException, HostNotFoundException);
\r
96 // the process factory used by the application handler.
\r
97 static ProcessFactory* processFactory;
\r
102 // Handle the begining of the parsing of the xml file describing the application.
\r
103 static void onStartDocument(void);
\r
105 // Handle at the end of the parsing.
\r
106 static void onEndDocument(void);
\r
108 // Handle the begining of the parsing of a xml process element.
\r
109 static void onBeginProcess(void);
\r
111 // Handle the parsing of an argument of the current xml process element.
\r
112 static void onProcessArg(void);
\r
114 // Handle the parsing of a property of the currnet xml process element.
\r
115 static void OnProperty(void);
\r
117 // Handle the end of the parsing of a xml process element
\r
118 static void onEndProcess(void);
\r
122 } // namespace SimGrid
\r
124 #endif // !MSG_APPLICATION_HANDLER_HPP
\r