Skip to content

Commit

Permalink
flatbuffer format: use float for distances
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristramg committed Apr 5, 2024
1 parent 27f866b commit 9d5fd7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions schema/lrs.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ table Connection {
endpoint:Endpoint = null;
}

/// A traversal is a path in a network.
/// A traversal is a path in a network.
/// Traversals may be used to model roads, railway tracks, railway lines or trips.
/// Traversals are defined as a sequence of segment and direction pairs.
enum Direction : byte { Increasing = 1, Decreasing = 2 }
Expand Down Expand Up @@ -124,7 +124,7 @@ table LinearReferencingMethod {
/// And that LRM is the reference for the two other traversals corresponding to each direction
used_on:[TraversalRef];
anchor_indices:[uint64] (required);
distances:[uint64] (required);
distances:[double] (required);
/// The unit used to measure the distance between anchors
distance_unit:DistanceUnit = Meters;
/// The unit used to express measures relative to anchors (12+230)
Expand Down
12 changes: 6 additions & 6 deletions src/lrs_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub const ENUM_VALUES_DIRECTION: [Direction; 2] = [
Direction::Decreasing,
];

/// A traversal is a path in a network.
/// A traversal is a path in a network.
/// Traversals may be used to model roads, railway tracks, railway lines or trips.
/// Traversals are defined as a sequence of segment and direction pairs.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
Expand Down Expand Up @@ -1992,11 +1992,11 @@ impl<'a> LinearReferencingMethod<'a> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(LinearReferencingMethod::VT_ANCHOR_INDICES, None).unwrap()}
}
#[inline]
pub fn distances(&self) -> flatbuffers::Vector<'a, u64> {
pub fn distances(&self) -> flatbuffers::Vector<'a, f64> {
// Safety:
// Created from valid Table for this object
// which contains a valid value in this slot
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u64>>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()}
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(LinearReferencingMethod::VT_DISTANCES, None).unwrap()}
}
/// The unit used to measure the distance between anchors
#[inline]
Expand Down Expand Up @@ -2028,7 +2028,7 @@ impl flatbuffers::Verifiable for LinearReferencingMethod<'_> {
.visit_field::<TraversalRef>("traversal_index", Self::VT_TRAVERSAL_INDEX, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, TraversalRef>>>("used_on", Self::VT_USED_ON, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("anchor_indices", Self::VT_ANCHOR_INDICES, true)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u64>>>("distances", Self::VT_DISTANCES, true)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("distances", Self::VT_DISTANCES, true)?
.visit_field::<DistanceUnit>("distance_unit", Self::VT_DISTANCE_UNIT, false)?
.visit_field::<DistanceUnit>("measure_unit", Self::VT_MEASURE_UNIT, false)?
.finish();
Expand All @@ -2041,7 +2041,7 @@ pub struct LinearReferencingMethodArgs<'a> {
pub traversal_index: Option<&'a TraversalRef>,
pub used_on: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, TraversalRef>>>,
pub anchor_indices: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
pub distances: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u64>>>,
pub distances: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
pub distance_unit: DistanceUnit,
pub measure_unit: DistanceUnit,
}
Expand Down Expand Up @@ -2087,7 +2087,7 @@ impl<'a: 'b, 'b> LinearReferencingMethodBuilder<'a, 'b> {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(LinearReferencingMethod::VT_ANCHOR_INDICES, anchor_indices);
}
#[inline]
pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset<flatbuffers::Vector<'b , u64>>) {
pub fn add_distances(&mut self, distances: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(LinearReferencingMethod::VT_DISTANCES, distances);
}
#[inline]
Expand Down

0 comments on commit 9d5fd7f

Please sign in to comment.