class IDL::AST::Operation

Constants

DEFINABLE

Attributes

context[RW]
idltype[R]
oneway[R]
raises[R]

Public Class Methods

new(_name, _enclosure, params) click to toggle source
Calls superclass method IDL::AST::Node::new
# File lib/ridl/node.rb, line 2302
def initialize(_name, _enclosure, params)
  super(_name, _enclosure)
  @idltype = params[:type]
  @oneway = (params[:oneway] == true)
  @in = []
  @out = []
  @raises = []
  @context = nil
  unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
    raise "Anonymous type definitions are not allowed!" if params[:type].is_anonymous?

    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
end

Public Instance Methods

define(*args) click to toggle source
Calls superclass method IDL::AST::Node#define
# File lib/ridl/node.rb, line 2364
def define(*args)
  param = super(*args)
  case param.attribute
  when Parameter::IN
    @in << param
  when Parameter::OUT
    @out << param
  when Parameter::INOUT
    @in << param
    @out << param
  end
  param
end
in_params() click to toggle source
# File lib/ridl/node.rb, line 2378
def in_params
  @in
end
instantiate(instantiation_context, _enclosure) click to toggle source
Calls superclass method IDL::AST::Leaf#instantiate
# File lib/ridl/node.rb, line 2342
def instantiate(instantiation_context, _enclosure)
  _params = {
    type: @idltype.instantiate(instantiation_context),
    oneway: @oneway
  }
  _op = super(instantiation_context, _enclosure, _params)
  _op.raises = self.concrete_raises(instantiation_context)
  _op.context = @context
  _op
end
marshal_dump() click to toggle source
Calls superclass method IDL::AST::Node#marshal_dump
# File lib/ridl/node.rb, line 2328
def marshal_dump
  super() << @idltype << @oneway << @in << @out << @raises << @context
end
marshal_load(vars) click to toggle source
Calls superclass method IDL::AST::Node#marshal_load
# File lib/ridl/node.rb, line 2332
def marshal_load(vars)
  @context = vars.pop
  @raises = vars.pop
  @out = vars.pop
  @in = vars.pop
  @oneway = vars.pop
  @idltype = vars.pop
  super(vars)
end
out_params() click to toggle source
# File lib/ridl/node.rb, line 2382
def out_params
  @out
end
params() click to toggle source
# File lib/ridl/node.rb, line 2386
def params
  self.children
end
raises=(exlist) click to toggle source
# File lib/ridl/node.rb, line 2353
def 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 or Native types allowed in raises declaration.'
    end

    @raises << extype
  end
end

Protected Instance Methods

concrete_raises(instantiation_context) click to toggle source
# File lib/ridl/node.rb, line 2392
def concrete_raises(instantiation_context)
  @raises.collect do |ex|
    ex.instantiate(instantiation_context)
  end
end
copy_from(_template, instantiation_context) click to toggle source
Calls superclass method IDL::AST::Node#copy_from
# File lib/ridl/node.rb, line 2398
def copy_from(_template, instantiation_context)
  super
  self.walk_members do |param|
    case param.attribute
    when Parameter::IN
      @in << param
    when Parameter::OUT
      @out << param
    when Parameter::INOUT
      @in << param
      @out << param
    end
  end
  self
end