Skip to content

Commit

Permalink
exposed SavedSim in python
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Feb 5, 2025
1 parent 4da6d4c commit bd88093
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions rust/altrios-core/src/meet_pass/est_times/est_time_structs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::super::disp_imports::*;

#[readonly::make]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, SerdeAPI)]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, SerdeAPI, PartialEq)]
pub(super) struct EstJoinPath {
pub link_idx_match: LinkIdx,
pub est_idx_next: EstIdx,
Expand Down Expand Up @@ -38,10 +38,14 @@ impl SimpleState {
}
}

#[derive(Debug, Clone, Serialize, Deserialize, SerdeAPI)]
pub(super) struct SavedSim {
#[altrios_api]
#[derive(Debug, Default, Clone, Serialize, Deserialize, SerdeAPI, PartialEq)]
pub struct SavedSim {
#[api(skip_get, skip_set)]
pub train_sim: Box<SpeedLimitTrainSim>,
#[api(skip_get, skip_set)]
pub join_paths: Vec<EstJoinPath>,
#[api(skip_get, skip_set)]
pub est_alt: EstTime,
}

Expand Down
2 changes: 1 addition & 1 deletion rust/altrios-core/src/meet_pass/est_times/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::track::Network;
use uc::SPEED_DIFF_JOIN;
use uc::TIME_NAN;

mod est_time_structs;
pub(crate) mod est_time_structs;
mod update_times;

use est_time_structs::*;
Expand Down
2 changes: 2 additions & 0 deletions rust/altrios-core/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub use crate::consist::{Consist, ConsistState, ConsistStateHistoryVec};

pub use crate::utils::{Pyo3Vec2Wrapper, Pyo3Vec3Wrapper, Pyo3VecBoolWrapper, Pyo3VecWrapper};

pub use crate::meet_pass::est_times::est_time_structs::SavedSim;

#[cfg(feature = "pyo3")]
pub use crate::meet_pass::{
dispatch::run_dispatch_py, est_times::check_od_pair_valid, est_times::make_est_times_py,
Expand Down
1 change: 1 addition & 0 deletions rust/altrios-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fn altrios_pyo3(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m.add_class::<SpeedTrace>()?;
m.add_class::<SetSpeedTrainSim>()?;
m.add_class::<SpeedLimitTrainSim>()?;
m.add_class::<SavedSim>()?;
m.add_class::<LinkIdx>()?;
m.add_class::<LinkIdxTime>()?;
m.add_class::<TimedLinkPath>()?;
Expand Down

0 comments on commit bd88093

Please sign in to comment.