Class: Gdsii::RecData::NoData

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

Overview

Store a GDSII NODATA data type. This data type has no value.

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

#initializeNoData

Construct an NoData data object. No value is given because there isn’t a value for Gdsii::RecData::NoData.



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

def initialize()
  super(GDT_NO_DATA, [])
end

Instance Attribute Details

#valueObject

Value will always be an empty array for a Gdsii::RecData::NoData object



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

def value
  @value
end

Class Method Details

.read(file, byte_count = 0) ⇒ Object

Reads a NO_DATA record from the given file object and returns a new Gdsii::RecData::NoData object.



38
39
40
41
42
43
44
45
# File 'lib/gdsii/record/datatypes/nodata.rb', line 38

def NoData.read(file, byte_count=0)
  # validate byte count
  if byte_count > 0 then
    raise ArgumentError,
    "GDT_NO_DATA expects 0 bytes of record length; requested: #{byte_count}"
  end
  NoData.new()
end

Instance Method Details

#byte_sizeObject

Returns the size of the record data in bytes. Since a Gdsii::RecData::NoData object has no data, 0 is always returned.



34
# File 'lib/gdsii/record/datatypes/nodata.rb', line 34

def byte_size(); 0; end

#to_sObject

Returns an empty string (which represents no data).



54
# File 'lib/gdsii/record/datatypes/nodata.rb', line 54

def to_s(); ''; end

#write(file) ⇒ Object

Performs no operation since there is no data in a Gdsii::RecType::NoData object to write to a file. However this method is necessary so that it can respond to methods common to other Gdsii::RecType::Data descended classes.



51
# File 'lib/gdsii/record/datatypes/nodata.rb', line 51

def write(file); end