WIP
This commit is contained in:
@@ -109,6 +109,8 @@ pub trait BinningggContainerBinsDyn: fmt::Debug + Send + fmt::Display + WithLen
|
|||||||
|
|
||||||
pub type BinsBoxed = Box<dyn BinningggContainerBinsDyn>;
|
pub type BinsBoxed = Box<dyn BinningggContainerBinsDyn>;
|
||||||
|
|
||||||
|
pub type EventsBoxed = Box<dyn BinningggContainerEventsDyn>;
|
||||||
|
|
||||||
pub trait BinningggBinnerTy: fmt::Debug + Send {
|
pub trait BinningggBinnerTy: fmt::Debug + Send {
|
||||||
type Input: fmt::Debug;
|
type Input: fmt::Debug;
|
||||||
type Output: fmt::Debug;
|
type Output: fmt::Debug;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ use items_0::timebin::BinningggBinnerDyn;
|
|||||||
use items_0::timebin::BinningggContainerBinsDyn;
|
use items_0::timebin::BinningggContainerBinsDyn;
|
||||||
use items_0::timebin::BinningggContainerEventsDyn;
|
use items_0::timebin::BinningggContainerEventsDyn;
|
||||||
use items_0::timebin::BinningggError;
|
use items_0::timebin::BinningggError;
|
||||||
|
use items_0::timebin::BinsBoxed;
|
||||||
|
use items_0::timebin::EventsBoxed;
|
||||||
|
use netpod::log::*;
|
||||||
use netpod::BinnedRange;
|
use netpod::BinnedRange;
|
||||||
use netpod::TsNano;
|
use netpod::TsNano;
|
||||||
use std::arch::x86_64;
|
use std::arch::x86_64;
|
||||||
@@ -52,7 +55,7 @@ impl<EVT> BinnedEventsTimeweightTrait for BinnedEventsTimeweightDynbox<EVT>
|
|||||||
where
|
where
|
||||||
EVT: EventValueType,
|
EVT: EventValueType,
|
||||||
{
|
{
|
||||||
fn ingest(&mut self, evs_all: Box<dyn BinningggContainerEventsDyn>) -> Result<(), BinningggError> {
|
fn ingest(&mut self, evs_all: EventsBoxed) -> Result<(), BinningggError> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +69,7 @@ where
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output(&mut self) -> Result<Box<dyn BinningggContainerBinsDyn>, BinningggError> {
|
fn output(&mut self) -> Result<BinsBoxed, BinningggError> {
|
||||||
// self.binner.output()
|
// self.binner.output()
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@@ -88,21 +91,31 @@ impl BinnedEventsTimeweightLazy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BinnedEventsTimeweightTrait for BinnedEventsTimeweightLazy {
|
impl BinnedEventsTimeweightTrait for BinnedEventsTimeweightLazy {
|
||||||
fn ingest(&mut self, evs_all: Box<dyn BinningggContainerEventsDyn>) -> Result<(), BinningggError> {
|
fn ingest(&mut self, evs_all: EventsBoxed) -> Result<(), BinningggError> {
|
||||||
// TODO the container must provide a method to create the dyn binner.
|
self.binned_events
|
||||||
let binned_events = self.binned_events.get_or_insert_with(|| todo!());
|
.get_or_insert_with(|| evs_all.binned_events_timeweight_traitobj())
|
||||||
todo!()
|
.ingest(evs_all)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn input_done_range_final(&mut self) -> Result<(), BinningggError> {
|
fn input_done_range_final(&mut self) -> Result<(), BinningggError> {
|
||||||
todo!()
|
debug!("TODO something to do if we miss the binner here?");
|
||||||
|
self.binned_events
|
||||||
|
.as_mut()
|
||||||
|
.map(|x| x.input_done_range_final())
|
||||||
|
.unwrap_or(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn input_done_range_open(&mut self) -> Result<(), BinningggError> {
|
fn input_done_range_open(&mut self) -> Result<(), BinningggError> {
|
||||||
todo!()
|
debug!("TODO something to do if we miss the binner here?");
|
||||||
|
self.binned_events
|
||||||
|
.as_mut()
|
||||||
|
.map(|x| x.input_done_range_open())
|
||||||
|
.unwrap_or(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output(&mut self) -> Result<Box<dyn BinningggContainerBinsDyn>, BinningggError> {
|
fn output(&mut self) -> Result<BinsBoxed, BinningggError> {
|
||||||
|
debug!("TODO something to do if we miss the binner here?");
|
||||||
|
// TODO change trait because without binner we can not produce any container here
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1105,11 +1105,15 @@ impl<STY: ScalarOps> Events for EventsDim0<STY> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn to_container_events(&self) -> Box<dyn ::items_0::timebin::BinningggContainerEventsDyn> {
|
fn to_container_events(&self) -> Box<dyn ::items_0::timebin::BinningggContainerEventsDyn> {
|
||||||
// let tss = self.tss.iter().map(|&x| TsNano::from_ns(x)).collect();
|
use crate::binning::container_events::ContainerEvents;
|
||||||
// let vals = self.values.clone();
|
let tss = self.tss.iter().map(|&x| TsNano::from_ns(x)).collect();
|
||||||
// let ret = crate::binning::container_events::ContainerEvents::from_constituents(tss, vals);
|
if let Some(evs) = self.as_any_ref().downcast_ref::<EventsDim0<f64>>() {
|
||||||
// Box::new(ret)
|
let vals = evs.values.clone();
|
||||||
todo!()
|
let ret = ContainerEvents::<f64>::from_constituents(tss, vals);
|
||||||
|
Box::new(ret)
|
||||||
|
} else {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user