pub struct LightweightRtObject { /* private fields */ }Expand description
LightweightRTObject — Spec §5.2.2.2 (S. 12-19).
Verwaltet:
- Lifecycle-State pro Execution-Context (Spec §5.2.2.3).
- Liste aller Contexts in denen das RTC participates.
- Owner-Context-Handle (das RTC kann selbst Owner eines Contexts sein — autonomous RTC, Spec §5.2.2.5).
- Reference auf den ComponentAction-Callbacks (
Box<dyn>damit Caller eigene Behavior einbauen kann).
State-Machine wird zentral hier durchgesetzt — alle Operations
pruefen Pre-Conditions und liefern PRECONDITION_NOT_MET im
Fehlerfall (Spec §5.2.2.2.x).
Implementations§
Source§impl LightweightRtObject
impl LightweightRtObject
Sourcepub fn new(callbacks: Box<dyn ComponentAction>) -> Self
pub fn new(callbacks: Box<dyn ComponentAction>) -> Self
Konstruiert ein neues, noch nicht initialisiertes RTC im
Created-Zustand. Spec §5.2.2.3.1.
Sourcepub fn initialize(&mut self) -> ReturnCode
pub fn initialize(&mut self) -> ReturnCode
Spec §5.2.2.2.1 — initialize: Created → Alive (Inactive in
jedem attached Context).
“An RTC may be initialized only while it is in the Created state. Any attempt to invoke this operation while in another state shall fail with PRECONDITION_NOT_MET.”
Sourcepub fn finalize(&mut self) -> ReturnCode
pub fn finalize(&mut self) -> ReturnCode
Spec §5.2.2.2.2 — finalize: Alive → Created (no longer
attached to any context).
“An RTC may not be finalized while it is participating in any execution context.”
Sourcepub const fn is_alive(&self) -> bool
pub const fn is_alive(&self) -> bool
Spec §5.2.2.2.3 — is_alive. “is alive or not regardless of
the execution context from which it is observed”.
Sourcepub fn attach_context(&mut self) -> Result<ExecutionContextHandle, ReturnCode>
pub fn attach_context(&mut self) -> Result<ExecutionContextHandle, ReturnCode>
Spec §5.2.2.2.5 — attach_context: registriert das RTC fuer
einen Context. Liefert ein neues Handle.
“This operation is intended to be invoked by ExecutionContextOperations::add_component. It is not intended for use by other clients.”
Sourcepub fn detach_context(&mut self, handle: ExecutionContextHandle) -> ReturnCode
pub fn detach_context(&mut self, handle: ExecutionContextHandle) -> ReturnCode
Spec §5.2.2.2.6 — detach_context. “may not be invoked if
this RTC is Active in the indicated execution context”.
Sourcepub fn get_participating_contexts(&self) -> Vec<ExecutionContextHandle> ⓘ
pub fn get_participating_contexts(&self) -> Vec<ExecutionContextHandle> ⓘ
Spec §5.2.2.2.9 — get_participating_contexts. Liefert eine
Liste der Handles in denen dieses RTC participates.
Sourcepub fn get_context_state(
&self,
handle: ExecutionContextHandle,
) -> Option<LifeCycleState>
pub fn get_context_state( &self, handle: ExecutionContextHandle, ) -> Option<LifeCycleState>
Spec §5.2.2.6.x via Caller invoked — Ueberprueft ob das RTC im gegebenen Context im erwarteten State ist.
Sourcepub fn transition_to_error(&mut self, handle: ExecutionContextHandle)
pub fn transition_to_error(&mut self, handle: ExecutionContextHandle)
Forciert Active → Error nach Callback-Fehler in User-Code.
Spec §5.2.2.4.7 — on_aborting wird einmalig invoked,
danach uebernimmt on_error (siehe Periodic-Tick-Loop).
Sourcepub fn callbacks_mut(&mut self) -> &mut dyn ComponentAction
pub fn callbacks_mut(&mut self) -> &mut dyn ComponentAction
Liefert mutable-Zugriff auf die Callbacks. Wird vom
ExecutionContext::tick-Loop benoetigt, um die periodischen
on_execute/on_state_update/on_error-Callbacks zu invoken.