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