Module: CelltypePluginModule

Included in:
Celltype, CompositeCelltype
Defined in:
lib/tecsgen/core/componentobj.rb

Instance Method Summary collapse

Instance Method Details

#apply_plugin(plugin_name, option) ⇒ Object

Celltype# セルタイププラグインをこのセルタイプに適用



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/tecsgen/core/componentobj.rb', line 480

def apply_plugin(plugin_name, option)
  # plClass = load_plugin( plugin_name, CelltypePlugin )
  if is_a? Celltype
    plugin_class = CelltypePlugin
  elsif is_a? CompositeCelltype
    plugin_class = CompositePlugin
  else
    raise "unknown class #{self.class.name}"
  end

  plClass = load_plugin(plugin_name, plugin_class)
  return if plClass.nil?
  if $verbose
    print "new celltype plugin: plugin_object = #{plClass.class.name}.new( #{@name}, #{option} )\n"
  end

  begin
    plugin_object = plClass.new(self, option)
    @generate_list << [plugin_name, option, plugin_object]
    plugin_object.set_locale @locale
    generate_and_parse plugin_object
  rescue Exception => evar
    cdl_error("S1023 $1: fail to new", plugin_name)
    print_exception(evar)
  end

  # 既に存在するセルに new_cell を適用
  @cell_list.each{|cell|
    apply_plugin_cell plugin_object, cell
  }

  return plugin_object
end

#apply_plugin_cell(plugin, cell) ⇒ Object



514
515
516
517
518
519
520
521
# File 'lib/tecsgen/core/componentobj.rb', line 514

def apply_plugin_cell(plugin, cell)
  begin
    plugin.new_cell cell
  rescue Exception => evar
    cdl_error("S1037 $1: celltype plugin fail to new_cell", plugin.class.name)
    print_exception(evar)
  end
end

#celltype_pluginObject

Celltype# セルタイププラグイン (generate 指定子)



473
474
475
476
477
# File 'lib/tecsgen/core/componentobj.rb', line 473

def celltype_plugin
  plugin_name = @generate[0]
  option = @generate[1]
  @generate[2] = apply_plugin(plugin_name, option)
end

#celltype_plugin_new_cell(cell) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
# File 'lib/tecsgen/core/componentobj.rb', line 523

def celltype_plugin_new_cell(cell)
  @generate_list.each{|generate|
    celltype_plugin = generate[2]
    begin
      celltype_plugin.new_cell cell
    rescue Exception => evar
      cdl_error("S1037 $1: celltype plugin fail to new_cell", celltype_plugin.class.name)
      print_exception(evar)
    end
  }
end