host = MSG_process_get_host(process);
return Data_Wrap_Struct(class, 0, rb_host_free, host);
-
-
-}
\ No newline at end of file
+
+}
+
+// get all hosts
+VALUE rb_host_get_all_hosts(VALUE class)
+{
+ int index;
+ VALUE hosts_table;
+ VALUE rbHost;
+ m_host_t host;
+
+ int count = xbt_fifo_size(msg_global->host);
+ m_host_t *table = (m_host_t *)xbt_fifo_to_array(msg_global->host);
+ hosts_table = rb_ary_new2(count);
+
+ for (index=0;index<count;index++)
+ {
+ rbHost = Qnil;
+ host = table[index];
+ rbHost = Data_Wrap_Struct(class, 0, rb_host_free, host);
+ rb_ary_push(hosts_table,rbHost);
+ }
+
+ return hosts_table;
+}
rb_define_module_function(rb_host,"number",(rb_meth)rb_host_number,0);
rb_define_module_function(rb_host,"isAvail",(rb_meth)rb_host_is_avail,1);
rb_define_module_function(rb_host,"getHostProcess",(rb_meth)rb_host_process,1);
-}
\ No newline at end of file
+ rb_define_module_function(rb_host,"all",(rb_meth)rb_host_get_all_hosts,0);
+}
*/
#include "msg/msg.h"
+#include "msg/private.h"
#include "msg/datatypes.h"
#include "surf/surfxml_parse.h"
VALUE rb_host_get_data(VALUE Class,VALUE host);
VALUE rb_host_is_avail(VALUE Class,VALUE host);
VALUE rb_host_process(VALUE Class,VALUE process);
+VALUE rb_host_get_all_hosts(VALUE Class);
/* Functions related to tasks */
void rb_task_free(m_task_t tk);