Skip to content

Commit

Permalink
Remove unused code in trace-to-events
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Jan 17, 2025
1 parent b289133 commit cf310db
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 65 deletions.
10 changes: 0 additions & 10 deletions trace-to-events/src/pulse_detection/datatype/eventpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pub(crate) trait EventPoint: Debug + Clone {

fn get_time(&self) -> Self::TimeType;
fn get_data(&self) -> &Self::EventType;
fn get_data_mut(&mut self) -> &mut Self::EventType;
fn take_data(self) -> Self::EventType;
}

impl<T, E> EventPoint for (T, E)
Expand All @@ -26,12 +24,4 @@ where
fn get_data(&self) -> &E {
&self.1
}

fn get_data_mut(&mut self) -> &mut E {
&mut self.1
}

fn take_data(self) -> E {
self.1
}
}
5 changes: 0 additions & 5 deletions trace-to-events/src/pulse_detection/datatype/tracepoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub(crate) trait TracePoint: Clone {

fn get_time(&self) -> Self::TimeType;
fn get_value(&self) -> &Self::ValueType;
fn take_value(self) -> Self::ValueType;

fn clone_value(&self) -> Self::ValueType {
self.get_value().clone()
Expand Down Expand Up @@ -49,10 +48,6 @@ where
&self.1
}

fn take_value(self) -> Self::ValueType {
self.1
}

fn clone_value(&self) -> Self::ValueType {
self.get_value().clone()
}
Expand Down
27 changes: 0 additions & 27 deletions trace-to-events/src/pulse_detection/datatype/tracevalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,10 @@ use std::{
/// - take_value(): destructs the data point and gives the caller ownership of the value.
pub(crate) trait TraceValue: Default + Clone + Debug + Display {
type ContentType: Default + Clone + Debug + Display;

fn get_value(&self) -> &Self::ContentType;
fn take_value(self) -> Self::ContentType;
}

impl TraceValue for Real {
type ContentType = Real;

fn get_value(&self) -> &Self::ContentType {
self
}

fn take_value(self) -> Self::ContentType {
self
}
}

/// This type allows the use of static arrays of TraceValue types as TraceValues
Expand Down Expand Up @@ -93,14 +82,6 @@ where

impl<const N: usize, T: TraceValue + Copy> TraceValue for TraceArray<N, T> {
type ContentType = TraceArray<N, T>;

fn get_value(&self) -> &Self::ContentType {
self
}

fn take_value(self) -> Self::ContentType {
self
}
}

/// In practice arrays of Real types are mostly used.
Expand Down Expand Up @@ -132,12 +113,4 @@ impl Display for Stats {

impl TraceValue for Stats {
type ContentType = Stats;

fn get_value(&self) -> &Self::ContentType {
self
}

fn take_value(self) -> Self::ContentType {
self
}
}
2 changes: 1 addition & 1 deletion trace-to-events/src/pulse_detection/detectors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod advanced_muon_detector;
pub mod threshold_detector;

use super::{
pulse::{TimeValue, TimeValueOptional},
pulse::TimeValue,
EventData, EventPoint, Pulse, Real, RealArray, TracePoint,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{Assembler, Detector, EventData, Pulse, Real, TimeValueOptional};
use super::{Detector, EventData, Real};
use std::fmt::Display;

#[derive(Default, Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -118,27 +118,6 @@ impl Detector for ThresholdDetector {
}
}

#[derive(Default, Clone)]
pub(crate) struct ThresholdAssembler {}

impl Assembler for ThresholdAssembler {
type DetectorType = ThresholdDetector;

fn assemble_pulses(
&mut self,
source: <Self::DetectorType as Detector>::EventPointType,
) -> Option<Pulse> {
let (time, Data { pulse_height }) = source;
Some(Pulse {
start: TimeValueOptional {
time: Some(time),
value: Some(pulse_height),
},
..Default::default()
})
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit cf310db

Please sign in to comment.