#error Host.hpp requires C++ compilation (use a .cxx suffix)\r
#endif\r
\r
-#include <InvalidArgumentException.hpp>\r
-#include <BadAllocException.hpp>\r
-#include <HostNotFoundException.hpp>\r
-#include <MsgException.hpp>\r
+#include <msg/datatypes.h>\r
+\r
+#include <Config.hpp>\r
+\r
\r
// namespace SimGrid::Msg\r
namespace SimGrid\r
{\r
namespace Msg\r
{\r
+ class InvalidArgumentException;\r
+ class BadAllocException;\r
+ class HostNotFoundException;\r
+ class MsgException;\r
+\r
+ class Task;\r
+ class Process;\r
+\r
// Declaration of the class SimGrid::Msg::Host.\r
- class Host // final class.\r
+ class SIMGRIDX_EXPORT Host // final class.\r
{\r
+ friend Process;\r
+ friend Task;\r
+\r
// Desable the default constructor.\r
// The best way to get an host instance is to use the static method Host::getByName().\r
\r
- private :\r
+ public :\r
\r
// Default constructor (desabled).\r
Host();\r
*\r
* \exception [HostNotFoundException] if no host with the specified name\r
* was found.\r
- * [InvalidParameterException] if the hostName parameter is invalid (NULL).\r
+ * [InvalidArgumentException] if the hostName parameter is invalid (NULL).\r
* [BadAllocException] if there is not enough memory to allocate the host.\r
*/ \r
static Host& getByName(const char* hostName)\r
- throw(HostNotFoundException, InvalidParameterException, BadAllocException);\r
+ throw(HostNotFoundException, InvalidArgumentException, BadAllocException);\r
\r
/*! \brief Host::getNumber() - returns the number of the installed hosts.\r
*\r
* \see Process::currentProcess().\r
*/\r
static Host& currentHost(void)\r
- throw(InvalidParameterException, BadAllocException);\r
+ throw(InvalidArgumentException, BadAllocException);\r
\r
/*! \brief Host::all() - This static method retrieves all of the hosts of the installed platform.\r
*\r
* the parameter len is set with the number of hosts of the platform.\r
* Otherwise the method throw one of the exception described below.\r
*\r
- * \exception [InvalidParameterException] if the parameter hosts is invalid or\r
+ * \exception [InvalidArgumentException] if the parameter hosts is invalid or\r
* if the parameter len is negative or\r
* less than the number of hosts installed\r
* on the current platform.\r
/*! \brief Host::isAvailable - tests if an host is availabled.\r
* \r
* \return Is the host is availabled the method returns\r
- * true. Otherwise the method returns false.\r
+ * 1. Otherwise the method returns 0.\r
*/ \r
- bool isAvailble(void) const;\r
+ int isAvailable(void) const;\r
\r
/* ! \brief Host::put() - put a task on the given channel of a host .\r
*\r
* the method throws one of the exceptions described below.\r
*\r
* \exception [MsgException] if an internal error occurs.\r
- * [InvalidParameterException] if the value of the channel specified as\r
+ * [InvalidArgumentException] if the value of the channel specified as\r
* parameter is negative.\r
*/\r
void put(int channel, const Task& rTask)\r
- throw(MsgException, InvalidParameterException);\r
+ throw(MsgException, InvalidArgumentException);\r
+\r
+ void Host::put(int channel, Task* task) \r
+ throw(MsgException, InvalidArgumentException);\r
\r
/* ! \brief Host::put() - put a task on the given channel of a host object (waiting at most timeout seconds).\r
*\r
* the method throws one of the exceptions described below.\r
*\r
* \exception [MsgException] if an internal error occurs.\r
- * [InvalidParameterException] if the value of the channel specified as\r
+ * [InvalidArgumentException] if the value of the channel specified as\r
* parameter is negative or if the timeout value\r
* is less than zero and différent of -1.\r
*\r
* \remark To specify no timeout set the timeout value with -1.0.\r
*/\r
- void put(int channel, Task task, double timeout) \r
- throw(MsgException, InvalidParameterException);\r
+ void put(int channel, const Task& rTask, double timeout) \r
+ throw(MsgException, InvalidArgumentException);\r
\r
/* ! \brief Host::putBounded() - put a task on the given channel of a host object (capping the emission rate to maxrate).\r
*\r
* the method throws one of the exceptions described below.\r
*\r
* \exception [MsgException] if an internal error occurs.\r
- * [InvalidParameterException] if the value of the channel specified as\r
+ * [InvalidArgumentException] if the value of the channel specified as\r
* parameter is negative or if the maxRate parameter value\r
* is less than zero and différent of -1.0.\r
*\r
* \remark To specify no rate set the maxRate parameter value with -1.0.\r
*/\r
void putBounded(int channel, const Task& rTask, double maxRate) \r
- throw(MsgException, InvalidParameterException);\r
+ throw(MsgException, InvalidArgumentException);\r
\r
/* ! brief Host::send() - sends the given task to mailbox identified by the default alias.\r
*\r
* \return If successful the task is sended to the default mailbox. Otherwise the\r
* method throws one of the exceptions described below.\r
*\r
- * \exception [InvalidParameterException] if alias parameter is invalid (NULL).\r
+ * \exception [InvalidArgumentException] if alias parameter is invalid (NULL).\r
* [BadAllocException] if there is not enough memory to allocate\r
* the default alias variable.\r
* [MsgException] if an internal error occurs.\r
*/\r
void send(const char* alias, const Task& rTask) \r
- throw(InvalidParameterException, BadAllocException, MsgException);\r
+ throw(InvalidArgumentException, BadAllocException, MsgException);\r
\r
/* ! brief Host::send() - sends the given task to mailbox identified by the default alias\r
* (waiting at most timeout seconds).\r
*\r
* \exception [BadAllocException] if there is not enough memory to allocate\r
* the default alias variable.\r
- * [InvalidParameterException] if the timeout value is negative and different of\r
+ * [InvalidArgumentException] if the timeout value is negative and different of\r
* -1.0. \r
* [MsgException] if an internal error occurs.\r
*\r
*\r
*/\r
void send(const Task& rTask, double timeout) \r
- throw(NativeException);\r
+ throw(MsgException);\r
\r
/* ! brief Host::send() - sends the given task to mailbox identified by the parameter alias\r
* (waiting at most timeout seconds).\r
* \return If successful the task is sended to the default mailbox. Otherwise the\r
* method throws one of the exceptions described below.\r
*\r
- * \exception [InvalidParameterException] if the timeout value is negative and different of\r
+ * \exception [InvalidArgumentException] if the timeout value is negative and different of\r
* -1.0 or if the alias parameter is invalid (NULL). \r
* [MsgException] if an internal error occurs.\r
*\r
*\r
*/\r
void send(const char* alias, const Task& rTask, double timeout) \r
- throw(InvalidParameterException, MsgException);\r
+ throw(InvalidArgumentException, MsgException);\r
\r
/* ! brief Host::sendBounded() - sends the given task to mailbox associated to the default alias\r
* (capping the emission rate to maxRate).\r
* \return If successful the task is sended to the default mailbox. Otherwise the\r
* method throws one of the exceptions described below.\r
*\r
- * \exception [InvalidParameterException] if the maximum rate value is negative and different of\r
+ * \exception [InvalidArgumentException] if the maximum rate value is negative and different of\r
* -1.0. \r
* [MsgException] if an internal error occurs.\r
* [BadAllocException] if there is not enough memory to allocate\r
*\r
*/\r
void sendBounded(const Task& rTask, double maxRate) \r
- throw(InvalidParameterException, BadAllocException, MsgException);\r
+ throw(InvalidArgumentException, BadAllocException, MsgException);\r
\r
/* ! brief Host::sendBounded() - sends the given task to mailbox identified by the parameter alias\r
* (capping the emission rate to maxRate).\r
* \return If successful the task is sended to the default mailbox. Otherwise the\r
* method throws one of the exceptions described below.\r
*\r
- * \exception [InvalidParameterException] if the maximum rate value is negative and different of\r
+ * \exception [InvalidArgumentException] if the maximum rate value is negative and different of\r
* -1.0 or if the alias parameter is invalid (NULL). \r
* [MsgException] if an internal error occurs.\r
*\r
*\r
*/\r
void sendBounded(const char* alias, const Task& rTask, double maxRate) \r
- throw(InvalidParameterException, MsgException);\r
+ throw(InvalidArgumentException, MsgException);\r
\r
protected:\r
// Attributes.\r