Class: Gdsii::RecData::Real4

Inherits:
Data
  • Object
show all
Defined in:
lib/gdsii/record/datatypes/real4.rb

Overview

Class for REAL4 data type (UNSUPPORTED - will raise an exception)

Instance Attribute Summary collapse

Attributes inherited from Data

#record, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

#[], #is_ascii?, #is_bitarray?, #is_int2?, #is_int4?, #is_no_data?, #is_real4?, #is_real8?, valid_type?

Constructor Details

#initialize(value) ⇒ Real4

Will raise an exception immediately as REAL4 is not supported in the GDSII specification.



17
18
19
# File 'lib/gdsii/record/datatypes/real4.rb', line 17

def initialize(value)
   raise "GDT_REAL4 is unsupported"
end

Instance Attribute Details

#valueObject

Value is an array of floating point numbers



13
14
15
# File 'lib/gdsii/record/datatypes/real4.rb', line 13

def value
  @value
end

Class Method Details

.read(file, byte_count) ⇒ Object

just create the Gdsii::RecData::Real4 object and raise the exception



33
34
35
# File 'lib/gdsii/record/datatypes/real4.rb', line 33

def Real4.read(file, byte_count)
  Real4.new([0])
end

Instance Method Details

#byte_sizeObject

Returns the size of the record data in bytes. Each array element consumes 4 bytes (hence REAL4).



28
29
30
# File 'lib/gdsii/record/datatypes/real4.rb', line 28

def byte_size()
  @value.length * 4
end

#to_sObject

Converts the array of floating point values to a string (values are joined by spaces).



44
45
46
# File 'lib/gdsii/record/datatypes/real4.rb', line 44

def to_s()
  value.map {|v| v.to_s}.join(' ')
end

#write(file) ⇒ Object

Raises an exception since REAL4 is unsupported



38
39
40
# File 'lib/gdsii/record/datatypes/real4.rb', line 38

def write(file)
   raise "GDT_REAL4 is unsupported"
end