Class: Roby::Coordination::Models::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/coordination/models/event.rb

Overview

A representation of an event on the execution context’s task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task, symbol) ⇒ Event

Returns a new instance of Event.



11
12
13
# File 'lib/roby/coordination/models/event.rb', line 11

def initialize(task, symbol)
    @task, @symbol = task, symbol.to_sym
end

Instance Attribute Details

#symbolSymbol (readonly)

Returns the event’s symbol.

Returns:

  • (Symbol)

    the event’s symbol



9
10
11
# File 'lib/roby/coordination/models/event.rb', line 9

def symbol
  @symbol
end

#taskCoordination::Models::Task (readonly)

Returns The task this event is defined on.

Returns:



7
8
9
# File 'lib/roby/coordination/models/event.rb', line 7

def task
  @task
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
23
24
# File 'lib/roby/coordination/models/event.rb', line 20

def ==(other)
    other.kind_of?(self.class) &&
        other.symbol == symbol &&
        other.task == task
end

#forward_to(root_event) ⇒ Object

When running in this event’s state, forward this event to the given root task event



28
29
30
31
32
33
34
# File 'lib/roby/coordination/models/event.rb', line 28

def forward_to(root_event)
    if !root_event.task.respond_to?(:coordination_model)
        raise NotRootEvent, "can only forward to a root event"
    end
    root_event.task.coordination_model.
        forward task, self, root_event
end

#new(execution_context) ⇒ Coordination::Base::Event

Returns:

  • (Coordination::Base::Event)


16
17
18
# File 'lib/roby/coordination/models/event.rb', line 16

def new(execution_context)
    Coordination::Event.new(execution_context, self)
end

#to_sObject



36
# File 'lib/roby/coordination/models/event.rb', line 36

def to_s; "#{task}.#{symbol}_event" end