Class: Roby::Interface::V2::Protocol::TaskEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/roby/interface/v2/protocol.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



114
115
116
# File 'lib/roby/interface/v2/protocol.rb', line 114

def context
  @context
end

#generatorObject

Returns the value of attribute generator

Returns:

  • (Object)

    the current value of generator



114
115
116
# File 'lib/roby/interface/v2/protocol.rb', line 114

def generator
  @generator
end

#propagation_idObject

Returns the value of attribute propagation_id

Returns:

  • (Object)

    the current value of propagation_id



114
115
116
# File 'lib/roby/interface/v2/protocol.rb', line 114

def propagation_id
  @propagation_id
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



114
115
116
# File 'lib/roby/interface/v2/protocol.rb', line 114

def time
  @time
end

Instance Method Details

#pp_context(pp) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/roby/interface/v2/protocol.rb', line 131

def pp_context(pp)
    if !context || context.empty?
        pp.text "No context"
        return
    end

    pp.text "context:"
    context.each do |obj|
        pp.nest(2) do
            pp.breakable
            obj.pretty_print(pp)
        end
    end
end

#pretty_print(pp) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/roby/interface/v2/protocol.rb', line 117

def pretty_print(pp)
    time_s = Roby.format_time(time)
    pp.text "event '#{generator.symbol}' emitted at [#{time_s} " \
            "@#{propagation_id}] from"
    pp.nest(2) do
        pp.breakable
        generator.task.pretty_print(pp)
    end
    pp.nest(2) do
        pp.breakable
        pp_context(pp)
    end
end

#to_sObject



146
147
148
149
# File 'lib/roby/interface/v2/protocol.rb', line 146

def to_s
    time_s = Roby.format_time(time)
    "[#{time_s} @#{propagation_id}] #{generator}: #{context}"
end