Class: HRP2Plugin

Inherits:
DomainPlugin show all
Defined in:
lib/tecsgen/plugin/HRP2Plugin.rb

Overview

各メソッドの役割りは、DomainPlugin.rb を参照のこと HRP2カーネル用ドメインプラグイン

Constant Summary

Constants inherited from Plugin

Plugin::PluginArgProc

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DomainPlugin

#gen_factory

Methods inherited from Plugin

#cdl_error, #check_plugin_arg, #gen_cdl_file, #gen_ep_func?, #gen_postamble, #gen_preamble, #new_cell, #parse_plugin_arg, #print_msg, #set_locale, #set_silent

Methods inherited from Node

#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale

Constructor Details

#initialize(region, name, option) ⇒ HRP2Plugin

Returns a new instance of HRP2Plugin.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/tecsgen/plugin/HRP2Plugin.rb', line 43

def initialize(region, name, option)
  super
  print "HRP2Plugin: initialize: region=#{region.get_name}, domainName=#{name}, option=#{option}\n"
  @region = region
  @name   = name

  case option
  when "trusted", "nontrusted", "OutOfDomain"
    # OK
    @option = option
  else
    cdl_error("HRPPlugin: '$1' is unacceptable domain kind, specify 'trusted' or 'nontrusted'", option)
    @option = "trusted" # とりあえず trusted を設定しておく
  end
end

Class Method Details

.gen_post_code(file) ⇒ Object



138
139
# File 'lib/tecsgen/plugin/HRP2Plugin.rb', line 138

def self.gen_post_code(file)
end

Instance Method Details

#add_through_plugin(join, current_region, next_region, through_type) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/tecsgen/plugin/HRP2Plugin.rb', line 59

def add_through_plugin(join, current_region, next_region, through_type)
  # join.get_owner:Cell  左辺のセル
  # join.get_definition:Port 呼び口
  # join.get_subscript:Integer or nil 呼び口配列の添数 (Join::@subscript の説明参照)
  # join.get_cell:Cell 右辺のセル
  # join.get_port_name:Symbol 受け口
  # get_rhs_subscript:Integer or nil 受け口配列の添数 (Join::@rhs_subscript の説明参照)
  # return []
  print "HRP2Plugin: add_through_plugin: #{current_region.get_name}=>#{next_region.get_name}, #{join.get_owner.get_name}.#{join.get_definition.get_name}=>#{join.get_cell.get_name}.#{join.get_port_name}, #{through_type}\n"

  puts "=====Join Check Start====="
  puts "caller: #{join.get_owner.get_name}, callee: #{join.get_cell.get_name}"
  puts "=====Join Check param====="
  current_domain = current_region.get_domain_root.get_domain_type
  next_domain = next_region.get_domain_root.get_domain_type
  puts current_domain.get_option.to_s
  if !next_domain.nil?
    puts next_domain.get_option.to_s
  else
    puts "next domain is nil!"
  end

  if HRP2KernelObjectPlugin.include_celltype?(join.get_cell.get_celltype)
      # 結合先がカーネルオブジェクトセル
      # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
      # 何もしないthrough
    puts "***** #{join.get_cell.get_celltype.get_name} is kernel object"
      return []
      # return [ :HRP2SVCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true" ]
  # elsif @end_region.is_root?
  # elsif next_region.get_option == OutOfDomain
  # elsif next_domain.nil?
  elsif next_domain.get_option.to_s == "OutOfDomain"
  #     # 結合先が無所属
  #     # 何もしないthrough
  #     # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
    puts "***** nil"
      return []
      # return [ :HRP2SVCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true" ]
  # elsif @start_region.get_param != :KERNEL_DOMAIN && @end_region.get_param == :KERNEL_DOMAIN
  elsif current_domain.get_option.to_s != "trusted" && next_domain.get_option.to_s == "trusted"
      # ユーザドメインからカーネルドメインへの結合
      # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
    puts "***** svc"
      return [:HRP2SVCPlugin, ""]
  elsif current_domain != next_domain
      # ユーザドメインから別のユーザドメインへの結合
      # @plugin_body = HRP2RPCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
    puts "***** rpc"
      return [:HRP2RPCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true"]
  else
      # その他
      # 何もしないthrough
      # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
    print "warning: at HRP2 Join Check"
      return nil
  end

  puts "=====Join Check End====="
end

#get_kindObject

ドメイン種別を返す

return::Symbol :kernel, :user, :OutOfDomain



122
123
124
125
126
127
128
129
130
131
# File 'lib/tecsgen/plugin/HRP2Plugin.rb', line 122

def get_kind
  case @option
  when "trusted"
    return :kernel
  when "nontrusted"
    return :user
  when "OutOfDomain"
    return :OutOfDomain
  end
end

#joinable?(current_region, next_region, through_type) ⇒ Boolean

Returns:

  • (Boolean)


133
134
135
136
# File 'lib/tecsgen/plugin/HRP2Plugin.rb', line 133

def joinable?(current_region, next_region, through_type)
  print "HRP2Plugin: joinable? from #{current_region.get_name} to #{next_region.get_name} (#{through_type})\n"
  return true
end