Class: IDL::AST::Operation

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

Overview

Parameter

Constant Summary collapse

DEFINABLE =
[IDL::AST::Parameter]

Instance Attribute Summary collapse

Attributes inherited from Leaf

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

#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) ⇒ Operation

Returns a new instance of Operation.



2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
# File 'lib/ridl/node.rb', line 2309

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

Instance Attribute Details

#contextObject

Returns the value of attribute context.



2307
2308
2309
# File 'lib/ridl/node.rb', line 2307

def context
  @context
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



2306
2307
2308
# File 'lib/ridl/node.rb', line 2306

def idltype
  @idltype
end

#onewayObject (readonly)

Returns the value of attribute oneway.



2306
2307
2308
# File 'lib/ridl/node.rb', line 2306

def oneway
  @oneway
end

#raisesObject

Returns the value of attribute raises.



2306
2307
2308
# File 'lib/ridl/node.rb', line 2306

def raises
  @raises
end

Instance Method Details

#define(*args) ⇒ Object



2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
# File 'lib/ridl/node.rb', line 2371

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



2385
2386
2387
# File 'lib/ridl/node.rb', line 2385

def in_params
  @in
end

#instantiate(instantiation_context, _enclosure) ⇒ Object



2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
# File 'lib/ridl/node.rb', line 2349

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_dumpObject



2335
2336
2337
# File 'lib/ridl/node.rb', line 2335

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

#marshal_load(vars) ⇒ Object



2339
2340
2341
2342
2343
2344
2345
2346
2347
# File 'lib/ridl/node.rb', line 2339

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



2389
2390
2391
# File 'lib/ridl/node.rb', line 2389

def out_params
  @out
end

#paramsObject



2393
2394
2395
# File 'lib/ridl/node.rb', line 2393

def params
  self.children
end