Class: Store
- Defined in:
- lib/erbpp/narray_def.rb,
ext/numo/narray/gen/narray_def.rb
Overview
Direct Known Subclasses
Constant Summary collapse
- DEFS =
[]
Constants inherited from ErbPP
Instance Attribute Summary collapse
-
#dtype ⇒ Object
readonly
Returns the value of attribute dtype.
-
#macro ⇒ Object
readonly
Returns the value of attribute macro.
-
#tmpl ⇒ Object
readonly
Returns the value of attribute tmpl.
-
#tpclass ⇒ Object
readonly
Returns the value of attribute tpclass.
-
#tpname ⇒ Object
readonly
Returns the value of attribute tpname.
Attributes inherited from ErbPP
Class Method Summary collapse
Instance Method Summary collapse
- #c_func(n = nil) ⇒ Object
- #c_iter ⇒ Object
- #condition(klass) ⇒ Object
- #definition ⇒ Object
- #extract_data(ptr, pos, x) ⇒ Object
-
#initialize(parent, tmpl, tpname, dtype, tpclass, macro) ⇒ Store
constructor
A new instance of Store.
Methods inherited from DefMethod
#c_name, #define_method_args, #id_op, #init_def, #op_map, #singleton
Methods included from DeclMethod
#def_alias, #def_alloc_func, #def_const, #def_method, #def_module_function, #def_singleton_method, #undef_alloc_func, #undef_method, #undef_singleton_method
Methods inherited from ErbPP
#add_child, #attr_method, #attrs, #check_params, define_attrs, #description, #find, #find_tmpl, #get, #has_attr?, #init_def, #load_erb, #method_missing, #method_missing_alias, #parents, #result, #run, #search_method_in_parents, #set, #write
Constructor Details
#initialize(parent, tmpl, tpname, dtype, tpclass, macro) ⇒ Store
Returns a new instance of Store.
291 292 293 294 295 296 297 298 |
# File 'lib/erbpp/narray_def.rb', line 291 def initialize(parent,tmpl,tpname,dtype,tpclass,macro) super(parent,tmpl) @tpname=tpname @dtype=dtype @tpclass=tpclass @macro=macro DEFS.push(self) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ErbPP
Instance Attribute Details
#dtype ⇒ Object (readonly)
Returns the value of attribute dtype.
299 300 301 |
# File 'lib/erbpp/narray_def.rb', line 299 def dtype @dtype end |
#macro ⇒ Object (readonly)
Returns the value of attribute macro.
299 300 301 |
# File 'lib/erbpp/narray_def.rb', line 299 def macro @macro end |
#tmpl ⇒ Object (readonly)
Returns the value of attribute tmpl.
299 300 301 |
# File 'lib/erbpp/narray_def.rb', line 299 def tmpl @tmpl end |
#tpclass ⇒ Object (readonly)
Returns the value of attribute tpclass.
299 300 301 |
# File 'lib/erbpp/narray_def.rb', line 299 def tpclass @tpclass end |
#tpname ⇒ Object (readonly)
Returns the value of attribute tpname.
299 300 301 |
# File 'lib/erbpp/narray_def.rb', line 299 def tpname @tpname end |
Class Method Details
.definitions ⇒ Object
330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/erbpp/narray_def.rb', line 330 def self.definitions a = [] DEFS.each do |x| if x.condition("") if x.tpname == x.parents[0].class_name.downcase a.unshift(x) else a.push(x) end end end a end |
Instance Method Details
#c_func(n = nil) ⇒ Object
301 302 303 |
# File 'lib/erbpp/narray_def.rb', line 301 def c_func "numo_#{tp}_store_#{tpname}" end |
#c_iter ⇒ Object
305 306 307 |
# File 'lib/erbpp/narray_def.rb', line 305 def c_iter "iter_#{tp}_store_#{tpname}" end |
#condition(klass) ⇒ Object
313 314 315 |
# File 'lib/erbpp/narray_def.rb', line 313 def condition(klass) "#{klass}==#{tpclass}" end |
#definition ⇒ Object
309 310 311 |
# File 'lib/erbpp/narray_def.rb', line 309 def definition nil end |
#extract_data(ptr, pos, x) ⇒ Object
317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/erbpp/narray_def.rb', line 317 def extract_data(ptr,pos,x) case tpname when "bit" "{BIT_DIGIT b; LOAD_BIT(#{ptr},#{pos},b); x = m_from_real(b);}" when "robject" "#{x} = m_num_to_data(*(#{dtype}*)(#{ptr}+#{pos}))" when /complex/ "{#{dtype} *p = (#{dtype}*)(#{ptr}+#{pos}); #{x} = c_new(REAL(*p),IMAG(*p));}" else "#{x} = m_from_real(*(#{dtype}*)(#{ptr}+#{pos}))" end end |