Class: IDL::AST::BitValue

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

Overview

BitMask

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

Returns a new instance of BitValue.



3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
# File 'lib/ridl/node.rb', line 3001

def initialize(name, enclosure, params)
  super(name, enclosure)
  @idltype = IDL::Type::ULong.new
  @bitmask = params[:bitmask]
  @position = params[:position]
  annotations.concat(params[:annotations])
  position_annotation = annotations[:position].first
  unless position_annotation.nil?
    @position = position_annotation.fields[:value]
  end
  @bitmask.add_bitvalue(self)
end

Instance Attribute Details

#bitmaskObject (readonly)

Returns the value of attribute bitmask.



2999
3000
3001
# File 'lib/ridl/node.rb', line 2999

def bitmask
  @bitmask
end

#idltypeObject (readonly)

Returns the value of attribute idltype.



2999
3000
3001
# File 'lib/ridl/node.rb', line 2999

def idltype
  @idltype
end

#positionObject (readonly)

Returns the value of attribute position.



2999
3000
3001
# File 'lib/ridl/node.rb', line 2999

def position
  @position
end

Instance Method Details

#instantiate(instantiation_context, _enclosure) ⇒ Object



3025
3026
3027
3028
3029
3030
3031
# File 'lib/ridl/node.rb', line 3025

def instantiate(instantiation_context, _enclosure)
  # find already instantiated BitMask parent
  _bitmask = _enclosure.resolve(@bitmask.name)
  raise "Unable to resolve instantiated BitMask scope for bitvalue #{@bitmask.name}::#{name} instantiation" unless _bitmask

  super(instantiation_context, _enclosure, { bitmask: _bitmask, position: @position })
end

#marshal_dumpObject



3014
3015
3016
# File 'lib/ridl/node.rb', line 3014

def marshal_dump
  super() << @idltype << @bitmask << @position
end

#marshal_load(vars) ⇒ Object



3018
3019
3020
3021
3022
3023
# File 'lib/ridl/node.rb', line 3018

def marshal_load(vars)
  @position = vars.pop
  @bitmask = vars.pop
  @idltype = vars.pop
  super(vars)
end