Class: Roby::StateEvent
- Inherits:
-
EventGenerator
- Object
- DistributedObject
- PlanObject
- EventGenerator
- Roby::StateEvent
- Defined in:
- lib/roby/state/events.rb
Overview
A state event is an event which emits when some parameters over the state are reached. See DeltaEvent and TimePointEvent.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from EventGenerator
#command, #event_model, #history, #unreachability_reason, #unreachable_handlers
Attributes inherited from PlanObject
#addition_time, #executable, #execution_engine, #finalization_handlers, #finalization_time, #model, #plan, #promise_executor, #removed_at
Attributes included from Transaction::Proxying::Cache
#transaction_forwarder_module, #transaction_proxy_module
Attributes included from Relations::DirectedRelationSupport
Attributes inherited from DistributedObject
Instance Method Summary collapse
-
#disable ⇒ Object
Call to disable this event.
-
#disabled? ⇒ Boolean
True if this event is currently disabled.
-
#emit(*context) ⇒ Object
Emit only if the event is armed.
-
#enable(reset = true) ⇒ Object
Call to reenable this event.
-
#enabled? ⇒ Boolean
True if this event is currently active.
-
#initialize(*args, &block) ⇒ StateEvent
constructor
A new instance of StateEvent.
-
#reset ⇒ Object
After this call, the event will be emitted the next time its state condition is met, regardless of the fact that it has already been emitted or not.
Methods inherited from EventGenerator
#&, #achieve_asynchronously, #achieve_with, #add_child_object, #call, #call_handlers, #call_unreachable_handlers, #call_without_propagation, #called, #calling, #cancel, #check_call_validity, #check_call_validity_after_calling, #check_emission_validity, #clear_pending, #controlable?, #create_transaction_proxy, #default_command, #delay, #each_precondition, #emit_failed, #emit_without_propagation, #emitting, #filter, #finalized!, #fire, #fired, #forward, #forward_once, #forward_to, #forward_to_once, #forwarded_to?, #garbage!, #happened?, #if_unreachable, #initialize_copy, #initialize_replacement, #last, #mark_unreachable!, match, #match, #model, #name, #new, #on, #once, #pending, #plan=, #precondition, #pretty_print, #realize_with, #related_events, #related_tasks, #replace_by, #signal, #signals, #signals_once, #to_event, #to_execution_exception, #to_execution_exception_matcher, #unreachable!, #unreachable_without_propagation, #until, #when_unreachable, #|
Methods included from DRoby::Identifiable
Methods included from DRoby::V5::DRobyConstant::Dump
#droby_dump, #droby_marshallable?
Methods included from DRoby::V5::EventGeneratorDumper
Methods included from GUI::RelationsCanvasEventGenerator
#display, #display_create, #display_name, #display_time_end, #display_time_start, priorities, style, styles
Methods included from GUI::RelationsCanvasPlanObject
#display, #display_create, #display_events, #display_name, #display_parent
Methods inherited from PlanObject
#add_child_object, #apply_relation_changes, #as_plan, #can_finalize?, #commit_transaction, #concrete_model, #connection_space, #each_finalization_handler, #each_in_neighbour_merged, #each_out_neighbour_merged, #each_plan_child, #engine, #executable?, #finalized!, #finalized?, #forget_peer, #fullfills?, #garbage!, #garbage?, #initialize_copy, #initialize_replacement, #merged_relations, #promise, #read_write?, #real_object, #remotely_useful?, #replace_by, #replace_subplan_by, #root_object, #root_object?, #subscribed?, #transaction_proxy?, #transaction_stack, #update_on?, #updated_by?, #when_finalized
Methods included from Models::PlanObject
#child_plan_object, #finalization_handler, #match, #when_finalized
Methods included from GUI::GraphvizPlanObject
#apply_layout, #dot_label, #to_dot
Methods included from Relations::DirectedRelationSupport
#[], #[]=, #add_child_object, #add_parent_object, #child_object?, #child_objects, #clear_vertex, #each_child_object, #each_in_neighbour, #each_out_neighbour, #each_parent_object, #each_relation, #each_relation_graph, #each_relation_sorted, #each_root_relation_graph, #enum_child_objects, #enum_parent_objects, #enum_relations, #leaf?, #parent_object?, #parent_objects, #related_object?, #related_objects, #relation_graph_for, #relations, #remove_child_object, #remove_children, #remove_parent_object, #remove_parents, #remove_relations, #root?, #sorted_relations
Methods inherited from DistributedObject
#add_owner, #clear_owners, #initialize_copy, #owned_by?, #remove_owner
Constructor Details
#initialize(*args, &block) ⇒ StateEvent
Returns a new instance of StateEvent.
117 118 119 120 121 |
# File 'lib/roby/state/events.rb', line 117 def initialize(*args, &block) @disabled = nil @armed = true super end |
Instance Method Details
#disable ⇒ Object
Call to disable this event. When the state events are disabled, they will no more emit.
157 158 159 |
# File 'lib/roby/state/events.rb', line 157 def disable @disabled = true end |
#disabled? ⇒ Boolean
True if this event is currently disabled
144 145 146 |
# File 'lib/roby/state/events.rb', line 144 def disabled? @disabled end |
#emit(*context) ⇒ Object
Emit only if the event is armed
162 163 164 165 166 167 168 169 170 |
# File 'lib/roby/state/events.rb', line 162 def emit(*context) # :nodoc: if armed? begin super ensure @armed = false end end end |
#enable(reset = true) ⇒ Object
Call to reenable this event. If reset
is true, the event is reset at the same time.
150 151 152 153 |
# File 'lib/roby/state/events.rb', line 150 def enable(reset = true) @disabled = false self.reset if reset end |
#enabled? ⇒ Boolean
True if this event is currently active
139 140 141 |
# File 'lib/roby/state/events.rb', line 139 def enabled? !@disabled end |
#reset ⇒ Object
After this call, the event will be emitted the next time its state condition is met, regardless of the fact that it has already been emitted or not
See also #armed?
134 135 136 |
# File 'lib/roby/state/events.rb', line 134 def reset @armed = true end |