Class: CType::Union

Inherits:
StructUnion show all
Defined in:
lib/dbc/ctype.rb

Overview

Struct

Constant Summary collapse

@@unions =
{}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StructUnion

#add, #evaluate, get, #get_members, #keyword, #lookup, #to_def, #to_init_s, #to_s

Constructor Details

#initialize(name = nil) ⇒ Union

Returns a new instance of Union.



193
194
195
# File 'lib/dbc/ctype.rb', line 193

def initialize(name = nil)
	super
end

Class Method Details

.[](val = nil) ⇒ Object

factory method



180
181
182
183
184
185
186
187
188
189
# File 'lib/dbc/ctype.rb', line 180

def Union.[](val = nil)
	# for unnamed structures
	return Union.send(:new) unless val

	result = @@unions[val]
	unless result
		result = @@unions[val] = Union.send(:new, val)
	end
	result
end