Module: NumRu::NetCDFVarDeferred
- Defined in:
- lib/numru/gphys/varraynetcdf.rb
Constant Summary collapse
- @@max_len_store =
To be “extend”ed in a NetCDFVar object to add simgular methods to support deferred operations. Used together with NetCDFDeferred.
1000000
- @@len_stored =
regardress sizeof(type)
0
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.flushed_length(len) ⇒ Object
74 75 76 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 74 def flushed_length(len) @@len_stored -= len end |
.max_len_store ⇒ Object
77 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 77 def max_len_store; max_len_store; end |
.max_len_store=(l) ⇒ Object
78 79 80 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 78 def max_len_store= (l) @@max_len_store = l end |
Instance Method Details
#name=(*args) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 83 def name=(*args) begin super(*args) rescue file.redef #retry <- this will introduce endless loop super(*args) end end |
#put(*args) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 103 def put(*args) if(self.file.define_mode?) if (@@len_stored < @@max_len_store) ## put operation is stored in self.file and deferred print "## storing (put) ##\n" if ($DEBUG) len = args[0].is_a?(Numeric) ? 1 : args[0].total self.file.add_deferred( Proc.new{|args| current_put(*args)}, args, len) @@len_stored += len else self.file.enddef current_put(*args) self.file.redef end else self.file.flush current_put(*args) end end |
#put_att(*args) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/numru/gphys/varraynetcdf.rb', line 93 def put_att(*args) begin super(*args) rescue file.redef #retry <- this will introduce endless loop super(*args) end end |