Module: HDLRuby::High::HRef
- Defined in:
- lib/HDLRuby/hruby_high.rb
Overview
Module giving high-level reference properties.
Class Method Summary collapse
-
.included(klass) ⇒ Object
Properties of expressions are also required.
Instance Method Summary collapse
-
#objects ⇒ Object
Get the refered objects.
-
#to_event ⇒ Object
Converts to a new event.
-
#to_ref ⇒ Object
Converts to a new reference.
Class Method Details
.included(klass) ⇒ Object
Properties of expressions are also required
3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 |
# File 'lib/HDLRuby/hruby_high.rb', line 3630 def self.included(klass) klass.class_eval do include HExpression include HArrow # Update the initialize to handle struct types accesses if # it is not a RefObject, this latter being a proxy to a # real component. if klass != RefObject then original_initialize = instance_method(:initialize) define_method(:initialize) do |*args, &block| original_initialize.bind(self).call(*args,&block) # Now process it if it is a structured type. if self.type.struct? then self.type.each do |name,typ| self.define_singleton_method(name) do RefName.new(typ,self,name) end end end end end # Converts to a new expression. def to_expr self.to_ref end end end |
Instance Method Details
#objects ⇒ Object
Get the refered objects.
3674 3675 3676 3677 |
# File 'lib/HDLRuby/hruby_high.rb', line 3674 def objects return [ self.object] if self.is_a?(RefObject) return self.each.map { |ref| ref.objects }.flatten end |
#to_event ⇒ Object
Converts to a new event.
3668 3669 3670 3671 |
# File 'lib/HDLRuby/hruby_high.rb', line 3668 def to_event # return Event.new(:change,self.to_ref) return Event.new(:anyedge,self.to_ref) end |
#to_ref ⇒ Object
Converts to a new reference.
NOTE: to be redefined in case of non-reference class.
3663 3664 3665 |
# File 'lib/HDLRuby/hruby_high.rb', line 3663 def to_ref raise AnyError, "Internal error: to_ref not defined yet for class: #{self.class}" end |