class IDL::AST::Attribute

Attributes

get_raises[R]
idltype[R]
readonly[R]
set_raises[R]

Public Class Methods

new(_name, _enclosure, params) click to toggle source
Calls superclass method IDL::AST::Leaf::new
# File lib/ridl/node.rb, line 2418
def initialize(_name, _enclosure, params)
  super(_name, _enclosure)
  @idltype = params[:type]
  @get_raises = []
  @set_raises = []
  unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
    raise "Anonymous type definitions are not allowed!" if @idltype.is_anonymous?
    raise "Exception #{@idltype.typename} is not allowed as an attribute!" if @idltype.is_node?(IDL::AST::Exception)

    if @idltype.is_local?
      if _enclosure.is_a?(IDL::AST::Interface) && !_enclosure.is_local?
        raise "Local type #{@idltype.typename} not allowed for operation on unrestricted interface"
      end
      ## IDL_Valuetype: no problem as valuetype operations are local
    end
    unless @idltype.is_complete?
      if _enclosure.is_a?(IDL::AST::Interface)
        raise "Incomplete type #{@idltype.typename} not allowed here!"
      end
      ## IDL_Valuetype: no problem as valuetype operations are local
    end
  end
  @readonly = params[:readonly]
end

Public Instance Methods

expanded_copy(name_pfx, enc) click to toggle source
# File lib/ridl/node.rb, line 2486
def expanded_copy(name_pfx, enc)
  att = IDL::AST::Attribute.new("#{name_pfx}_#{self.name}", enc, {type: @idltype, readonly: @readonly})
  att.get_raises = @get_raises unless @get_raises.empty?
  att.set_raises = @set_raises unless @set_raises.empty?
  att
end
get_raises=(exlist) click to toggle source
# File lib/ridl/node.rb, line 2466
def get_raises=(exlist)
  exlist.each do |extype|
    unless extype.is_a?(IDL::Type::ScopedName) &&
              (extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
      raise 'Only IDL Exception types allowed in raises declaration.' unless extype.resolved_type.node.is_a?(IDL::AST::Exception)
    end
    @get_raises << extype
  end
end
instantiate(instantiation_context, _enclosure) click to toggle source
Calls superclass method IDL::AST::Leaf#instantiate
# File lib/ridl/node.rb, line 2455
def instantiate(instantiation_context, _enclosure)
  _params = {
    type: @idltype.instantiate(instantiation_context),
    readonly: @readonly
  }
  _att = super(instantiation_context, _enclosure, _params)
  _att.get_raises = self.concrete_get_raises(instantiation_context)
  _att.set_raises = self.concrete_set_raises(instantiation_context)
  _att
end
marshal_dump() click to toggle source
Calls superclass method IDL::AST::Leaf#marshal_dump
# File lib/ridl/node.rb, line 2443
def marshal_dump
  super() << @idltype << @readonly << @get_raises << @set_raises
end
marshal_load(vars) click to toggle source
Calls superclass method IDL::AST::Leaf#marshal_load
# File lib/ridl/node.rb, line 2447
def marshal_load(vars)
  @set_raises = vars.pop
  @get_raises = vars.pop
  @readonly = vars.pop
  @idltype = vars.pop
  super(vars)
end
set_raises=(exlist) click to toggle source
# File lib/ridl/node.rb, line 2476
def set_raises=(exlist)
  exlist.each do |extype|
    unless extype.is_a?(IDL::Type::ScopedName) &&
              (extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
      raise 'Only IDL Exception types allowed in raises declaration.' unless extype.resolved_type.node.is_a?(IDL::AST::Exception)
    end
    @set_raises << extype
  end
end

Protected Instance Methods

concrete_get_raises(instantiation_context) click to toggle source
# File lib/ridl/node.rb, line 2495
def concrete_get_raises(instantiation_context)
  @get_raises.collect do |ex|
    ex.instantiate(instantiation_context)
  end
end
concrete_set_raises(instantiation_context) click to toggle source
# File lib/ridl/node.rb, line 2501
def concrete_set_raises(instantiation_context)
  @set_raises.collect do |ex|
    ex.instantiate(instantiation_context)
  end
end