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 <Config.hpp>
\r
33 class ClassNotFoundException;
\r
34 class HostNotFoundException;
\r
37 // Declaration of the class ApplicationHandler (Singleton).
\r
38 class SIMGRIDX_EXPORT ApplicationHandler
\r
44 class ProcessFactory
\r
48 // the list of the argument of the process to create.
\r
50 // the properties of the process to create
\r
51 xbt_dict_t properties;
\r
55 // the current host name parsed
\r
56 const char* hostName;
\r
57 // the name of the class of the process
\r
58 const char* function;
\r
62 // Default constructor.
\r
65 // Copy constructor.
\r
66 ProcessFactory(const ProcessFactory& rProcessFactory);
\r
69 virtual ~ProcessFactory(){}
\r
71 // Set the identity of the current process.
\r
72 void setProcessIdentity(const char* hostName, const char* function);
\r
74 // Register an argument of the current process.
\r
75 void registerProcessArg(const char* arg);
\r
77 // Set the property of the current process.
\r
78 void setProperty(const char* id, const char* value);
\r
80 // Return the host name of the current process.
\r
81 const char* getHostName(void);
\r
83 // Create the current process.
\r
84 void createProcess(void)
\r
85 throw (ClassNotFoundException, HostNotFoundException);
\r
87 static void freeCstr(void* cstr);
\r
93 // Desable the default constructor, the copy constructor , the assignement operator
\r
94 // and the destructor of this class. Assume that this class is static.
\r
96 // Default constructor.
\r
97 ApplicationHandler();
\r
99 // Copy constructor.
\r
100 ApplicationHandler(const ApplicationHandler& rApplicationHandler);
\r
103 virtual ~ApplicationHandler();
\r
105 // Assignement operator.
\r
106 const ApplicationHandler& operator = (const ApplicationHandler& rApplicationHandler);
\r
108 // the process factory used by the application handler.
\r
109 static ProcessFactory* processFactory;
\r
114 // Handle the begining of the parsing of the xml file describing the application.
\r
115 static void onStartDocument(void);
\r
117 // Handle at the end of the parsing.
\r
118 static void onEndDocument(void);
\r
120 // Handle the begining of the parsing of a xml process element.
\r
121 static void onBeginProcess(void);
\r
123 // Handle the parsing of an argument of the current xml process element.
\r
124 static void onProcessArg(void);
\r
126 // Handle the parsing of a property of the currnet xml process element.
\r
127 static void OnProperty(void);
\r
129 // Handle the end of the parsing of a xml process element
\r
130 static void onEndProcess(void);
\r
134 } // namespace SimGrid
\r
136 #endif // !MSG_APPLICATION_HANDLER_HPP
\r