Struct RtLolaHir

Source
pub struct RtLolaHir<M>
where M: HirMode,
{ /* private fields */ }
Expand description

This struct constitutes the Mid-Level Intermediate Representation (MIR) of an RTLola specification.

The RtLolaHir is specifically designed to allow for convenient manipulation and analysis. Hence, it is perfect for working on the specification rather than work with it.

§Most Notable Structs and Enums

  • RtLolaMir is the root data structure representing the specification.
  • Output represents a single output stream. The data structure is enriched with information regarding streams accessing it or accessed by it and much more. For input streams confer Input.
  • StreamReference used for referencing streams within the Mir.
  • Expression represents an expression. It contains its ExpressionKind and its type. The latter contains all information specific to a certain kind of expression such as sub-expressions of operators.

§Type-State

The Hir follows a type-state pattern. To this end, it has a type parameter, its HirMode. The Hir starts in the BaseMode and progresses through different stages until reaching CompleteMode.
Each stage constitutes another level of refinement and adds functionality. The functionality can be accesses by importing the respective trait and requiring the mode of the Hir to implement the trait. The following traits exist.

Progression through different stages is managed by the HirStage trait, in particular HirStage::progress.

§See Also

Implementations§

Source§

impl<M> RtLolaHir<M>
where M: HirMode + TypedTrait,

Source

pub fn select(&self) -> StreamSelector<'_, M, All>

Creates a StreamSelector to query the HIR for different classes of output streams.

Source§

impl<M> RtLolaHir<M>
where M: HirMode,

Source

pub fn inputs(&self) -> impl Iterator<Item = &Input>

Provides access to an iterator over all input streams.

Source

pub fn outputs(&self) -> impl Iterator<Item = &Output>

Provides access to an iterator over all output streams.

Source

pub fn triggers(&self) -> impl Iterator<Item = &Output>

Provides access to an iterator over all triggers.

Source

pub fn num_inputs(&self) -> usize

Yields the number of input streams present in the Hir. Not necessarily equal to the number of input streams in the specification.

Source

pub fn num_outputs(&self) -> usize

Yields the number of output streams present in the Hir. Not necessarily equal to the number of output streams in the specification.

Source

pub fn num_triggers(&self) -> usize

Yields the number of triggers present in the Hir. Not necessarily equal to the number of triggers in the specification.

Source

pub fn all_streams(&self) -> impl Iterator<Item = StreamReference>

Provides access to an iterator over all streams, i.e., inputs, outputs, and triggers.

Source

pub fn get_input_with_name(&self, name: &str) -> Option<&Input>

Retrieves an input stream based on its name. Fails if no such input stream exists.

Source

pub fn get_output_with_name(&self, name: &str) -> Option<&Output>

Retrieves an output stream based on its name. Fails if no such output stream exists.

Source

pub fn output(&self, sref: StreamReference) -> Option<&Output>

Retrieves an output stream based on a stream reference. Fails if no such stream exists or sref is a StreamReference::In.

Source

pub fn input(&self, sref: StreamReference) -> Option<&Input>

Retrieves an input stream based on a stream reference. Fails if no such stream exists or sref is a StreamReference::Out.

Source

pub fn window_refs(&self) -> Vec<WindowReference>

Provides access to a collection of references for all windows occurring in the Hir.

Source

pub fn sliding_windows(&self) -> Vec<&Window<SlidingAggr>>

Provides access to a collection of references for all sliding windows occurring in the Hir.

Source

pub fn discrete_windows(&self) -> Vec<&Window<DiscreteAggr>>

Provides access to a collection of references for all discrete windows occurring in the Hir.

Source

pub fn instance_aggregations(&self) -> Vec<&InstanceAggregation>

Provides access to a collection of references for all discrete windows occurring in the Hir.

Source

pub fn expression(&self, id: ExprId) -> &Expression

Retrieves an expression for a given expression id.

§Panic

Panics if the expression does not exist.

Source

pub fn func_declaration(&self, func_name: &str) -> &FuncDecl

Retrieves a function declaration for a given function name.

§Panic

Panics if the declaration does not exist.

Source

pub fn single_sliding(&self, window: WindowReference) -> Window<SlidingAggr>

Retrieves a single sliding window for a given reference.

§Panic

Panics if no such window exists.

Source

pub fn single_discrete(&self, window: WindowReference) -> Window<DiscreteAggr>

Retrieves a single discrete window for a given reference.

§Panic

Panics if no such window exists.

Source

pub fn single_instance_aggregation( &self, window: WindowReference, ) -> &InstanceAggregation

Retrieves a single instance aggregation for a given reference.

§Panic

Panics if no such aggregation exists.

Source

pub fn spawn(&self, sr: StreamReference) -> Option<SpawnDef<'_>>

Retrieves the spawn definition of a particular output stream or trigger or None for input references.

Source

pub fn spawn_cond(&self, sr: StreamReference) -> Option<&Expression>

Retrieves the spawn condition of a particular output stream or None for input and trigger references. If all parts of the SpawnDef are needed, see RtLolaHir::spawn

Source

pub fn spawn_expr(&self, sr: StreamReference) -> Option<&Expression>

Retrieves the spawn expresion of a particular output stream or None for input and trigger references. If all parts of the SpawnDef are needed, see RtLolaHir::spawn

Source

pub fn spawn_pacing(&self, sr: StreamReference) -> Option<&AnnotatedPacingType>

Retrieves the spawn pacing of a particular output stream or None for input and trigger references. If all parts of the SpawnDef are needed, see RtLolaHir::spawn

Source

pub fn eval(&self, sr: StreamReference) -> Option<Vec<EvalDef<'_>>>

Retrieves the eval definitions of a particular output stream or trigger or None for input references.

Source

pub fn eval_cond(&self, sr: StreamReference) -> Option<Vec<Option<&Expression>>>

Retrieves all eval conditions of the clauses of a particular output stream or None for input and trigger references. For each eval clause of the stream, the element in the Vec is None if no condition is or the coresponding condition otherwise. If all parts of the EvalDef are needed, see RtLolaHir::eval

Source

pub fn eval_expr(&self, sr: StreamReference) -> Option<Vec<&Expression>>

Retrieves the eval expressions of all eval clauses of a particular output stream or trigger and None for input references. If all parts of the EvalDef are needed, see RtLolaHir::eval

Source

pub fn eval_pacing( &self, sr: StreamReference, ) -> Option<Vec<&AnnotatedPacingType>>

Retrieves the annotated eval pacing of each eval clause of a particular output stream or trigger None for input references. If all parts of the EvalDef are needed, see RtLolaHir::eval

Source

pub fn close(&self, sr: StreamReference) -> Option<CloseDef<'_>>

Retrieves the expressions representing the close definition of a particular output stream or None for input and trigger references.

Source

pub fn close_cond(&self, sr: StreamReference) -> Option<&Expression>

Retrieves the expression representing the close condition of a particular output stream or None for input and trigger references. If all parts of the CloseDef are needed, see RtLolaHir::close

Source

pub fn close_pacing(&self, sr: StreamReference) -> Option<&AnnotatedPacingType>

Retrieves the close pacing of a particular output stream or None for input and trigger references. If all parts of the CloseDef are needed, see RtLolaHir::close

Source

pub fn names(&self) -> HashMap<StreamReference, String>

Generates a map from a StreamReference to the name of the corresponding stream.

Source

pub fn global_tags(&self) -> &HashMap<String, Tag>

Returns the global tags annotated to the specification

Source§

impl RtLolaHir<BaseMode>

Source

pub fn check_types( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<TypedMode>, RtLolaError>

Returns the RtLolaHir with the type information for each stream and expression

The function returns the RtLolaHir after the type analysis. The new mode implements the same functionality as the BaseMode and additionally holds for each stream and expression its StreamType. The function moves the information of the previous mode to the new one and therefore destroys the current mode.

§Fails

The function fails if the type checker finds a type error in the specification and returns a string with a detailed description.

Source§

impl RtLolaHir<TypedMode>

Source

pub fn analyze_dependencies( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<DepAnaMode>, RtLolaError>

Returns the RtLolaHir with additional information about the dependencies between streams

The function returns the RtLolaHir after the dependency analysis. The new mode implements the same functionality as the TypedMode and additionally contains the dependencies between streams in the specification. The function moves the information of the previous mode to the new one and therefore destroys the current mode.

§Fails

The function returns a RtLolaError if the specification is not well-formed.

Source§

impl RtLolaHir<DepAnaMode>

Source

pub fn determine_evaluation_order( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<OrderedMode>, RtLolaError>

Returns the RtLolaHir with the spawn and evaluation layer of each stream

§Fails

The function fails if the evaluation order cannot be determined.

Source§

impl RtLolaHir<OrderedMode>

Source

pub fn determine_memory_bounds( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<MemBoundMode>, RtLolaError>

Returns the RtLolaHir with the memory-bound for each stream

§Fails

The function fails if the memory cannot be determined.

Source§

impl RtLolaHir<MemBoundMode>

Source

pub fn finalize( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<CompleteMode>, RtLolaError>

Returns the RtLolaHir in the last mode

The function returns the RtLolaHir in the CompleteMode. This mode indicates that the RtLolaHir has passed all analyzes and now contains all information. The function moves the information of the previous mode to the new one and therefore destroys the current mode.

Trait Implementations§

Source§

impl<M> Clone for RtLolaHir<M>
where M: Clone + HirMode,

Source§

fn clone(&self) -> RtLolaHir<M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M> Debug for RtLolaHir<M>
where M: Debug + HirMode,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl HirStage for RtLolaHir<BaseMode>

Source§

type NextStage = TypedMode

Defines the next mode that is produced by the progress function
Source§

fn progress( self, _cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<<RtLolaHir<BaseMode> as HirStage>::NextStage>, RtLolaError>

Returns an RtLolaHir with additional functionality
Source§

impl HirStage for RtLolaHir<DepAnaMode>

Source§

type NextStage = OrderedMode

Defines the next mode that is produced by the progress function
Source§

fn progress( self, _cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<<RtLolaHir<DepAnaMode> as HirStage>::NextStage>, RtLolaError>

Returns an RtLolaHir with additional functionality
Source§

impl HirStage for RtLolaHir<MemBoundMode>

Source§

type NextStage = CompleteMode

Defines the next mode that is produced by the progress function
Source§

fn progress( self, _cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<<RtLolaHir<MemBoundMode> as HirStage>::NextStage>, RtLolaError>

Returns an RtLolaHir with additional functionality
Source§

impl HirStage for RtLolaHir<OrderedMode>

Source§

type NextStage = MemBoundMode

Defines the next mode that is produced by the progress function
Source§

fn progress( self, cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<<RtLolaHir<OrderedMode> as HirStage>::NextStage>, RtLolaError>

Returns an RtLolaHir with additional functionality
Source§

impl HirStage for RtLolaHir<TypedMode>

Source§

type NextStage = DepAnaMode

Defines the next mode that is produced by the progress function
Source§

fn progress( self, _cfg: &FrontendConfig<'_>, ) -> Result<RtLolaHir<<RtLolaHir<TypedMode> as HirStage>::NextStage>, RtLolaError>

Returns an RtLolaHir with additional functionality

Auto Trait Implementations§

§

impl<M> Freeze for RtLolaHir<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for RtLolaHir<M>
where M: RefUnwindSafe,

§

impl<M> Send for RtLolaHir<M>
where M: Send,

§

impl<M> Sync for RtLolaHir<M>
where M: Sync,

§

impl<M> Unpin for RtLolaHir<M>
where M: Unpin,

§

impl<M> UnwindSafe for RtLolaHir<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DepAnaTrait for T
where T: DepAnaTraitWrapper,

Source§

fn direct_accesses(&self, who: StreamReference) -> Vec<StreamReference>

Returns all streams that are direct accessed by who Read more
Source§

fn direct_accesses_with( &self, who: StreamReference, ) -> Vec<(StreamReference, Vec<(Origin, StreamAccessKind)>)>

Returns all streams that are direct accessed by who together with the corresponding stream access kinds. Read more
Source§

fn transitive_accesses(&self, who: StreamReference) -> Vec<StreamReference>

Returns all streams that are transitive accessed by who Read more
Source§

fn direct_accessed_by(&self, who: StreamReference) -> Vec<StreamReference>

Returns all streams that direct access who Read more
Source§

fn direct_accessed_by_with( &self, who: StreamReference, ) -> Vec<(StreamReference, Vec<(Origin, StreamAccessKind)>)>

Returns all streams that direct access who together with the corresponding stream access kinds. Read more
Source§

fn transitive_accessed_by(&self, who: StreamReference) -> Vec<StreamReference>

Returns all streams that transitive access who Read more
Source§

fn aggregated_by( &self, who: StreamReference, ) -> Vec<(StreamReference, Origin, WindowReference)>

Returns all windows that aggregate who and the stream that uses the window Read more
Source§

fn aggregates( &self, who: StreamReference, ) -> Vec<(StreamReference, Origin, WindowReference)>

Returns all windows that are used in who and the corresponding stream that is aggregated Read more
Source§

fn graph(&self) -> &StableGraph<StreamReference, EdgeWeight>

Returns the (Dependency Graph)DependencyGraph of the specification
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MemBoundTrait for T
where T: MemBoundTraitWrapper,

Source§

fn memory_bound(&self, sr: StreamReference) -> MemorizationBound

Returns the memory bound of the given stream Read more
Source§

fn num_buckets(&self, wr: WindowReference) -> MemorizationBound

Returns the memory bound of the given sliding window Read more
Source§

fn bucket_size(&self, wr: WindowReference) -> Duration

Returns the time per bucket of a sliding window. Read more
Source§

impl<T> OrderedTrait for T
where T: OrderedTraitWrapper,

Source§

fn stream_layers(&self, sr: StreamReference) -> StreamLayers

Returns the StreamLayers of the given stream Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypedTrait for T
where T: TypedTraitWrapper,

Source§

fn stream_type(&self, sr: StreamReference) -> StreamType

Returns the StreamType of the given stream Read more
Source§

fn is_periodic(&self, sr: StreamReference) -> bool

Returns true if the given stream has a periodic evaluation pacing Read more
Source§

fn is_event(&self, sr: StreamReference) -> bool

Returns true if the given stream has a event-based evaluation pacing Read more
Source§

fn expr_type(&self, eid: ExprId) -> StreamType

Returns the StreamType of the given expression Read more
Source§

fn get_parameter_type( &self, sr: StreamReference, idx: usize, ) -> ConcreteValueType

Returns the ConcreteValueType of the idx parameter of the sr stream template Read more
Source§

fn eval_pacing_type( &self, sr: StreamReference, idx: usize, ) -> ConcretePacingType

Returns the ConcretePacingType of the given stream Read more