Class: IDL::AST::Connector

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

Overview

Home

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from ComponentBase

#base, #idltype, #interfaces

Attributes inherited from Leaf

#annotations, #enclosure, #intern, #lm_name, #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, #undo_introduction, #walk_members

Methods inherited from Leaf

#_set_prefix, #has_annotations?, #is_local?, #is_template?, #lm_name_for_scope, #parsed_name_scope, #replace_prefix, #repo_scopes, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename

Constructor Details

#initialize(_name, _enclosure, params) ⇒ Connector

Returns a new instance of Connector.



1361
1362
1363
1364
# File 'lib/ridl/node.rb', line 1361

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

Instance Method Details

#add_interfaces(intfs) ⇒ Object

Raises:

  • (RuntimeError)


1382
1383
1384
# File 'lib/ridl/node.rb', line 1382

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

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



1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
# File 'lib/ridl/node.rb', line 1410

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(_context, _enclosure) ⇒ Object



1374
1375
1376
1377
# File 'lib/ridl/node.rb', line 1374

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

#is_defined?Boolean

Returns:

  • (Boolean)


1379
# File 'lib/ridl/node.rb', line 1379

def is_defined?; true; end

#is_forward?Boolean

Returns:

  • (Boolean)


1380
# File 'lib/ridl/node.rb', line 1380

def is_forward?; false; end

#marshal_dumpObject



1366
1367
1368
# File 'lib/ridl/node.rb', line 1366

def marshal_dump
  super()
end

#marshal_load(vars) ⇒ Object



1370
1371
1372
# File 'lib/ridl/node.rb', line 1370

def marshal_load(vars)
  super(vars)
end

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



1401
1402
1403
1404
1405
1406
1407
1408
# File 'lib/ridl/node.rb', line 1401

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



1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
# File 'lib/ridl/node.rb', line 1386

def set_base(parent)
  unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
    if not (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
      raise RuntimeError,
            "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
    end
    @resolved_base = parent.resolved_type.node
    if @resolved_base.has_base?(self)
      raise RuntimeError,
            "circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
    end
  end
  @base = parent.node
end