1 /* Copyright (c) 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 //#include "ruby_simdag.h"
8 #include "rb_SD_workstation.h"
11 static void SD_workstation_free(SD_workstation_t wrk)
17 static VALUE rb_SD_workstation_list(VALUE class)
21 nb = SD_workstation_get_number();
22 VALUE workstation_list = rb_ary_new2(nb);
23 for (i = 0; i < nb; i++) {
26 Data_Wrap_Struct(class, 0, SD_workstation_free,
27 SD_workstation_get_list()[i]);
28 rb_ary_push(workstation_list, wrk);
31 return workstation_list;
35 static VALUE rb_SD_workstation_number(VALUE class)
37 int nb = SD_workstation_get_number();
42 static VALUE rb_SD_workstation_name(VALUE class, VALUE workstation)
45 Data_Get_Struct(workstation, SD_workstation_t, wk);
46 return rb_str_new2(SD_workstation_get_name(wk));