Class: FSEvent::ProcessDeviceC
- Inherits:
-
AbstractDevice
- Object
- AbstractDevice
- FSEvent::ProcessDeviceC
- Defined in:
- lib/fsevent/processdevicec.rb
Overview
processdevicec.rb — child process code for processdevice.rb
Copyright © 2014 National Institute of Advanced Industrial Science and Technology (AIST)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.
Defined Under Namespace
Classes: StubFramework
Instance Attribute Summary
Attributes inherited from AbstractDevice
Class Method Summary collapse
Instance Method Summary collapse
- #call_parent(method, *args) ⇒ Object
-
#initialize(device_name) ⇒ ProcessDeviceC
constructor
A new instance of ProcessDeviceC.
- #processdevice_framework_set ⇒ Object
- #processdevice_registered ⇒ Object
Methods inherited from AbstractDevice
#add_watch, #define_status, #registered, #run, #set_elapsed_time, #status_changed, #unregister_device, #unregistered
Constructor Details
#initialize(device_name) ⇒ ProcessDeviceC
Returns a new instance of ProcessDeviceC.
33 34 35 |
# File 'lib/fsevent/processdevicec.rb', line 33 def initialize(device_name) super(device_name) end |
Class Method Details
.main(this_device) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fsevent/processdevicec.rb', line 63 def self.main(this_device) STDOUT.sync = true while true begin msgtype, *rest = Marshal.load(STDIN) rescue EOFError exit true end if msgtype != :call_child raise RuntimeError, "unexpected message type: #{msgtype.inspect}" end method, *args = rest ret = this_device.send(method, *args) Marshal.dump([:return_to_parent, ret], STDOUT) end end |
Instance Method Details
#call_parent(method, *args) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fsevent/processdevicec.rb', line 48 def call_parent(method, *args) Marshal.dump([:call_parent, method, *args], STDOUT) msgtype, *rest = Marshal.load(STDIN) while msgtype == :call_child method, *args = rest ret = self.send(method, *args) Marshal.dump([:return_to_parent, ret], STDOUT) msgtype, *rest = Marshal.load(STDIN) end if msgtype != :return_to_child raise RuntimeError, "unexpected message type: #{msgtype.inspect}" end rest[0] end |
#processdevice_framework_set ⇒ Object
37 38 39 40 41 |
# File 'lib/fsevent/processdevicec.rb', line 37 def processdevice_framework_set framework = StubFramework.new(self) self.framework = framework nil end |
#processdevice_registered ⇒ Object
43 44 45 46 |
# File 'lib/fsevent/processdevicec.rb', line 43 def processdevice_registered registered nil end |