+ MSG_error_t rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ \r
+\r
+ rv = MSG_task_send_with_timeout(nativeTask, alias, -1.0);\r
+\r
+ free(alias)\r
+\r
+ if(MSG_OK != rv)\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+}\r
+\r
+\r
+void Task::send(const char* alias) \r
+throw(NativeException)\r
+{\r
+\r
+ if(MSG_OK != MSG_task_send_with_timeout(nativeTask, alias, -1.0))\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+}\r
+\r
+void Task::send(double timeout) \r
+throw(NativeException)\r
+{\r
+ MSG_error_t rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ \r
+\r
+ rv = MSG_task_send_with_timeout(nativeTask, alias, timeout);\r
+\r
+ free(alias)\r
+\r
+ if(MSG_OK != rv)\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+} \r
+\r
+void Task::send(const char* alias, double timeout) \r
+throw(NativeException)\r
+{\r
+ if(MSG_OK != MSG_task_send_with_timeout(nativeTask, alias, timeout))\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+}\r
+\r
+void Task::sendBounded(double maxRate) \r
+throw(NativeException)\r
+{\r
+ MSG_error_t rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ rv = MSG_task_send_bounded(nativeTask, alias, maxRate);\r
+ \r
+ free(alias);\r
+ \r
+ \r
+ \r
+ if(MSG_OK != rv)\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+}\r
+\r
+void Task::sendBounded(const char* alias, double maxRate) \r
+throw(NativeException)\r
+{\r
+ if(MSG_OK != MSG_task_send_bounded(nativeTask, alias, maxRate))\r
+ {\r
+ // TODO throw the NativeException\r
+ }\r
+}\r
+\r
+Task& Task::receive(void) \r
+throw(NativeException)\r
+{\r
+ MSG_error_t rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ m_task_t nativeTask = NULL;\r
+ \r
+ rv = MSG_task_receive_ext(&nativeTask, alias, -1.0, NULL); \r
+\r
+ free(alias);\r
+ \r
+ if(MSG_OK != rv) \r
+ {\r
+ // TODO thow NativeException\r
+ return NULL;\r
+ }\r
+\r
+ return (*((Task*)nativeTask->data));\r
+}\r
+\r
+Task& Task::receive(const char* alias) \r
+throw(NativeException)\r
+{\r
+ m_task_t nativeTask = NULL;\r
+ \r
+ if(MSG_OK != MSG_task_receive_ext(&nativeTask, alias, -1.0, NULL)) \r
+ {\r
+ // TODO thow NativeException\r
+ return NULL;\r
+ }\r
+\r
+ return (*((Task*)nativeTask->data));\r
+}\r
+\r
+Task& Task::receive(const char* alias, double timeout) \r
+throw(NativeException)\r
+{\r
+ m_task_t nativeTask = NULL;\r
+ \r
+ if(MSG_OK != MSG_task_receive_ext(&nativeTask, alias, timeout, NULL)) \r
+ {\r
+ // TODO thow NativeException\r
+ return NULL;\r
+ }\r
+\r
+ return (*((Task*)nativeTask->data));\r
+}\r
+\r
+Task& Task::receive(const char* alias, const Host& rHost) \r
+throw(NativeException)\r
+{\r
+ m_task_t nativeTask = NULL;\r
+ \r
+ \r
+ if(MSG_OK != MSG_task_receive_ext(&nativeTask, alias, -1.0, rHost.nativeHost)) \r
+ {\r
+ // TODO thow NativeException\r
+ return NULL;\r
+ }\r
+\r
+ return (*((Task*)nativeTask->data));\r
+} \r
+\r
+Task& Task::receive(const char* alias, double timeout, const Host& rHost) \r
+throw(NativeException)\r
+{\r
+ m_task_t nativeTask = NULL;\r
+ \r
+ \r
+ if(MSG_OK != MSG_task_receive_ext(&nativeTask, alias, timeout, rHost.nativeHost)) \r
+ {\r
+ // TODO thow NativeException\r
+ return NULL;\r
+ }\r
+\r
+ return (*((Task*)nativeTask->data));\r
+}\r
+\r
+bool Task::listen(void) \r
+throw(NativeException)\r
+{\r
+ int rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ rv = MSG_task_listen(alias);\r
+ \r
+ free(alias);\r
+ \r
+ return (bool)rv;\r
+} \r
+\r
+bool Task::listen(const char* alias) \r
+throw(NativeException)\r
+{\r
+ return (bool)MSG_task_listen(alias);\r
+}\r
+\r
+bool Task::listenFrom(void) \r
+throw(NativeException)\r
+{\r
+ int rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ rv = MSG_task_listen_from(alias);\r
+ \r
+ free(alias);\r
+ \r
+ return (int)rv;\r
+} \r
+\r
+bool Task::listenFrom(const char* alias) \r
+throw(NativeException)\r
+{\r
+ return (bool)MSG_task_listen_from(alias);\r
+ \r
+}\r
+\r
+bool Task::listenFromHost(const Host& rHost) \r
+throw(NativeException)\r
+{\r
+ int rv;\r
+ \r
+ char* alias = (char*)calloc(strlen(Process::currentProcess().getName() + strlen(Host::currentHost().getName()) + 2);\r
+ sprintf(alias,"%s:%s", Process::currentProcess().getName(),Host::currentHost().getName());\r
+ \r
+ rv = MSG_task_listen_from_host(alias, rHost.nativeHost);\r
+ \r
+ free(alias);\r
+ \r
+ return (bool)rv;\r
+}\r
+ \r
+bool Task::listenFromHost(const char* alias, const Host& rHost) \r
+throw(NativeException)\r
+{\r
+ return (bool)MSG_task_listen_from_host(alias, rHost.nativeHost);\r
+} \r