Class: RubyVPI::EdgeClass
- Inherits:
-
Object
- Object
- RubyVPI::EdgeClass
- Includes:
- Singleton
- Defined in:
- lib/ruby-vpi/core/edge.rb,
lib/ruby-vpi/core/edge-methods.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Meth
Constant Summary collapse
- DETECTION_METHODS =
[]
Instance Method Summary collapse
-
#initialize ⇒ EdgeClass
constructor
A new instance of EdgeClass.
-
#monitor(aHandle) ⇒ Object
Begins monitoring the given handle for value change.
-
#refresh_cache ⇒ Object
Refreshes the cached value of all monitored handles.
-
#refresh_handle(aHandle) ⇒ Object
Remember the current value as the “previous” value.
Constructor Details
#initialize ⇒ EdgeClass
Returns a new instance of EdgeClass.
13 14 15 16 |
# File 'lib/ruby-vpi/core/edge.rb', line 13 def initialize @handles = [] @lock = Mutex.new end |
Instance Method Details
#monitor(aHandle) ⇒ Object
Begins monitoring the given handle for value change.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby-vpi/core/edge.rb', line 19 def monitor aHandle # ignore handles that cannot hold a meaningful value type = VPI::vpi_get_str(VpiType, aHandle) return if type =~ /Bit|Array|Module|Parameter/ @lock.synchronize do unless @handles.include? aHandle @handles << aHandle refresh_handle aHandle end end end |
#refresh_cache ⇒ Object
Refreshes the cached value of all monitored handles.
33 34 35 36 37 38 39 |
# File 'lib/ruby-vpi/core/edge.rb', line 33 def refresh_cache @lock.synchronize do @handles.each do |h| refresh_handle h end end end |
#refresh_handle(aHandle) ⇒ Object
Remember the current value as the “previous” value.
42 43 44 45 46 |
# File 'lib/ruby-vpi/core/edge.rb', line 42 def refresh_handle aHandle aHandle.instance_eval do @__edge__prev_val = get_value(VpiScalarVal) end end |