Class: CType::Struct

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

Overview

StructUnion

Constant Summary collapse

@@structs =
{}

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

Returns a new instance of Struct.



172
173
174
# File 'lib/dbc/ctype.rb', line 172

def initialize(name = nil)
	super
end

Class Method Details

.[](val = nil) ⇒ Object

factory method



158
159
160
161
162
163
164
165
166
167
# File 'lib/dbc/ctype.rb', line 158

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

	result = @@structs[val]
	unless result
		result = @@structs[val] = Struct.send(:new, val)
	end
	result
end