WIP new container

This commit is contained in:
Dominik Werder
2024-11-24 22:32:04 +01:00
parent e17bb885fc
commit 46b3d28db2
20 changed files with 988 additions and 491 deletions

View File

@@ -1,52 +1,53 @@
use crate::eventsdim0::EventsDim0;
use crate::eventsdim1::EventsDim1;
use crate::binning::container_events::ContainerEvents;
use crate::Error;
use daqbuf_err as err;
use items_0::Empty;
use items_0::Events;
use items_0::timebin::BinningggContainerEventsDyn;
use netpod::log::*;
use netpod::EnumVariant;
use netpod::ScalarType;
use netpod::Shape;
pub fn empty_events_dyn_ev(scalar_type: &ScalarType, shape: &Shape) -> Result<Box<dyn Events>, Error> {
let ret: Box<dyn Events> = match shape {
pub fn empty_events_dyn_ev(
scalar_type: &ScalarType,
shape: &Shape,
) -> Result<Box<dyn BinningggContainerEventsDyn>, Error> {
let ret: Box<dyn BinningggContainerEventsDyn> = match shape {
Shape::Scalar => {
use ScalarType::*;
type K<T> = EventsDim0<T>;
type K<T> = ContainerEvents<T>;
match scalar_type {
U8 => Box::new(K::<u8>::empty()),
U16 => Box::new(K::<u16>::empty()),
U32 => Box::new(K::<u32>::empty()),
U64 => Box::new(K::<u64>::empty()),
I8 => Box::new(K::<i8>::empty()),
I16 => Box::new(K::<i16>::empty()),
I32 => Box::new(K::<i32>::empty()),
I64 => Box::new(K::<i64>::empty()),
F32 => Box::new(K::<f32>::empty()),
F64 => Box::new(K::<f64>::empty()),
BOOL => Box::new(K::<bool>::empty()),
STRING => Box::new(K::<String>::empty()),
Enum => Box::new(K::<EnumVariant>::empty()),
U8 => Box::new(K::<u8>::new()),
U16 => Box::new(K::<u16>::new()),
U32 => Box::new(K::<u32>::new()),
U64 => Box::new(K::<u64>::new()),
I8 => Box::new(K::<i8>::new()),
I16 => Box::new(K::<i16>::new()),
I32 => Box::new(K::<i32>::new()),
I64 => Box::new(K::<i64>::new()),
F32 => Box::new(K::<f32>::new()),
F64 => Box::new(K::<f64>::new()),
BOOL => Box::new(K::<bool>::new()),
STRING => Box::new(K::<String>::new()),
Enum => Box::new(K::<EnumVariant>::new()),
}
}
Shape::Wave(..) => {
use ScalarType::*;
type K<T> = EventsDim1<T>;
type K<T> = ContainerEvents<Vec<T>>;
match scalar_type {
U8 => Box::new(K::<u8>::empty()),
U16 => Box::new(K::<u16>::empty()),
U32 => Box::new(K::<u32>::empty()),
U64 => Box::new(K::<u64>::empty()),
I8 => Box::new(K::<i8>::empty()),
I16 => Box::new(K::<i16>::empty()),
I32 => Box::new(K::<i32>::empty()),
I64 => Box::new(K::<i64>::empty()),
F32 => Box::new(K::<f32>::empty()),
F64 => Box::new(K::<f64>::empty()),
BOOL => Box::new(K::<bool>::empty()),
STRING => Box::new(K::<String>::empty()),
Enum => Box::new(K::<EnumVariant>::empty()),
U8 => Box::new(K::<u8>::new()),
U16 => Box::new(K::<u16>::new()),
U32 => Box::new(K::<u32>::new()),
U64 => Box::new(K::<u64>::new()),
I8 => Box::new(K::<i8>::new()),
I16 => Box::new(K::<i16>::new()),
I32 => Box::new(K::<i32>::new()),
I64 => Box::new(K::<i64>::new()),
F32 => Box::new(K::<f32>::new()),
F64 => Box::new(K::<f64>::new()),
BOOL => Box::new(K::<bool>::new()),
STRING => Box::new(K::<String>::new()),
Enum => Box::new(K::<EnumVariant>::new()),
}
}
Shape::Image(..) => {