Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7083 48e7efb5...
[simgrid.git] / src / bindings / ruby / ProcessFactory.rb
1 require 'RubyProcess'
2 require 'RubyHost'
3 class ProcessFactory 
4
5 #     Attributes
6    attr_accessor :args, :proprieties, :hostName, :function
7 #    Initlialize
8     def initialize()
9     
10     @args = Array.new
11     @proprieties = Hash.new
12     @hostName = nil
13     @function = nil
14     
15     end
16     
17 #     setProcessIdentity
18     
19     def setProcessIdentity(hostName,function)
20       @hostName = hostName
21       @function = function
22       
23       if !args.empty?
24         args.clear
25       end
26       
27       if !proprieties.empty?
28         proprieties.clear   
29       end
30     
31     end
32
33 #     RegisterProcess
34     
35     def registerProcessArg( arg )
36       
37       args.push(arg)
38       
39     end
40
41 #     CreateProcess
42     def createProcess()
43       
44       process = rubyNewInstance(@function) 
45 #       process = rubyNewInstanceArgs(@function,@args)
46       
47       process.name = @function
48       process.id = process.nextId() # This increment Automaticly  The Static ProcessNextId for The Class RbProces
49 #       host = RbHost.getByName(@hostName)
50 #       Process.createProcess(process,host)
51       size = @args.size
52       for i in 0..size-1
53         process.pargs.push(@args[i])
54       end
55       process.proprieties = @proprieties
56       @proprieties = Hash.new
57       
58     end
59     
60 #     SetProperty
61     def setProperty(id,value)
62       
63       @proprieties[id] = value
64       
65     end
66     
67 #     End Class
68   end