6 Copyright (C) 2009-2014 8 RT-Synthesis Research Group 9 Intelligent Systems Research Institute, 10 National Institute of Advanced Industrial Science and Technology (AIST), 13 Licensed under the Eclipse Public License -v 1.0 (EPL) 14 http://www.opensource.org/licenses/eclipse-1.0.txt 16 Object representing an execution context. 31 '''An execution context, within which components may be executing.''' 32 def __init__(self, ec_obj=None, handle=None, *args, **kwargs):
35 @param ec_obj The CORBA ExecutionContext object to wrap. 36 @param handle The handle of this execution context, which can be used 37 to uniquely identify it. 40 super(ExecutionContext, self).
__init__(*args, **kwargs)
42 self.
_obj = ec_obj._narrow(RTC.ExecutionContextService)
52 '''Activate a component within this context. 54 @param comp_ref The CORBA LightweightRTObject to activate. 58 self._obj.activate_component(comp_ref)
61 '''Deactivate a component within this context. 63 @param comp_ref The CORBA LightweightRTObject to deactivate. 67 self._obj.deactivate_component(comp_ref)
70 '''Reset a component within this context. 72 @param comp_ref The CORBA LightweightRTObject to reset. 76 self._obj.reset_component(comp_ref)
79 '''Get the state of a component within this context. 81 @param comp The CORBA LightweightRTObject to get the state of. 82 @return The component state, as a LifeCycleState value. 86 return self._obj.get_component_state(comp)
89 '''Get the type of this context as an optionally coloured string. 91 @param add_colour If True, ANSI colour codes will be added. 92 @return A string describing the kind of execution context this is. 97 result =
'Periodic', [
'reset']
99 result =
'Event-driven', [
'reset']
101 result =
'Other', [
'reset']
109 '''Reparse this execution context. 111 This causes the execution context's state, profile and other 112 information to be reloaded from the remote object. 118 '''Get the state of this context as an optionally coloured string. 120 @param add_colour If True, ANSI colour codes will be added. 121 @return A string describing this context's running state. 126 result =
'Running', [
'bold',
'green']
128 result =
'Stopped', [
'reset']
136 '''Start the context.''' 141 '''Stop the context.''' 147 '''The handle of this execution context.''' 153 '''The kind of this execution context.''' 155 kind = self._obj.get_kind()
156 if kind == RTC.PERIODIC:
158 elif kind == RTC.EVENT_DRIVEN:
165 '''The kind of this execution context as a coloured string.''' 170 '''The RTObject that owns this context.''' 176 '''The name of the RTObject that owns this context.''' 179 return self._owner.get_component_profile().instance_name
185 '''The list of RTObjects participating in this context.''' 191 '''The names of the RTObjects participating in this context.''' 193 return [obj.get_component_profile().instance_name \
198 '''The execution context's extra properties dictionary.''' 204 '''The execution rate of this execution context.''' 206 return self._obj.get_rate()
211 self._obj.set_rate(new_rate)
215 '''Is this execution context running?''' 217 return self._obj.is_running()
221 '''The state of this execution context as a coloured string.''' 228 profile = self._obj.get_profile()
Execution context object.
int EVENT_DRIVEN
Constant for an event driven execution context.
int PERIODIC
Constant for a periodic execution context.
def reset_component(self, comp_ref)
def build_attr_string(attrs, supported=True)
def __init__(self, ec_obj=None, handle=None, args, kwargs)
def get_component_state(self, comp)
def activate_component(self, comp_ref)
def nvlist_to_dict(nvlist)
def participant_names(self)
def running_as_string(self, add_colour=True)
def deactivate_component(self, comp_ref)
def kind_as_string(self, add_colour=True)
int OTHER
Constant for an execution context of some other type.