Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
require 'simgrid_ruby'
[simgrid.git] / src / bindings / ruby / simgrid.rb
index 30dc1df..09bb9ce 100644 (file)
@@ -9,7 +9,7 @@ require 'simgrid_ruby'
 require 'thread'
 
 #######################################
-#  Semaphore
+#  Semaphore 
 #######################################
 
 class Semaphore
@@ -72,7 +72,6 @@ class MSG::Process < Thread
     @name = args[0]
     @pargs = args[1]
     @properties = args[2]
-      
     start()
       }
     end
@@ -83,7 +82,7 @@ class MSG::Process < Thread
   end
      
   def start()
-     @schedBegin.acquire
+    @schedBegin.acquire
     MSG::debug("Let's execute the main() of the Ruby process")
     main(@pargs)
     @schedEnd.release
@@ -126,27 +125,38 @@ class MSG::Process < Thread
     processGetHost(self)
   end
 
-# The Rest of Methods !!! To be Continued ... FIXME: what's missing?
 end
 ############################################
 # Task Extend from the native Class RbTask
 ############################################
 class MSG::Task < MSG::RbTask
-
+  
   def initialize(*args)
-     super()
+    #Nothing todo   
+  end
+  
+  def join(value) 
+    super(self,value)
+  end
+  
+  def data()
+    super(self)
   end
   
   def name
-     super(self)
+   super(self)
   end
   
   def compSize
-     super(self)
+    super(self)
   end
   
   def send(mailbox)
-    super(self,mailbox)
+   super(self,mailbox)
+  end
+  
+  def receive(mailbox)
+    super(self)
   end
   
   def source
@@ -158,7 +168,7 @@ class MSG::Task < MSG::RbTask
   end
   
   def listen(t_alias)
-    super(t_alias)
+    super(self)
   end
   
   def execute
@@ -166,13 +176,42 @@ class MSG::Task < MSG::RbTask
   end
     
   def listenFromHost(t_alias,host)
-    super(t_alias,host)
+    super(self)
+  end
+  
+  def setPriority(priority)
+    super(self,priority)
+  end
+  
+  def cancel
+    super(self)
   end
+  
+  def hasData
+    super(self)
+  end
+   
 end  
+
 ####################################################
 # Host Extend from the native Class RbHost
 ####################################################
 class MSG::Host < MSG::RbHost
+  
+  attr_reader :data
+  def initialize(*ars)
+    @data = 1
+    p "Host Initializer"
+  end
+  
+  def data()
+    return @data
+  end
+  
+  def setData(value)
+    @data = value
+  end
+  
   def getByName(name)
     super(name)
   end
@@ -189,10 +228,6 @@ class MSG::Host < MSG::RbHost
     super(self)
   end
   
-  def setData(data)
-    super(self,data)
-  end
-  
   def isAvail
     super(self)
   end
@@ -200,8 +235,13 @@ class MSG::Host < MSG::RbHost
   def number
     super()
   end
+  
+  def getHostProcess(process)
+    super(process)
+  end
+    
 end
 #########################
 # Main chunck 
 #########################
-MSG.init(ARGV)
\ No newline at end of file
+MSG.init(ARGV)