-/*\r
- * Host.hpp\r
- *\r
- * Copyright 2006,2007 Martin Quinson, Malek Cherier \r
- * All right reserved. \r
- *\r
- * This program is free software; you can redistribute \r
- * it and/or modify it under the terms of the license \r
- *(GNU LGPL) which comes with this package. \r
- *\r
- */ \r
-#ifndef MSG_HOST_HPP\r
-#define MSG_HOST_HPP\r
-\r
-\r
-/*! \brief Host class declaration.\r
- *\r
- * An host instance represents a location (any possible place) where a process may run. \r
- * Thus it is represented as a physical resource with computing capabilities, some \r
- * mailboxes to enable running process to communicate with remote ones, and some private \r
- * data that can be only accessed by local process. An instance of this class is always \r
- * binded with the corresponding native host. All the native hosts are automaticaly created \r
- * during the call of the static method Msg::createEnvironment(). This method takes as parameter\r
- * the platform file which describes all elements of the platform (host, link, root..).\r
- * You never need to create an host your self.\r
- *\r
- * The best way to get an host is to call the static method \r
- * Host.getByName() which returns a reference.\r
- *\r
- * For example to get the instance of the host. If your platform\r
- * file description contains an host named "Jacquelin" :\r
- *\r
- * \verbatim\r
-using namespace SimGrid.Msg;\r
-\r
-Host jacquelin;\r
-\r
-try \r
-{ \r
- jacquelin = Host::getByName("Jacquelin");\r
-}\r
-catch(HostNotFoundException e) \r
-{\r
- cerr << e.toString();\r
-}\r
-...\r
-\endverbatim\r
- *\r
- */\r
-\r
-#ifndef __cplusplus\r
- #error Host.hpp requires C++ compilation (use a .cxx suffix)\r
-#endif\r
-\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 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
- public :\r
- \r
- // Default constructor (desabled).\r
- Host();\r
- \r
- public: \r
- \r
- // Copy constructor (desabled).\r
- Host(const Host& rHost);\r
- \r
- // Destructor (desable).\r
- virtual ~Host();\r
- \r
- // Operations\r
- \r
- /*! \brief Host::getByName() - returns an host by its name\r
- *\r
- * This static method returns a reference to the host instance associated \r
- * with a native host of your platform. This is the best way to get a host.\r
- *\r
- * \param hostName The name of the host.\r
- *\r
- * \return If successful the method returns a reference to the instance\r
- * associated with the native host having the name specified\r
- * as parameter of your platform. Otherwise the method throws\r
- * one of the exceptions detailed below.\r
- *\r
- * \exception [HostNotFoundException] if no host with the specified name\r
- * was found.\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, InvalidArgumentException, BadAllocException);\r
- \r
- /*! \brief Host::getNumber() - returns the number of the installed hosts.\r
- *\r
- * \return The number of hosts installed.\r
- */\r
- static int getNumber(void);\r
- \r
- \r
- /*! \brief Host::currentHost() - This static method returns the location on which the current \r
- * process is executed.\r
- *\r
- * \return The host of the current process.\r
- *\r
- * \see Process::currentProcess().\r
- */\r
- static Host& currentHost(void)\r
- throw(InvalidArgumentException, BadAllocException);\r
- \r
- /*! \brief Host::all() - This static method retrieves all of the hosts of the installed platform.\r
- *\r
- * \param hosts A pointer to array of Host pointers that receives all the hosts of the platform.\r
- *\r
- * \param len A pointer to the length of the table of pointers.\r
- *\r
- * \return If successful the hosts table is filled and\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 [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
- * [BadAllocException] If the method can't allocate memory to fill\r
- * the table of hosts.\r
- *\r
- *\r
- * \remark To get the number of hosts installed on your platform use the static method\r
- * Host::getNumber().\r
- *\r
- * \see Host::getNumber().\r
- *\r
- *\verbatim\r
- * // This example show how to use this method to get the list of hosts installed on your platform.\r
- *\r
- * using namespace SimGrid::Msg;\r
- * using <iostream>\r
- *\r
- * // (1) get the number of hosts.\r
- * int number = Host::getNumber();\r
- * \r
- * // (2) allocate the array that receives the list of hosts.\r
- * HostPtr* ar = new HostPtr[number]; // HostPtr is defined as (typedef Host* HostPtr at the end of the\r
- * // declaration of this class.\r
- *\r
- * // (3) call the method\r
- * try\r
- * {\r
- * Host::all(&ar, &number);\r
- * }\r
- * catch(BadAllocException e)\r
- * {\r
- * cerr << e.toString() << endl;\r
- * ...\r
- * }\r
- * catch(InvalidArgumentException e)\r
- * {\r
- * cerr << e.toString() << endl;\r
- * ..\r
- * } \r
- *\r
- * // (4) use the table of host (for example print all the name of all the hosts);\r
- * \r
- * for(int i = 0; i < number ; i++)\r
- * cout << ar[i]->getName() << endl;\r
- *\r
- * ...\r
- * \r
- * // (5) release the allocate table\r
- * \r
- * delete[] ar;\r
- *\r
- */ \r
- static void all(Host*** hosts /*in|out*/, int* len /*in|out*/);\r
- \r
- /*! \brief Host::getName() - This method return the name of the Msg host object.\r
- *\r
- * \return The name of the host object.\r
- */\r
- const char* getName(void) const;\r
- \r
- /*! \brief Host::setData() - Set the user data of an host object.\r
- *\r
- * \param data The user data to set.\r
- */\r
- void setData(void* data);\r
- \r
- /*! \brief Host::getData() - Get the user data of a host object.\r
- *\r
- * \return The user data of the host object.\r
- */\r
- void* getData(void) const;\r
- \r
- /*! \brief Host::hasData() - Test if an host object has some data.\r
- *\r
- * \return This method returns true if the host object has some user data.\r
- * Otherwise the method returns false.\r
- */\r
- bool hasData(void) const;\r
- \r
- /*! \brief Host::getRunningTaskNumber() - returns the number of tasks currently running on a host.\r
- *\r
- * \return The number of task currently running of the host object.\r
- *\r
- * \remark The external load is not taken in account.\r
- */\r
- int getRunningTaskNumber(void) const;\r
- \r
- /*! \brief Host::getSpeed() - returns the speed of the processor of a host,\r
- * regardless of the current load of the machine.\r
- *\r
- * \return The speed of the processor of the host in flops.\r
- */ \r
- double getSpeed(void) const;\r
- \r
- /*! \brief Host::isAvailable - tests if an host is availabled.\r
- * \r
- * \return Is the host is availabled the method returns\r
- * 1. Otherwise the method returns 0.\r
- */ \r
- int isAvailable(void) const;\r
- \r
- /* ! \brief Host::put() - put a task on the given channel of a host .\r
- *\r
- * \param channel The channel where to put the task.\r
- * \param rTask A refercence to the task object containing the native task to\r
- * put on the channel specified by the parameter channel.\r
- *\r
- * \return If successful the task is puted on the specified channel. Otherwise\r
- * the method throws one of the exceptions described below.\r
- *\r
- * \exception [MsgException] if an internal error occurs.\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, 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
- * \param channel The channel where to put the task.\r
- * \param rTask A refercence to the task object containing the native task to\r
- * put on the channel specified by the parameter channel.\r
- * \param timeout The timeout in seconds.\r
- *\r
- * \return If successful the task is puted on the specified channel. Otherwise\r
- * the method throws one of the exceptions described below.\r
- *\r
- * \exception [MsgException] if an internal error occurs.\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, 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
- * \param channel The channel where to put the task.\r
- * \param rTask A refercence to the task object containing the native task to\r
- * put on the channel specified by the parameter channel.\r
- * \param maxRate The maximum rate.\r
- *\r
- * \return If successful the task is puted on the specified channel. Otherwise\r
- * the method throws one of the exceptions described below.\r
- *\r
- * \exception [MsgException] if an internal error occurs.\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, InvalidArgumentException);\r
- \r
- /* ! brief Host::send() - sends the given task to mailbox identified by the default alias.\r
- *\r
- * \param rTask A reference to the task object containing the native msg task to send.\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 [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 Task& rTask) \r
- throw(BadAllocException, MsgException);\r
- \r
- /* ! brief Host::send() - sends the given task to mailbox identified by the specified alias parameter.\r
- *\r
- * \param rTask A reference to the task object containing the native msg task to send.\r
- * \param alias The alias of the mailbox where to send the task.\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 [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(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
- * \param rTask A reference to the task object containing the native msg task to send.\r
- * \param timeout The timeout value to wait for.\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 [BadAllocException] if there is not enough memory to allocate\r
- * the default alias variable.\r
- * [InvalidArgumentException] if the timeout value is negative and different of\r
- * -1.0. \r
- * [MsgException] if an internal error occurs.\r
- *\r
- * \remark To specify no timeout set the timeout value with -1.0 or use the previous \r
- * version of this method.\r
- *\r
- */\r
- void send(const Task& rTask, double timeout) \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
- *\r
- * \param alias The alias of the mailbox to send the task.\r
- * \param rTask A reference to the task object containing the native msg task to send.\r
- * \param timeout The timeout value to wait for.\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 [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
- * \remark To specify no timeout set the timeout value with -1.0 or use the previous \r
- * version of this method.\r
- *\r
- */\r
- void send(const char* alias, const Task& rTask, double timeout) \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
- *\r
- * \param rTask A reference to the task object containing the native msg task to send.\r
- * \param maxRate The maximum rate value.\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 [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
- * the default alias variable.\r
- *\r
- * \remark To specify no rate set its value with -1.0.\r
- *\r
- */\r
- void sendBounded(const Task& rTask, double maxRate) \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
- *\r
- * \param alias The alias of the mailbox where to send the task.\r
- * \param rTask A reference to the task object containing the native msg task to send.\r
- * \param maxRate The maximum rate value.\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 [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
- * \remark To specify no rate set its value with -1.0.\r
- *\r
- */\r
- void sendBounded(const char* alias, const Task& rTask, double maxRate) \r
- throw(InvalidArgumentException, MsgException);\r
- \r
- protected:\r
- // Attributes.\r
- \r
- /**\r
- * This attribute represents the msg native host object. \r
- * It is set automaticatly during the call of the static \r
- * method Host::getByName().\r
- *\r
- * \see Host::getByName().\r
- */ \r
- m_host_t nativeHost;\r
- \r
- private:\r
- /**\r
- * User host data. \r
- */ \r
- void* data;\r
- };\r
- \r
- typedef Host* HostPtr;\r
- } // namespace Msg\r
-} // namespace SimGrid\r
-\r
-#endif // !MSG_HOST_HPP
\ No newline at end of file
+/*
+ * Host.hpp
+ *
+ * Copyright 2006,2007 Martin Quinson, Malek Cherier
+ * All right reserved.
+ *
+ * This program is free software; you can redistribute
+ * it and/or modify it under the terms of the license
+ *(GNU LGPL) which comes with this package.
+ *
+ */
+#ifndef MSG_HOST_HPP
+#define MSG_HOST_HPP
+
+
+/*! \brief Host class declaration.
+ *
+ * An host instance represents a location (any possible place) where a process may run.
+ * Thus it is represented as a physical resource with computing capabilities, some
+ * mailboxes to enable running process to communicate with remote ones, and some private
+ * data that can be only accessed by local process. An instance of this class is always
+ * binded with the corresponding native host. All the native hosts are automaticaly created
+ * during the call of the static method Msg::createEnvironment(). This method takes as parameter
+ * the platform file which describes all elements of the platform (host, link, root..).
+ * You never need to create an host your self.
+ *
+ * The best way to get an host is to call the static method
+ * Host.getByName() which returns a reference.
+ *
+ * For example to get the instance of the host. If your platform
+ * file description contains an host named "Jacquelin" :
+ *
+ * \verbatim
+using namespace SimGrid.Msg;
+
+Host jacquelin;
+
+try
+{
+ jacquelin = Host::getByName("Jacquelin");
+}
+catch(HostNotFoundException e)
+{
+ cerr << e.toString();
+}
+...
+\endverbatim
+ *
+ */
+
+#ifndef __cplusplus
+ #error Host.hpp requires C++ compilation (use a .cxx suffix)
+#endif
+
+#include <msg/datatypes.h>
+
+#include <InvalidArgumentException.hpp>
+#include <BadAllocException.hpp>
+#include <HostNotFoundException.hpp>
+#include <MsgException.hpp>
+#include <NullPointerException.hpp>
+
+
+
+// namespace SimGrid::Msg
+namespace SimGrid
+{
+ namespace Msg
+ {
+ class Task;
+ class Process;
+
+ // Declaration of the class SimGrid::Msg::Host.
+ class SIMGRIDX_EXPORT Host // final class.
+ {
+ friend class Process;
+ friend class Task;
+
+ // Desable the default constructor.
+ // The best way to get an host instance is to use the static method Host::getByName().
+
+ public :
+
+ // Default constructor (desabled).
+ Host();
+
+ public:
+
+ // Copy constructor (desabled).
+ Host(const Host& rHost);
+
+ // Destructor (desable).
+ virtual ~Host();
+
+ // Operations
+
+ /*! \brief Host::getByName() - returns an host by its name
+ *
+ * This static method returns a reference to the host instance associated
+ * with a native host of your platform. This is the best way to get a host.
+ *
+ * \param hostName The name of the host.
+ *
+ * \return If successful the method returns a reference to the instance
+ * associated with the native host having the name specified
+ * as parameter of your platform. Otherwise the method throws
+ * one of the exceptions detailed below.
+ *
+ * \exception [HostNotFoundException] if no host with the specified name
+ * was found.
+ * [InvalidArgumentException] if the hostName parameter is invalid (NULL).
+ * [BadAllocException] if there is not enough memory to allocate the host.
+ */
+ static Host& getByName(const char* hostName)
+ throw(HostNotFoundException, NullPointerException, BadAllocException);
+
+ /*! \brief Host::getNumber() - returns the number of the installed hosts.
+ *
+ * \return The number of hosts installed.
+ */
+ static int getNumber(void);
+
+
+ /*! \brief Host::currentHost() - This static method returns the location on which the current
+ * process is executed.
+ *
+ * \return The host of the current process.
+ *
+ * \see Process::currentProcess().
+ */
+ static Host& currentHost(void);
+
+ /*! \brief Host::all() - This static method retrieves all of the hosts of the installed platform.
+ *
+ * \param hosts A pointer to array of Host pointers that receives all the hosts of the platform.
+ *
+ * \param len A pointer to the length of the table of pointers.
+ *
+ * \return If successful the hosts table is filled and
+ * the parameter len is set with the number of hosts of the platform.
+ * Otherwise the method throw one of the exception described below.
+ *
+ * \exception [InvalidArgumentException] if the parameter hosts is invalid or
+ * if the parameter len is negative or
+ * less than the number of hosts installed
+ * on the current platform.
+ * [BadAllocException] If the method can't allocate memory to fill
+ * the table of hosts.
+ *
+ *
+ * \remark To get the number of hosts installed on your platform use the static method
+ * Host::getNumber().
+ *
+ * \see Host::getNumber().
+ *
+ *\verbatim
+ * // This example show how to use this method to get the list of hosts installed on your platform.
+ *
+ * using namespace SimGrid::Msg;
+ * using <iostream>
+ *
+ * // (1) get the number of hosts.
+ * int number = Host::getNumber();
+ *
+ * // (2) allocate the array that receives the list of hosts.
+ * HostPtr* ar = new HostPtr[number]; // HostPtr is defined as (typedef Host* HostPtr at the end of the
+ * // declaration of this class.
+ *
+ * // (3) call the method
+ * try
+ * {
+ * Host::all(&ar, &number);
+ * }
+ * catch(BadAllocException e)
+ * {
+ * cerr << e.toString() << endl;
+ * ...
+ * }
+ * catch(InvalidArgumentException e)
+ * {
+ * cerr << e.toString() << endl;
+ * ..
+ * }
+ *
+ * // (4) use the table of host (for example print all the name of all the hosts);
+ *
+ * for(int i = 0; i < number ; i++)
+ * cout << ar[i]->getName() << endl;
+ *
+ * ...
+ *
+ * // (5) release the allocate table
+ *
+ * delete[] ar;
+ *
+ */
+ static void all(Host*** hosts /*in|out*/, int* len /*in|out*/)
+ throw(InvalidArgumentException, BadAllocException) ;
+
+ /*! \brief Host::getName() - This method return the name of the Msg host object.
+ *
+ * \return The name of the host object.
+ */
+ const char* getName(void) const;
+
+ /*! \brief Host::setData() - Set the user data of an host object.
+ *
+ * \param data The user data to set.
+ */
+ void setData(void* data);
+
+ /*! \brief Host::getData() - Get the user data of a host object.
+ *
+ * \return The user data of the host object.
+ */
+ void* getData(void) const;
+
+ /*! \brief Host::hasData() - Test if an host object has some data.
+ *
+ * \return This method returns true if the host object has some user data.
+ * Otherwise the method returns false.
+ */
+ bool hasData(void) const;
+
+ /*! \brief Host::getRunningTaskNumber() - returns the number of tasks currently running on a host.
+ *
+ * \return The number of task currently running of the host object.
+ *
+ * \remark The external load is not taken in account.
+ */
+ int getRunningTaskNumber(void) const;
+
+ /*! \brief Host::getSpeed() - returns the speed of the processor of a host,
+ * regardless of the current load of the machine.
+ *
+ * \return The speed of the processor of the host in flops.
+ */
+ double getSpeed(void) const;
+
+ /*! \brief Host::isAvailable - tests if an host is availabled.
+ *
+ * \return Is the host is availabled the method returns
+ * 1. Otherwise the method returns 0.
+ */
+ int isAvailable(void) const;
+
+ /* ! \brief Host::put() - put a task on the given channel of a host .
+ *
+ * \param channel The channel where to put the task.
+ * \param rTask A refercence to the task object containing the native task to
+ * put on the channel specified by the parameter channel.
+ *
+ * \return If successful the task is puted on the specified channel. Otherwise
+ * the method throws one of the exceptions described below.
+ *
+ * \exception [MsgException] if an internal error occurs.
+ * [InvalidArgumentException] if the value of the channel specified as
+ * parameter is negative.
+ */
+ void put(int channel, Task* task)
+ throw(MsgException, InvalidArgumentException);
+
+ /* ! \brief Host::put() - put a task on the given channel of a host object (waiting at most timeout seconds).
+ *
+ * \param channel The channel where to put the task.
+ * \param rTask A refercence to the task object containing the native task to
+ * put on the channel specified by the parameter channel.
+ * \param timeout The timeout in seconds.
+ *
+ * \return If successful the task is puted on the specified channel. Otherwise
+ * the method throws one of the exceptions described below.
+ *
+ * \exception [MsgException] if an internal error occurs.
+ * [InvalidArgumentException] if the value of the channel specified as
+ * parameter is negative or if the timeout value
+ * is less than zero and différent of -1.
+ *
+ * \remark To specify no timeout set the timeout value with -1.0.
+ */
+ void put(int channel, Task* task, double timeout)
+ throw(MsgException, InvalidArgumentException);
+
+ /* ! \brief Host::putBounded() - put a task on the given channel of a host object (capping the emission rate to maxrate).
+ *
+ * \param channel The channel where to put the task.
+ * \param rTask A refercence to the task object containing the native task to
+ * put on the channel specified by the parameter channel.
+ * \param maxRate The maximum rate.
+ *
+ * \return If successful the task is puted on the specified channel. Otherwise
+ * the method throws one of the exceptions described below.
+ *
+ * \exception [MsgException] if an internal error occurs.
+ * [InvalidArgumentException] if the value of the channel specified as
+ * parameter is negative or if the maxRate parameter value
+ * is less than zero and différent of -1.0.
+ *
+ * \remark To specify no rate set the maxRate parameter value with -1.0.
+ */
+ void putBounded(int channel, Task* task, double maxRate)
+ throw(MsgException, InvalidArgumentException);
+
+ /* ! brief Host::send() - sends the given task to mailbox identified by the default alias.
+ *
+ * \param rTask A reference to the task object containing the native msg task to send.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [BadAllocException] if there is not enough memory to allocate
+ * the default alias variable.
+ * [MsgException] if an internal error occurs.
+ */
+ void send(Task* task)
+ throw(MsgException, BadAllocException);
+
+ /* ! brief Host::send() - sends the given task to mailbox identified by the specified alias parameter.
+ *
+ * \param rTask A reference to the task object containing the native msg task to send.
+ * \param alias The alias of the mailbox where to send the task.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [InvalidArgumentException] if alias parameter is invalid (NULL).
+ * [BadAllocException] if there is not enough memory to allocate
+ * the default alias variable.
+ * [MsgException] if an internal error occurs.
+ */
+ void send(const char* alias, Task* task)
+ throw(InvalidArgumentException, MsgException);
+
+ /* ! brief Host::send() - sends the given task to mailbox identified by the default alias
+ * (waiting at most timeout seconds).
+ *
+ * \param rTask A reference to the task object containing the native msg task to send.
+ * \param timeout The timeout value to wait for.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [BadAllocException] if there is not enough memory to allocate
+ * the default alias variable.
+ * [InvalidArgumentException] if the timeout value is negative and different of
+ * -1.0.
+ * [MsgException] if an internal error occurs.
+ *
+ * \remark To specify no timeout set the timeout value with -1.0 or use the previous
+ * version of this method.
+ *
+ */
+ void send(Task* task, double timeout)
+ throw(InvalidArgumentException, BadAllocException, MsgException);
+
+ /* ! brief Host::send() - sends the given task to mailbox identified by the parameter alias
+ * (waiting at most timeout seconds).
+ *
+ * \param alias The alias of the mailbox to send the task.
+ * \param rTask A reference to the task object containing the native msg task to send.
+ * \param timeout The timeout value to wait for.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [InvalidArgumentException] if the timeout value is negative and different of
+ * -1.0 or if the alias parameter is invalid (NULL).
+ * [MsgException] if an internal error occurs.
+ *
+ * \remark To specify no timeout set the timeout value with -1.0 or use the previous
+ * version of this method.
+ *
+ */
+ void send(const char* alias, Task* task, double timeout)
+ throw(InvalidArgumentException, MsgException);
+
+ /* ! brief Host::sendBounded() - sends the given task to mailbox associated to the default alias
+ * (capping the emission rate to maxRate).
+ *
+ * \param rTask A reference to the task object containing the native msg task to send.
+ * \param maxRate The maximum rate value.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [InvalidArgumentException] if the maximum rate value is negative and different of
+ * -1.0.
+ * [MsgException] if an internal error occurs.
+ * [BadAllocException] if there is not enough memory to allocate
+ * the default alias variable.
+ *
+ * \remark To specify no rate set its value with -1.0.
+ *
+ */
+ void sendBounded(Task* task, double maxRate)
+ throw(InvalidArgumentException, BadAllocException, MsgException);
+
+ /* ! brief Host::sendBounded() - sends the given task to mailbox identified by the parameter alias
+ * (capping the emission rate to maxRate).
+ *
+ * \param alias The alias of the mailbox where to send the task.
+ * \param rTask A reference to the task object containing the native msg task to send.
+ * \param maxRate The maximum rate value.
+ *
+ * \return If successful the task is sended to the default mailbox. Otherwise the
+ * method throws one of the exceptions described below.
+ *
+ * \exception [InvalidArgumentException] if the maximum rate value is negative and different of
+ * -1.0 or if the alias parameter is invalid (NULL).
+ * [MsgException] if an internal error occurs.
+ *
+ * \remark To specify no rate set its value with -1.0.
+ *
+ */
+ void sendBounded(const char* alias, Task* task, double maxRate)
+ throw(InvalidArgumentException, MsgException);
+
+ protected:
+ // Attributes.
+
+ /**
+ * This attribute represents the msg native host object.
+ * It is set automaticatly during the call of the static
+ * method Host::getByName().
+ *
+ * \see Host::getByName().
+ */
+ m_host_t nativeHost;
+
+ private:
+ /**
+ * User host data.
+ */
+ void* data;
+ };
+
+ typedef Host* HostPtr;
+ } // namespace Msg
+} // namespace SimGrid
+
+#endif // !MSG_HOST_HPP