|
|
@ -1,24 +1,57 @@ |
|
|
|
|
|
|
|
class <%= @name %> { |
|
|
|
virtual ~<%= @name %>() = 0; |
|
|
|
public: |
|
|
|
<% if !(@attributes.nil?) %> |
|
|
|
<%- @attributes.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<%- @attributes.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%-= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% if !(@attributeafters.nil?) %> |
|
|
|
<%- @attributeafters.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<%- @attributeafters.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%-= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% if !(@bitfields.nil?) %> |
|
|
|
<%- @bitfields.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<%- @bitfields.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%-= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% if !(@repeats.nil?) %> |
|
|
|
<%- @repeats.not_nil!.each do |attr| -%> |
|
|
|
<%- attr.class_name = @name -%> |
|
|
|
<%-= attr.to_s %> |
|
|
|
<%- end -%> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
private: |
|
|
|
void dummy_function() |
|
|
|
{ |
|
|
|
<% if !@size.nil? %> |
|
|
|
<%- sz = @size.not_nil! -%> |
|
|
|
<% if !(@attributes.nil?) %> |
|
|
|
<%- @attributes.not_nil!.each do |attr|-%> |
|
|
|
<%- if attr.start > sz -%> |
|
|
|
<%- raise "attribute starts after end: "+attr.name+" in class "+@name -%> |
|
|
|
<%- end -%> |
|
|
|
static_assert(<%= attr.name %>_end_position()<=<%= sz%>, "attribute past the end"); |
|
|
|
<%- end -%> |
|
|
|
<%- end -%> |
|
|
|
<% if !(@bitfields.nil?) %> |
|
|
|
<%- @bitfields.not_nil!.each do |attr|-%> |
|
|
|
<%- if attr.start > sz -%> |
|
|
|
<%- raise "bitfield starts after end: "+attr.name+" in class "+@name -%> |
|
|
|
<%- end -%> |
|
|
|
static_assert(<%= attr.name %>_end_position()<=<%= sz%>, "attribute past the end"); |
|
|
|
<%- end -%> |
|
|
|
<%- end -%> |
|
|
|
<% end %> |
|
|
|
} |
|
|
|
|
|
|
|
}; |