Class: PAPI::Event
- Inherits:
-
Object
- Object
- PAPI::Event
- Defined in:
- lib/PAPI/Event.rb
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- PRESET_MASK =
0x80000000- NATIVE_MASK =
0x40000000- PRESET_AND_MASK =
0x7FFFFFFF- NATIVE_AND_MASK =
0xBFFFFFFF- MAX_PRESET_EVENTS =
128
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#masks ⇒ Object
readonly
Returns the value of attribute masks.
Instance Method Summary collapse
-
#initialize(info, masks = nil) ⇒ Event
constructor
A new instance of Event.
- #to_i ⇒ Object
- #to_s(description = false, masks = false) ⇒ Object
Constructor Details
#initialize(info, masks = nil) ⇒ Event
Returns a new instance of Event.
31 32 33 34 |
# File 'lib/PAPI/Event.rb', line 31 def initialize(info, masks = nil) @info = info @masks = masks end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
28 29 30 |
# File 'lib/PAPI/Event.rb', line 28 def info @info end |
#masks ⇒ Object (readonly)
Returns the value of attribute masks.
29 30 31 |
# File 'lib/PAPI/Event.rb', line 29 def masks @masks end |
Instance Method Details
#to_i ⇒ Object
36 37 38 |
# File 'lib/PAPI/Event.rb', line 36 def to_i @info[:event_code] end |
#to_s(description = false, masks = false) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/PAPI/Event.rb', line 40 def to_s(description = false, masks = false) s1 = @info[:symbol].to_ptr.read_string s = "#{s1}" s += "\n #{@info[:long_descr]}" if description if masks and @masks then s += "\n " s += @masks.collect{ |m| m.to_s.gsub(s1.gsub(/.*::/,""),"")+"\n " + m.info[:long_descr].to_ptr.read_string.gsub(/.*masks:/,"") }.join("\n ") end return s end |