Class: IControl::Common::ULong64

Inherits:
Base::Struct
  • Object
show all
Defined in:
lib/icontrol/common.rb,
lib/icontrol/common.rb,
lib/icontrol/base/icontrol_overlay/common.rb

Overview

A 64-bit, unsigned integer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#highNumeric

The high-order 32-bit unsigned integer.

Returns:

  • (Numeric)

    the current value of high


226
227
228
# File 'lib/icontrol/common.rb', line 226

def high
  @high
end

#lowNumeric

The low-order 32-bit unsigned integer.

Returns:

  • (Numeric)

    the current value of low


226
227
228
# File 'lib/icontrol/common.rb', line 226

def low
  @low
end

Instance Method Details

#from_soap(xml) ⇒ Object


6
7
8
9
# File 'lib/icontrol/base/icontrol_overlay/common.rb', line 6

def from_soap(xml)
  puts "HEY"
  puts xml.inspect
end

#to_fObject


11
12
13
# File 'lib/icontrol/base/icontrol_overlay/common.rb', line 11

def to_f
  BinData::Uint64be.read(BinData::Int32be.new(high).to_binary_s + BinData::Int32be.new(low).to_binary_s)
end

#to_fdObject


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/icontrol/base/icontrol_overlay/common.rb', line 15

def to_fd
  retVal = 0.0        
  u_high = high.to_s.unpack("L").first || 0
  u_low  = low.to_s.unpack("L").first  || 0
  if u_high >=0
    retVal = u_high << 32 & 0xffff0000
  else
    retVal = ((u_high & 0x7fffffff) << 32) + (0x80000000 << 32)
  end
  if u_low >=0
    retVal += u_low
  else
    retVal += ((u_low & 0x7fffffff) + 0x7fffffff)
  end
  return retVal;
end