Class: IDL::AST::Operation

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

Overview

Parameter

Constant Summary collapse

NAMETYPE =
:member
DEFINABLE =
[IDL::AST::Parameter]

Instance Attribute Summary collapse

Attributes inherited from Leaf

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

Instance Method Summary collapse

Methods inherited from Node

#introduce, #is_definable?, #match_members, #redefine, #replace_prefix, #resolve, #select_members, #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, #unescaped_name

Constructor Details

#initialize(_name, _enclosure, params) ⇒ Operation

Returns a new instance of Operation.



2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
# File 'lib/ridl/node.rb', line 2291

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 RuntimeError, "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 RuntimeError, "Local type #{@idltype.typename} not allowed for operation on unrestricted interface"
      end
      ## IDL_Valuetype: no problem as valuetype operations are local
    end
    if !@idltype.is_complete?
      if _enclosure.is_a?(IDL::AST::Interface)
        raise RuntimeError, "Incomplete type #{@idltype.typename} not allowed here!"
      end
      ## IDL_Valuetype: no problem as valuetype operations are local
    end
  end
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



2289
2290
2291
# File 'lib/ridl/node.rb', line 2289

def context
  @context
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



2288
2289
2290
# File 'lib/ridl/node.rb', line 2288

def idltype
  @idltype
end

#onewayObject (readonly)

Returns the value of attribute oneway.



2288
2289
2290
# File 'lib/ridl/node.rb', line 2288

def oneway
  @oneway
end

#raisesObject

Returns the value of attribute raises.



2288
2289
2290
# File 'lib/ridl/node.rb', line 2288

def raises
  @raises
end

Instance Method Details

#define(*args) ⇒ Object



2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
# File 'lib/ridl/node.rb', line 2351

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_paramsObject



2365
2366
2367
# File 'lib/ridl/node.rb', line 2365

def in_params
  @in
end

#instantiate(_context, _enclosure) ⇒ Object



2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
# File 'lib/ridl/node.rb', line 2330

def instantiate(_context, _enclosure)
  _params = {
    :type => @idltype.instantiate(_context),
    :oneway => @oneway,
  }
  _op = super(_context, _enclosure, _params)
  _op.raises = self.concrete_raises(_context)
  _op.context = @context
  _op
end

#marshal_dumpObject



2316
2317
2318
# File 'lib/ridl/node.rb', line 2316

def marshal_dump
  super() << @idltype << @oneway << @in << @out << @raises << @context
end

#marshal_load(vars) ⇒ Object



2320
2321
2322
2323
2324
2325
2326
2327
2328
# File 'lib/ridl/node.rb', line 2320

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_paramsObject



2368
2369
2370
# File 'lib/ridl/node.rb', line 2368

def out_params
  @out
end

#paramsObject



2371
2372
2373
# File 'lib/ridl/node.rb', line 2371

def params
  self.children
end