#error Process.hpp requires C++ compilation (use a .cxx suffix)\r
#endif\r
\r
+#include <msg/datatypes.h>\r
+\r
+#include <ApplicationHandler.hpp>\r
+#include <Object.hpp>\r
+\r
+#include <MsgException.hpp>\r
+#include <NullPointerException.hpp>\r
+#include <HostNotFoundException.hpp>\r
+#include <ProcessNotFoundException.hpp>\r
+#include <InvalidArgumentException.hpp>\r
+#include <BadAllocException.hpp>\r
+#include <LogicException.hpp>\r
\r
namespace SimGrid\r
{\r
namespace Msg\r
{\r
+ class ApplicationHandler;\r
+ class Host;\r
+ class Task;\r
+\r
// SimGrid::Msg::Process class declaration.\r
- class Process\r
+ class SIMGRIDX_EXPORT Process : public Object\r
{\r
- friend ApplicationHandler;\r
- \r
- private;\r
+ friend class ApplicationHandler::ProcessFactory;\r
\r
+ MSG_DECLARE_DYNAMIC(Process);\r
+\r
+ public:\r
+\r
// Disable the default constructor.\r
Process();\r
\r
- public:\r
\r
/*! \brief Constructs a process from the name of the host and its name.\r
*\r
* [HostNotFoundException] if the host is not found.\r
*/ \r
Process(const char* hostName, const char* name)\r
- throw(NullPointerException, HostNotFoundException);\r
+ throw(NullPointerException, HostNotFoundException, BadAllocException);\r
\r
/*! \brief Constructs a process from a reference to an host object and its name.\r
*\r
* [HostNotFoundException] if the specified host is no found.\r
*/\r
Process(const char* hostName, const char* name, int argc, char** argv)\r
- throw(NullPointerException, HostNotFoundException);\r
+ throw(NullPointerException, InvalidArgumentException, LogicException, HostNotFoundException, BadAllocException);\r
\r
/*! \brief Process::killAll() - kill all the running processes of the simulation.\r
*\r
\r
/*! \brief Process::isSuspend() - Tests if a process is suspended.\r
*\r
- * \return This method returns true is the process is suspended.\r
- * Otherwise the method returns false.\r
+ * \return This method returns 1 is the process is suspended.\r
+ * Otherwise the method returns 0.\r
*/\r
- bool isSuspended(void);\r
+ int isSuspended(void);\r
\r
/*! \brief Process::getHost() - Retrieves the host of a process object.\r
*\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- void putTask(const Host& rHost, int channel, const Task& rTask)\r
+ void putTask(const Host& rHost, int channel, Task* task)\r
throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::putTask() - This method puts a task on a given channel of a given host (waiting at most given time).\r
*\r
* \remark Set the timeout with -1.0 to disable it.\r
*/\r
- void putTask(const Host& rHost, int channel, const Task& rTask, double timeout) \r
+ void putTask(const Host& rHost, int channel, Task* task, double timeout) \r
throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::getTask() - Retrieves a task from a channel number (waiting at most given time).\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& getTask(int channel) \r
+ Task* getTask(int channel) \r
throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::taskGet() - Retrieves a task from a channel number (waiting at most given time).\r
* zero and different of -1.0.\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& getTask(int channel, double timeout) \r
+ Task* getTask(int channel, double timeout) \r
throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::taskGet() - Retrieves a task from a channel number and a host.\r
* \exception [InvalidArgumentException] if the channel number is negative.\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& getTask(int channel, const Host& rHost) \r
+ Task* getTask(int channel, const Host& rHost) \r
throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::taskGet() - Retrieves a task from a channel number and a host (waiting at most given time).\r
*\r
* \remark Set the timeout with -1.0 to disable it.\r
*/\r
- Task& getTask(int channel, double timeout, const Host& rHost)\r
- throw(InvalidArgumentException MsgException);\r
+ Task* getTask(int channel, double timeout, const Host& rHost)\r
+ throw(InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias\r
* (waiting at most given time).\r
*\r
* \remark Set the timeout with -1.0 to disable it.\r
*/\r
- void sendTask(const char* alias, const Task& rTask, double timeout) \r
+ void sendTask(const char* alias, Task* task, double timeout) \r
throw(NullPointerException, InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the specified alias.\r
* [MsgException] if an internal exception occurs.\r
*\r
*/\r
- void sendTask(const char* alias, const Task& rTask) \r
+ void sendTask(const char* alias, Task* task) \r
throw(NullPointerException, MsgException);\r
\r
/*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias.\r
* [MsgException] if an internal exception occurs.\r
*\r
*/\r
- void sendTask(const Task& rTask) \r
+ void sendTask(Task* task) \r
throw(BadAllocException, MsgException);\r
\r
/*! \brief Process::sendTask() - Sends the given task in the mailbox identified by the default alias\r
*\r
* \remark set the timeout value with -1.0 to disable it.\r
*/\r
- void sendTask(const Task& rTask, double timeout) \r
+ void sendTask(Task* task, double timeout) \r
throw(BadAllocException, InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(const char* alias) \r
+ Task* receiveTask(const char* alias) \r
throw(NullPointerException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias.\r
* \exception [BadAllocException] if there is not enough memory to build the alias. \r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(void) \r
+ Task* receiveTask(void) \r
throw(BadAllocException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(const char* alias, double timeout) \r
+ Task* receiveTask(const char* alias, double timeout) \r
throw(NullPointerException, InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the default alias\r
* \r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(double timeout) \r
+ Task* receiveTask(double timeout) \r
throw(InvalidArgumentException, BadAllocException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias specified as\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(const char* alias, double timeout, const Host& rHost) \r
+ Task* receiveTask(const char* alias, double timeout, const Host& rHost) \r
throw(NullPointerException, InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& Process::receiveTask(double timeout, const Host& rHost) \r
+ Task* receiveTask(double timeout, const Host& rHost) \r
throw(BadAllocException, InvalidArgumentException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by the alias\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(const char* alias, const Host& rHost) \r
+ Task* receiveTask(const char* alias, const Host& rHost) \r
throw(NullPointerException, MsgException);\r
\r
/*! \brief Process::receiveTask() - Retrieves a task from the mailbox identified by default alias\r
*\r
* [MsgException] if an internal exception occurs.\r
*/\r
- Task& receiveTask(const Host& rHost) \r
+ Task* receiveTask(const Host& rHost) \r
throw(BadAllocException, MsgException);\r
\r
\r
* [HostNotFoundException] if the host specified as parameter doesn't exist.\r
*/\r
void create(const Host& rHost, const char* name, int argc, char** argv) \r
- throw(HostNotFoundException);\r
+ throw(InvalidArgumentException);\r
\r
/* Process::fromNativeProcess() - Retrieves the process wrapper associated with a native process.\r
*\r
*\r
* \return The wrapper associated with the native process specified as parameter.\r
*/\r
- static Process& fromNativeProcess(m_process_t nativeProcess);\r
+ static Process* fromNativeProcess(m_process_t nativeProcess);\r
\r
\r
public:\r
*\r
* \return The exit code of the main function.\r
*/\r
- virtual int main(int argc, char** argv) = 0;\r
+ virtual int main(int argc, char** argv);\r
+\r
+ // Operators.\r
+ \r
+ /*\r
+ // Override the operator new().\r
+ void* operator new(size_t size);\r
+ \r
+ // Override the operator delete().\r
+ void operator delete(void* p);\r
+ */\r
\r
private:\r
\r
\r
} //namepace Msg\r
\r
-} namespace SimGrid
\ No newline at end of file
+} // namespace SimGrid\r
+\r
+#endif // !MSG_PROCESS_HPP\r
+\r