spacedatastandards-org 1.73.12

Space data standards framework based on CCSDS standards and Google FlatBuffers.
Documentation
// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use core::mem;
use core::cmp::Ordering;

extern crate flatbuffers;
use self::flatbuffers::{EndianScalar, Follow};

pub enum MNFOffset {}
#[derive(Copy, Clone, PartialEq)]

/// Orbit Manifold
pub struct MNF<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

impl<'a> flatbuffers::Follow<'a> for MNF<'a> {
  type Inner = MNF<'a>;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    Self { _tab: flatbuffers::Table::new(buf, loc) }
  }
}

impl<'a> MNF<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_STATUS: flatbuffers::VOffsetT = 6;
  pub const VT_WEIGHT: flatbuffers::VOffsetT = 8;
  pub const VT_DELTA_V: flatbuffers::VOffsetT = 10;
  pub const VT_DELTA_T: flatbuffers::VOffsetT = 12;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    MNF { _tab: table }
  }
  #[allow(unused_mut)]
  pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
    _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
    args: &'args MNFArgs<'args>
  ) -> flatbuffers::WIPOffset<MNF<'bldr>> {
    let mut builder = MNFBuilder::new(_fbb);
    builder.add_DELTA_T(args.DELTA_T);
    builder.add_DELTA_V(args.DELTA_V);
    builder.add_WEIGHT(args.WEIGHT);
    if let Some(x) = args.STATUS { builder.add_STATUS(x); }
    if let Some(x) = args.ID { builder.add_ID(x); }
    builder.finish()
  }

  pub fn unpack(&self) -> MNFT {
    let ID = self.ID().map(|x| {
      x.to_string()
    });
    let STATUS = self.STATUS().map(|x| {
      x.to_string()
    });
    let WEIGHT = self.WEIGHT();
    let DELTA_V = self.DELTA_V();
    let DELTA_T = self.DELTA_T();
    MNFT {
      ID,
      STATUS,
      WEIGHT,
      DELTA_V,
      DELTA_T,
    }
  }

  #[inline]
  pub fn ID(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(MNF::VT_ID, None)}
  }
  #[inline]
  pub fn STATUS(&self) -> Option<&'a str> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(MNF::VT_STATUS, None)}
  }
  #[inline]
  pub fn WEIGHT(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(MNF::VT_WEIGHT, Some(0.0)).unwrap()}
  }
  #[inline]
  pub fn DELTA_V(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(MNF::VT_DELTA_V, Some(0.0)).unwrap()}
  }
  #[inline]
  pub fn DELTA_T(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(MNF::VT_DELTA_T, Some(0.0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for MNF<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("ID", Self::VT_ID, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("STATUS", Self::VT_STATUS, false)?
     .visit_field::<f64>("WEIGHT", Self::VT_WEIGHT, false)?
     .visit_field::<f64>("DELTA_V", Self::VT_DELTA_V, false)?
     .visit_field::<f64>("DELTA_T", Self::VT_DELTA_T, false)?
     .finish();
    Ok(())
  }
}
pub struct MNFArgs<'a> {
    pub ID: Option<flatbuffers::WIPOffset<&'a str>>,
    pub STATUS: Option<flatbuffers::WIPOffset<&'a str>>,
    pub WEIGHT: f64,
    pub DELTA_V: f64,
    pub DELTA_T: f64,
}
impl<'a> Default for MNFArgs<'a> {
  #[inline]
  fn default() -> Self {
    MNFArgs {
      ID: None,
      STATUS: None,
      WEIGHT: 0.0,
      DELTA_V: 0.0,
      DELTA_T: 0.0,
    }
  }
}

pub struct MNFBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
  fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
  start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> MNFBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_ID(&mut self, ID: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MNF::VT_ID, ID);
  }
  #[inline]
  pub fn add_STATUS(&mut self, STATUS: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(MNF::VT_STATUS, STATUS);
  }
  #[inline]
  pub fn add_WEIGHT(&mut self, WEIGHT: f64) {
    self.fbb_.push_slot::<f64>(MNF::VT_WEIGHT, WEIGHT, 0.0);
  }
  #[inline]
  pub fn add_DELTA_V(&mut self, DELTA_V: f64) {
    self.fbb_.push_slot::<f64>(MNF::VT_DELTA_V, DELTA_V, 0.0);
  }
  #[inline]
  pub fn add_DELTA_T(&mut self, DELTA_T: f64) {
    self.fbb_.push_slot::<f64>(MNF::VT_DELTA_T, DELTA_T, 0.0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> MNFBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    MNFBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<MNF<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for MNF<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("MNF");
      ds.field("ID", &self.ID());
      ds.field("STATUS", &self.STATUS());
      ds.field("WEIGHT", &self.WEIGHT());
      ds.field("DELTA_V", &self.DELTA_V());
      ds.field("DELTA_T", &self.DELTA_T());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct MNFT {
  pub ID: Option<String>,
  pub STATUS: Option<String>,
  pub WEIGHT: f64,
  pub DELTA_V: f64,
  pub DELTA_T: f64,
}
impl Default for MNFT {
  fn default() -> Self {
    Self {
      ID: None,
      STATUS: None,
      WEIGHT: 0.0,
      DELTA_V: 0.0,
      DELTA_T: 0.0,
    }
  }
}
impl MNFT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<MNF<'b>> {
    let ID = self.ID.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let STATUS = self.STATUS.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let WEIGHT = self.WEIGHT;
    let DELTA_V = self.DELTA_V;
    let DELTA_T = self.DELTA_T;
    MNF::create(_fbb, &MNFArgs{
      ID,
      STATUS,
      WEIGHT,
      DELTA_V,
      DELTA_T,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `MNF`
/// and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_MNF_unchecked`.
pub fn root_as_MNF(buf: &[u8]) -> Result<MNF, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<MNF>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `MNF` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `size_prefixed_root_as_MNF_unchecked`.
pub fn size_prefixed_root_as_MNF(buf: &[u8]) -> Result<MNF, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<MNF>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `MNF` and returns it.
/// Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_MNF_unchecked`.
pub fn root_as_MNF_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<MNF<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<MNF<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `MNF` and returns
/// it. Note that verification is still experimental and may not
/// catch every error, or be maximally performant. For the
/// previous, unchecked, behavior use
/// `root_as_MNF_unchecked`.
pub fn size_prefixed_root_as_MNF_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<MNF<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<MNF<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a MNF and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `MNF`.
pub unsafe fn root_as_MNF_unchecked(buf: &[u8]) -> MNF {
  flatbuffers::root_unchecked::<MNF>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed MNF and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `MNF`.
pub unsafe fn size_prefixed_root_as_MNF_unchecked(buf: &[u8]) -> MNF {
  flatbuffers::size_prefixed_root_unchecked::<MNF>(buf)
}
pub const MNF_IDENTIFIER: &str = "$MNF";

#[inline]
pub fn MNF_buffer_has_identifier(buf: &[u8]) -> bool {
  flatbuffers::buffer_has_identifier(buf, MNF_IDENTIFIER, false)
}

#[inline]
pub fn MNF_size_prefixed_buffer_has_identifier(buf: &[u8]) -> bool {
  flatbuffers::buffer_has_identifier(buf, MNF_IDENTIFIER, true)
}

#[inline]
pub fn finish_MNF_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(
    fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
    root: flatbuffers::WIPOffset<MNF<'a>>) {
  fbb.finish(root, Some(MNF_IDENTIFIER));
}

#[inline]
pub fn finish_size_prefixed_MNF_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset<MNF<'a>>) {
  fbb.finish_size_prefixed(root, Some(MNF_IDENTIFIER));
}