Class: IDL::AST::Connector

Inherits:
ComponentBase show all
Defined in:
lib/ridl/node.rb,
lib/ridl/node.rb

Overview

Home

Constant Summary collapse

DEFINABLE =
[IDL::AST::Attribute, IDL::AST::Port]

Instance Attribute Summary

Attributes inherited from ComponentBase

#base, #idltype, #interfaces

Attributes inherited from Leaf

#annotations, #enclosure, #intern, #name, #prefix, #scopes

Instance Method Summary collapse

Methods inherited from ComponentBase

#ancestors, #has_base?, #has_support?, #redefine, #supports?

Methods inherited from Derivable

#has_ancestor?, #search_self, #search_self_before_derived

Methods inherited from Node

#define, #introduce, #is_definable?, #match_members, #redefine, #replace_prefix, #resolve, #select_members, #undo_introduction, #walk_members

Methods inherited from Leaf

#has_annotations?, #is_local?, #is_template?, #lm_name, #lm_scopes, #replace_prefix, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename, #unescaped_name

Constructor Details

#initialize(_name, _enclosure, params) ⇒ Connector

Returns a new instance of Connector.



1402
1403
1404
1405
# File 'lib/ridl/node.rb', line 1402

def initialize(_name, _enclosure, params)
  @idltype = IDL::Type::Component.new(self)
  super(_name, _enclosure, params)
end

Instance Method Details

#add_interfaces(intfs) ⇒ Object



1428
1429
1430
# File 'lib/ridl/node.rb', line 1428

def add_interfaces(intfs)
  raise "interface support not allowed for #{typename} #{scoped_lm_name}" if intfs && !intfs.empty?
end

#attributes(include_bases = false, traversed = nil) ⇒ Object



1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
# File 'lib/ridl/node.rb', line 1455

def attributes(include_bases = false, traversed = nil)
  atts = @children.inject([]) do |lst, c|
    if IDL::AST::Port === c
      lst.concat(c.attributes)
    else
      lst << c
    end
    lst
  end
  atts.concat(base_attributes(traversed || [])) if include_bases
  atts
end

#instantiate(instantiation_context, _enclosure) ⇒ Object



1415
1416
1417
1418
# File 'lib/ridl/node.rb', line 1415

def instantiate(instantiation_context, _enclosure)
  # instantiate concrete connector def and validate
  super(instantiation_context, _enclosure, {})
end

#is_defined?Boolean

Returns:

  • (Boolean)


1420
1421
1422
# File 'lib/ridl/node.rb', line 1420

def is_defined?
  true
end

#is_forward?Boolean

Returns:

  • (Boolean)


1424
1425
1426
# File 'lib/ridl/node.rb', line 1424

def is_forward?
  false
end

#marshal_dumpObject



1407
1408
1409
# File 'lib/ridl/node.rb', line 1407

def marshal_dump
  super()
end

#marshal_load(vars) ⇒ Object



1411
1412
1413
# File 'lib/ridl/node.rb', line 1411

def marshal_load(vars)
  super(vars)
end

#ports(include_bases = false, traversed = nil) ⇒ Object



1446
1447
1448
1449
1450
1451
1452
1453
# File 'lib/ridl/node.rb', line 1446

def ports(include_bases = false, traversed = nil)
  ports = @children.inject([]) do |lst, c|
    lst.concat(c.ports) if IDL::AST::Port === c
    lst
  end
  ports.concat(base_ports(traversed || [])) if include_bases
  ports
end

#set_base(parent) ⇒ Object



1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
# File 'lib/ridl/node.rb', line 1432

def set_base(parent)
  unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
    unless (parent.is_a?(IDL::Type::NodeType) && parent.is_node?(self.class))
      raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
    end

    @resolved_base = parent.resolved_type.node
    if @resolved_base.has_base?(self)
      raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
    end
  end
  @base = parent.node
end