class IDL::AST::StateMember
Attributes
idltype[R]
visibility[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 2026 def initialize(_name, _enclosure, params) @is_recursive = false @has_incomplete_type = false super(_name, _enclosure) @idltype = params[:type] @visibility = (params[:visibility] == :public ? :public : :private) 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? ## check for use of incomplete types unless @idltype.is_complete? ## verify type is used in sequence if @idltype.resolved_type.is_a?(IDL::Type::Sequence) ## find the (non-sequence) elementtype seq_ = @idltype.resolved_type mtype = seq_.basetype while mtype.resolved_type.is_a? IDL::Type::Sequence seq_ = mtype.resolved_type mtype = seq_.basetype end ## is it an incomplete struct, union or valuetype? if mtype.is_a? IDL::Type::ScopedName case mtype.resolved_type when IDL::Type::Struct, IDL::Type::Union, IDL::Type::Valuetype unless mtype.node.is_defined? ## check if incomplete struct/union/valuetype is contained within definition of self enc = _enclosure while enc.is_a?(IDL::AST::Struct) || enc.is_a?(IDL::AST::Union) || enc.is_a?(IDL::AST::Valuetype) if enc.scoped_name == mtype.node.scoped_name ## mark enclosure as recursive enc.recursive = true ## mark sequence as recursive type !!! DEPRECATED !!!; leave till R2CORBA updated seq_.recursive = true return end enc = enc.enclosure end end end if mtype.resolved_type.is_a?(IDL::Type::Valuetype) # mark member as using an incomplete valuetype; allowed but needs special care @has_incomplete_type = true return end end elsif @idltype.resolved_type.is_a?(IDL::Type::Valuetype) mtype = @idltype.resolved_type enc = _enclosure while enc.is_a?(IDL::AST::Struct) || enc.is_a?(IDL::AST::Union) || enc.is_a?(IDL::AST::Valuetype) if enc.is_a?(IDL::AST::Valuetype) && enc.scoped_name == mtype.node.scoped_name ## statemember using recursive valuetype ## is enclosed in valuetype itself as part of constructed type ## which is allowed and not a problem @is_recursive = true ## mark enclosure as recursive enc.recursive = true return end enc = enc.enclosure end # mark member as using an incomplete valuetype; allowed but needs special care @has_incomplete_type = true return end raise "Incomplete type #{@idltype.typename} not allowed here!" end end end
Public Instance Methods
has_incomplete_type?()
click to toggle source
# File lib/ridl/node.rb, line 2127 def has_incomplete_type? @has_incomplete_type end
instantiate(instantiation_context, _enclosure)
click to toggle source
Calls superclass method
IDL::AST::Leaf#instantiate
# File lib/ridl/node.rb, line 2107 def instantiate(instantiation_context, _enclosure) _params = { type: @idltype.instantiate(instantiation_context), visibility: self.visibility } super(instantiation_context, _enclosure, _params) end
is_local?(recurstk)
click to toggle source
# File lib/ridl/node.rb, line 2115 def is_local?(recurstk) idltype.is_local?(recurstk) end
is_public?()
click to toggle source
# File lib/ridl/node.rb, line 2119 def is_public? @visibility == :public end
is_recursive?()
click to toggle source
# File lib/ridl/node.rb, line 2123 def is_recursive? @is_recursive end
marshal_dump()
click to toggle source
Calls superclass method
IDL::AST::Leaf#marshal_dump
# File lib/ridl/node.rb, line 2095 def marshal_dump super() << @idltype << @visibility << @is_recursive << @has_incomplete_type end
marshal_load(vars)
click to toggle source
Calls superclass method
IDL::AST::Leaf#marshal_load
# File lib/ridl/node.rb, line 2099 def marshal_load(vars) @has_incomplete_type = vars.pop @is_recursive = vars.pop @visibility = vars.pop @idltype = vars.pop super(vars) end