Class: IDL::AST::Enumerator

Inherits:
Leaf
  • Object
show all
Defined in:
lib/ridl/node.rb,
lib/ridl/node.rb

Overview

Enum

Instance Attribute Summary collapse

Attributes inherited from Leaf

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

Instance Method Summary collapse

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) ⇒ Enumerator

Returns a new instance of Enumerator.



2918
2919
2920
2921
2922
2923
2924
# File 'lib/ridl/node.rb', line 2918

def initialize(_name, _enclosure, params)
  super(_name, _enclosure)
  @idltype = IDL::Type::ULong.new
  @enum = params[:enum]
  @value = params[:value]
  @enum.add_enumerator(self)
end

Instance Attribute Details

#enumObject (readonly)

Returns the value of attribute enum.



2916
2917
2918
# File 'lib/ridl/node.rb', line 2916

def enum
  @enum
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



2916
2917
2918
# File 'lib/ridl/node.rb', line 2916

def idltype
  @idltype
end

#valueObject (readonly)

Returns the value of attribute value.



2916
2917
2918
# File 'lib/ridl/node.rb', line 2916

def value
  @value
end

Instance Method Details

#instantiate(instantiation_context, _enclosure) ⇒ Object



2937
2938
2939
2940
2941
2942
2943
# File 'lib/ridl/node.rb', line 2937

def instantiate(instantiation_context, _enclosure)
  # find already instantiated Enum parent
  _enum = _enclosure.resolve(@enum.name)
  raise "Unable to resolve instantiated Enum scope for enumerator #{@enum.name}::#{name} instantiation" unless _enum

  super(instantiation_context, _enclosure, { enum: _enum, value: @value })
end

#marshal_dumpObject



2926
2927
2928
# File 'lib/ridl/node.rb', line 2926

def marshal_dump
  super() << @idltype << @enum << @value
end

#marshal_load(vars) ⇒ Object



2930
2931
2932
2933
2934
2935
# File 'lib/ridl/node.rb', line 2930

def marshal_load(vars)
  @value = vars.pop
  @enum = vars.pop
  @idltype = vars.pop
  super(vars)
end