pub trait Frame: Anchor {
fn frame_type(&self) -> FrameType;
fn is_compatible_with(&self, other: &dyn Frame) -> bool {
self.frame_type() == other.frame_type()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FrameType {
Reference,
Perspective,
Access,
Execution,
Ambiguous,
}
pub trait ReferenceFrame: Frame
where
Self: ?Sized,
{
fn origin(&self) -> &TopologySegment;
fn transform_to<GLASS>(
&self,
observation: &impl Glass<GLASS>,
target_frame: &dyn ReferenceFrame,
) -> Option<Observation<GLASS>>
where
GLASS: Clone,
Self: Sized;
}
impl Frame for ! {
fn frame_type(&self) -> FrameType {
todo!()
}
}
impl Anchor for ! {
fn anchor_domains(&self) -> AnchorDomainSet {
todo!()
}
}
impl ReferenceFrame for ! {
fn origin(&self) -> &TopologySegment {
todo!()
}
fn transform_to<GLASS>(&self, observation: &impl Glass<GLASS>, target_frame: &dyn ReferenceFrame) -> Option<Observation<GLASS>>
where
GLASS: Clone,
Self: Sized
{
todo!()
}
}
impl Frame for () {
fn frame_type(&self) -> FrameType {
todo!()
}
}
impl Anchor for () {
fn anchor_domains(&self) -> AnchorDomainSet {
todo!()
}
}
impl ReferenceFrame for () {
fn origin(&self) -> &TopologySegment {
todo!()
}
fn transform_to<GLASS>(&self, observation: &impl Glass<GLASS>, target_frame: &dyn ReferenceFrame) -> Option<Observation<GLASS>>
where
GLASS: Clone,
Self: Sized
{
todo!()
}
}
pub trait PerspectiveFrame: Frame {
fn perspective_basis(&self) -> &str;
fn bias_estimate(&self) -> f64 { 0.5 }
}
pub trait AccessFrame: Frame {
fn authorized_positions(&self) -> &[TopologySegment];
fn can_observe(&self, observer_position: &TopologySegment) -> bool {
todo!("This needs to be fixed, but isnt version 7 blocking so fuck it, added to the list of shit to do")
}
}
pub trait ExecutionFrame: Frame {
fn scope_depth(&self) -> usize;
fn is_active(&self) -> bool;
fn parent_frame_id(&self) -> Option<u64>;
}
use alloc::vec::Vec;
use crate::daemonic::{AnchorDomainSet, TopologyAnchor, TopologySegment};
use crate::Severity;
use crate::Glass;
use crate::Observation;
use crate::daemonic::{Anchor, SpatialAnchor};