class IDL::AST::Home

Constants

DEFINABLE

Attributes

component[R]
primarykey[R]

Public Class Methods

new(_name, _enclosure, params) click to toggle source
Calls superclass method IDL::AST::ComponentBase::new
# File lib/ridl/node.rb, line 1323
def initialize(_name, _enclosure, params)
  @component = nil
  @resolved_comp = nil
  @primarykey = nil
  @resolved_pk = nil
  @idltype = IDL::Type::Home.new(self)
  super(_name, _enclosure, params)
  set_component_and_key(params[:component], params[:primarykey])
end

Public Instance Methods

attributes(include_bases = false, traversed = nil) click to toggle source
# File lib/ridl/node.rb, line 1385
def attributes(include_bases = false, traversed = nil)
  atts = @children.find_all { |c| c.is_a?(IDL::AST::Attribute) }
  atts.concat(base_attributes(traversed || [])) if include_bases
  atts
end
instantiate(instantiation_context, _enclosure) click to toggle source
Calls superclass method IDL::AST::ComponentBase#instantiate
# File lib/ridl/node.rb, line 1345
def instantiate(instantiation_context, _enclosure)
  _params = {
    component: IDL::AST::TemplateParam.concrete_param(instantiation_context, @component),
    primarykey: @primarykey ? IDL::AST::TemplateParam.concrete_param(instantiation_context, @primarykey) : @primarykey
  }
  # instantiate concrete home def and validate
  super(instantiation_context, _enclosure, _params)
end
marshal_dump() click to toggle source
Calls superclass method IDL::AST::ComponentBase#marshal_dump
# File lib/ridl/node.rb, line 1333
def marshal_dump
  super() << @component << @resolved_comp << @primarykey << @resolved_pk
end
marshal_load(vars) click to toggle source
Calls superclass method IDL::AST::ComponentBase#marshal_load
# File lib/ridl/node.rb, line 1337
def marshal_load(vars)
  @resolved_pk = vars.pop
  @primarykey = vars.pop
  @resolved_comp = vars.pop
  @component = vars.pop
  super(vars)
end
operations(include_bases = false, traversed = nil) click to toggle source
# File lib/ridl/node.rb, line 1379
def operations(include_bases = false, traversed = nil)
  ops = @children.find_all { |c| c.is_a?(IDL::AST::Operation) }
  ops.concat(base_operations(traversed || [])) if include_bases
  ops
end
set_component_and_key(comp, key) click to toggle source
# File lib/ridl/node.rb, line 1354
def set_component_and_key(comp, key)
  unless comp&.is_a?(IDL::Type::ScopedName) && comp.is_node?(IDL::AST::TemplateParam)
    unless comp&.is_a?(IDL::Type::ScopedName) && comp.is_node?(IDL::AST::Component)
      raise (comp ?
              "invalid managed component for #{typename} #{scoped_lm_name}: #{comp.typename}" :
              "missing managed component specification for #{typename} #{scoped_lm_name}")
    end
    unless comp.resolved_type.node.is_defined?
      raise "#{scoped_lm_name}: #{comp.typename} cannot manage forward declared component #{comp.node.scoped_lm_name}"
    end

    @resolved_comp = comp.resolved_type.node
  end
  unless key&.is_a?(IDL::Type::ScopedName) && key.is_node?(IDL::AST::TemplateParam)
    ## TODO : add check for Components::PrimaryKeyBase base type
    unless key.nil? || (key.is_a?(IDL::Type::ScopedName) && key.is_node?(IDL::AST::Valuetype))
      raise "invalid primary key for #{typename} #{scoped_lm_name}: #{key.typename}"
    end

    @resolved_pk = key.resolved_type.node if key
  end
  @component = comp.node
  @primarykey = key.node if key
end