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.



2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
# File 'lib/ridl/node.rb', line 2275

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.



2273
2274
2275
# File 'lib/ridl/node.rb', line 2273

def context
  @context
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



2272
2273
2274
# File 'lib/ridl/node.rb', line 2272

def idltype
  @idltype
end

#onewayObject (readonly)

Returns the value of attribute oneway.



2272
2273
2274
# File 'lib/ridl/node.rb', line 2272

def oneway
  @oneway
end

#raisesObject

Returns the value of attribute raises.



2272
2273
2274
# File 'lib/ridl/node.rb', line 2272

def raises
  @raises
end

Instance Method Details

#define(*args) ⇒ Object



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

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



2349
2350
2351
# File 'lib/ridl/node.rb', line 2349

def in_params
  @in
end

#instantiate(_context, _enclosure) ⇒ Object



2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
# File 'lib/ridl/node.rb', line 2314

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



2300
2301
2302
# File 'lib/ridl/node.rb', line 2300

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

#marshal_load(vars) ⇒ Object



2304
2305
2306
2307
2308
2309
2310
2311
2312
# File 'lib/ridl/node.rb', line 2304

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



2352
2353
2354
# File 'lib/ridl/node.rb', line 2352

def out_params
  @out
end

#paramsObject



2355
2356
2357
# File 'lib/ridl/node.rb', line 2355

def params
  self.children
end