Class: DefWavelet

Inherits:
DefGslClass show all
Defined in:
ext/numo/gsl/wavelet/parse_wavelet.rb

Constant Summary collapse

WAVELET_TYPES =
ErbppGsl.read_type.select{|s| /gsl_wavelet_/ =~ s}

Instance Attribute Summary

Attributes inherited from ErbPP

#children, #parent

Instance Method Summary collapse

Methods inherited from DefGslClass

#define_method, #to_method_name

Methods included from ErbppGsl

FM, dbl, dblp, int, intp, long, read_const, read_enum, read_eval, read_func, read_func_pattern, read_type, str, szt, sztp, tp, uint, ulong, void

Methods inherited from DefClass

#_mod_var, #free_func, #init_erb, #initialize, #super_class

Methods inherited from DefModule

#_mod_var, #def_id, #id_list, #init_def, #init_erb, #initialize, #method_code

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, #description, #find, #find_tmpl, #get, #init_def, #initialize, #load_erb, #method_missing, #method_missing_alias, #result, #run, #set, #write

Constructor Details

This class inherits a constructor from DefClass

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ErbPP

Instance Method Details

#check_func(h) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'ext/numo/gsl/wavelet/parse_wavelet.rb', line 27

def check_func(h)
  if t = lookup(h)
    m = h[:func_name].sub(/^gsl_[^_]+_/,"")
    DefMethod.new(self, t, name:m, **h)
    def_type_new(h)
    return true
  end
  $stderr.puts "skip #{h[:func_name]}"
  false
end

#def_type_new(h) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'ext/numo/gsl/wavelet/parse_wavelet.rb', line 38

def def_type_new(h)
  case h[:func_name]
  when "gsl_wavelet_alloc"
    t = "wavelet_type_new"
    WAVELET_TYPES.each do |st|
      DefSubclassNew.new(self, t, st, **h)
    end
  end
end

#lookup(h) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'ext/numo/gsl/wavelet/parse_wavelet.rb', line 7

def lookup(h)
  t = get(:struct)
  ws = t + "_workspace *"
  dr = t + "_direction"
  case h
  when FM(name:/_free$/);                     false
  when FM(name:"gsl_wavelet_workspace_alloc"); "c_new_sizet"
  when FM(/_type /, szt, name:/_alloc$/);     "wavelet_new"
  when FM(tp, type:str);                      "c_str_f_void"
  when FM(tp, type:uint);                     "c_uint_f_void"

  when FM(tp,dblp,szt,szt,dr,ws);             "wavelet_transform"
  when FM(tp,dblp,szt,szt,ws);                "wavelet_transform2"
  when FM(tp,dblp,*[szt]*3,dr,ws);            "wavelet2d_transform"
  when FM(tp,dblp,*[szt]*3,ws);               "wavelet_transform2"

  when FM(tp);                                "c_self_f_void"
  end
end