Files
@ aefbf606d736
Branch filter:
Location: CSY/reowolf/src/runtime2/component/component_ip.rs - annotation
aefbf606d736
1.5 KiB
application/rls-services+xml
Factor out execution state and control message handling
a5594f90afa6 a5594f90afa6 a5594f90afa6 be8ea413a49a a5594f90afa6 a5594f90afa6 a5594f90afa6 be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a a5594f90afa6 a5594f90afa6 be8ea413a49a a5594f90afa6 aefbf606d736 aefbf606d736 aefbf606d736 a5594f90afa6 a5594f90afa6 a5594f90afa6 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 aefbf606d736 a5594f90afa6 a5594f90afa6 a5594f90afa6 a5594f90afa6 a5594f90afa6 be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a aefbf606d736 be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a be8ea413a49a a5594f90afa6 | use crate::protocol::eval::*;
use crate::runtime2::*;
use super::*;
use super::component::*;
/// TODO: Temporary component to figure out what to do with custom components.
/// This component sends random numbers between two u32 limits
pub struct ComponentRandomU32 {
output_port_id: PortId,
random_minimum: u32,
random_maximum: u32,
}
impl Component for ComponentRandomU32 {
fn adopt_message(&mut self, _comp_ctx: &mut CompCtx, _message: DataMessage) {
// Impossible since this component does not have any input ports in its
// signature.
unreachable!();
}
fn handle_message(&mut self, sched_ctx: &mut SchedulerCtx, comp_ctx: &mut CompCtx, message: Message) {
match message {
Message::Data(message) => unreachable!(),
Message::Sync(message) => {
},
Message::Control(message) => {
}
}
}
fn run(&mut self, sched_ctx: &mut SchedulerCtx, comp_ctx: &mut CompCtx) -> Result<CompScheduling, EvalError> {
todo!()
}
}
impl ComponentRandomU32 {
pub(crate) fn new(arguments: ValueGroup) -> Self {
debug_assert_eq!(arguments.values.len(), 3);
debug_assert!(arguments.regions.is_empty());
let port_id = port_id_from_eval(arguments.values[0].as_port_id());
let minimum = arguments.values[1].as_uint32();
let maximum = arguments.values[2].as_uint32();
return Self{
output_port_id: port_id,
random_minimum: minimum,
random_maximum: maximum,
}
}
}
|