Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill the MSG_paje_output() function. It's a noop since 2 years
[simgrid.git] / src / bindings / ruby / ProcessFactory.rb
1
2 #  * $Id$
3 #  *
4 #  * Copyright 2010 Martin Quinson, Mehdi Fekari           
5 #  * All right reserved. 
6 #  *
7 #  * This program is free software; you can redistribute 
8 #  * it and/or modify it under the terms of the license 
9 #  *(GNU LGPL) which comes with this package. 
10 require 'RubyProcess'
11 require 'RubyHost'
12 class ProcessFactory 
13
14 #     Attributes
15    attr_accessor :args, :proprieties, :hostName, :function
16 #    Initlialize
17     def initialize()
18     
19     @args = Array.new
20     @proprieties = Hash.new
21     @hostName = nil
22     @function = nil
23     
24     end
25     
26 #     setProcessIdentity
27     def setProcessIdentity(hostName,function)
28       @hostName = hostName
29       @function = function
30       
31       if !args.empty?
32         args.clear
33       end
34       
35       if !proprieties.empty?
36         proprieties.clear   
37       end
38     
39     end
40
41 #     RegisterProcess  
42     def registerProcessArg(arg)
43       
44       @args.push(arg)
45       
46     end
47
48 #     CreateProcess
49     def createProcess()
50       
51       process = rubyNewInstance(@function) #process = rubyNewInstanceArgs(@function,@args) #
52       size = @args.size
53       for i in 0..size-1
54         process.pargs.push(@args[i]) 
55       end
56       process.name = @function
57       process.id = process.nextId() # This increment Automaticly  The Static ProcessNextId for The Class RbProces
58       host = RbHost.getByName(@hostName)
59       processCreate(process,host)
60       process.proprieties = @proprieties
61       @proprieties = Hash.new
62       
63     end
64     
65 #     SetProperty
66     def setProperty(id,value)
67       @proprieties[id] = value
68     end
69     
70 #     End Class
71   end