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};

#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_MEAN_ELEMENT_THEORY: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_MEAN_ELEMENT_THEORY: i8 = 3;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
#[allow(non_camel_case_types)]
pub const ENUM_VALUES_MEAN_ELEMENT_THEORY: [meanElementTheory; 4] = [
  meanElementTheory::SGP4,
  meanElementTheory::SGP4XP,
  meanElementTheory::DSST,
  meanElementTheory::USM,
];

#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct meanElementTheory(pub i8);
#[allow(non_upper_case_globals)]
impl meanElementTheory {
  /// Simplified General Perturbation Model 4
  pub const SGP4: Self = Self(0);
  /// Simplified General Perturbation Model 4 eXtended Perturbations (https://amostech.com/TechnicalPapers/2022/Astrodynamics/Payne_2.pdf)
  pub const SGP4XP: Self = Self(1);
  /// Draper Semi-analytical Satellite Theory
  pub const DSST: Self = Self(2);
  /// Universal Semianalytical Method
  pub const USM: Self = Self(3);

  pub const ENUM_MIN: i8 = 0;
  pub const ENUM_MAX: i8 = 3;
  pub const ENUM_VALUES: &'static [Self] = &[
    Self::SGP4,
    Self::SGP4XP,
    Self::DSST,
    Self::USM,
  ];
  /// Returns the variant's name or "" if unknown.
  pub fn variant_name(self) -> Option<&'static str> {
    match self {
      Self::SGP4 => Some("SGP4"),
      Self::SGP4XP => Some("SGP4XP"),
      Self::DSST => Some("DSST"),
      Self::USM => Some("USM"),
      _ => None,
    }
  }
}
impl core::fmt::Debug for meanElementTheory {
  fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
    if let Some(name) = self.variant_name() {
      f.write_str(name)
    } else {
      f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
    }
  }
}
impl<'a> flatbuffers::Follow<'a> for meanElementTheory {
  type Inner = Self;
  #[inline]
  unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    let b = flatbuffers::read_scalar_at::<i8>(buf, loc);
    Self(b)
  }
}

impl flatbuffers::Push for meanElementTheory {
    type Output = meanElementTheory;
    #[inline]
    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
        flatbuffers::emplace_scalar::<i8>(dst, self.0);
    }
}

impl flatbuffers::EndianScalar for meanElementTheory {
  type Scalar = i8;
  #[inline]
  fn to_little_endian(self) -> i8 {
    self.0.to_le()
  }
  #[inline]
  #[allow(clippy::wrong_self_convention)]
  fn from_little_endian(v: i8) -> Self {
    let b = i8::from_le(v);
    Self(b)
  }
}

impl<'a> flatbuffers::Verifiable for meanElementTheory {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    i8::run_verifier(v, pos)
  }
}

impl flatbuffers::SimpleToVerifyInSlice for meanElementTheory {}
pub enum METOffset {}
#[derive(Copy, Clone, PartialEq)]

/// Mean Element Theory
pub struct MET<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

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

impl<'a> MET<'a> {
  pub const VT_MEAN_ELEMENT_THEORY: flatbuffers::VOffsetT = 4;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    MET { _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 METArgs
  ) -> flatbuffers::WIPOffset<MET<'bldr>> {
    let mut builder = METBuilder::new(_fbb);
    builder.add_MEAN_ELEMENT_THEORY(args.MEAN_ELEMENT_THEORY);
    builder.finish()
  }

  pub fn unpack(&self) -> METT {
    let MEAN_ELEMENT_THEORY = self.MEAN_ELEMENT_THEORY();
    METT {
      MEAN_ELEMENT_THEORY,
    }
  }

  #[inline]
  pub fn MEAN_ELEMENT_THEORY(&self) -> meanElementTheory {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<meanElementTheory>(MET::VT_MEAN_ELEMENT_THEORY, Some(meanElementTheory::SGP4)).unwrap()}
  }
}

impl flatbuffers::Verifiable for MET<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<meanElementTheory>("MEAN_ELEMENT_THEORY", Self::VT_MEAN_ELEMENT_THEORY, false)?
     .finish();
    Ok(())
  }
}
pub struct METArgs {
    pub MEAN_ELEMENT_THEORY: meanElementTheory,
}
impl<'a> Default for METArgs {
  #[inline]
  fn default() -> Self {
    METArgs {
      MEAN_ELEMENT_THEORY: meanElementTheory::SGP4,
    }
  }
}

pub struct METBuilder<'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> METBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_MEAN_ELEMENT_THEORY(&mut self, MEAN_ELEMENT_THEORY: meanElementTheory) {
    self.fbb_.push_slot::<meanElementTheory>(MET::VT_MEAN_ELEMENT_THEORY, MEAN_ELEMENT_THEORY, meanElementTheory::SGP4);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> METBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    METBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<MET<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for MET<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("MET");
      ds.field("MEAN_ELEMENT_THEORY", &self.MEAN_ELEMENT_THEORY());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct METT {
  pub MEAN_ELEMENT_THEORY: meanElementTheory,
}
impl Default for METT {
  fn default() -> Self {
    Self {
      MEAN_ELEMENT_THEORY: meanElementTheory::SGP4,
    }
  }
}
impl METT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<MET<'b>> {
    let MEAN_ELEMENT_THEORY = self.MEAN_ELEMENT_THEORY;
    MET::create(_fbb, &METArgs{
      MEAN_ELEMENT_THEORY,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `MET`
/// 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_MET_unchecked`.
pub fn root_as_MET(buf: &[u8]) -> Result<MET, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<MET>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `MET` 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_MET_unchecked`.
pub fn size_prefixed_root_as_MET(buf: &[u8]) -> Result<MET, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<MET>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `MET` 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_MET_unchecked`.
pub fn root_as_MET_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<MET<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<MET<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `MET` 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_MET_unchecked`.
pub fn size_prefixed_root_as_MET_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<MET<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<MET<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a MET and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `MET`.
pub unsafe fn root_as_MET_unchecked(buf: &[u8]) -> MET {
  flatbuffers::root_unchecked::<MET>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed MET and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `MET`.
pub unsafe fn size_prefixed_root_as_MET_unchecked(buf: &[u8]) -> MET {
  flatbuffers::size_prefixed_root_unchecked::<MET>(buf)
}
pub const MET_IDENTIFIER: &str = "$MET";

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

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

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

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