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_TIME_SYSTEM: i8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_TIME_SYSTEM: i8 = 11;
#[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_TIME_SYSTEM: [timeSystem; 12] = [
  timeSystem::GMST,
  timeSystem::GPS,
  timeSystem::MET,
  timeSystem::MRT,
  timeSystem::SCLK,
  timeSystem::TAI,
  timeSystem::TCB,
  timeSystem::TDB,
  timeSystem::TCG,
  timeSystem::TT,
  timeSystem::UT1,
  timeSystem::UTC,
];

#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct timeSystem(pub i8);
#[allow(non_upper_case_globals)]
impl timeSystem {
  /// Greenwich Mean Sidereal Time
  pub const GMST: Self = Self(0);
  /// Global Positioning System
  pub const GPS: Self = Self(1);
  /// Mission Elapsed Time
  pub const MET: Self = Self(2);
  /// Mission Relative Time
  pub const MRT: Self = Self(3);
  /// Spacecraft Clock (receiver) (requires rules for interpretation in ICD)
  pub const SCLK: Self = Self(4);
  /// International Atomic Time
  pub const TAI: Self = Self(5);
  /// Barycentric Coordinate Time
  pub const TCB: Self = Self(6);
  /// Barycentric Dynamical Time
  pub const TDB: Self = Self(7);
  /// Geocentric Coordinate Time
  pub const TCG: Self = Self(8);
  /// Terrestrial Time
  pub const TT: Self = Self(9);
  /// Universal Time
  pub const UT1: Self = Self(10);
  /// Coordinated Universal Time
  pub const UTC: Self = Self(11);

  pub const ENUM_MIN: i8 = 0;
  pub const ENUM_MAX: i8 = 11;
  pub const ENUM_VALUES: &'static [Self] = &[
    Self::GMST,
    Self::GPS,
    Self::MET,
    Self::MRT,
    Self::SCLK,
    Self::TAI,
    Self::TCB,
    Self::TDB,
    Self::TCG,
    Self::TT,
    Self::UT1,
    Self::UTC,
  ];
  /// Returns the variant's name or "" if unknown.
  pub fn variant_name(self) -> Option<&'static str> {
    match self {
      Self::GMST => Some("GMST"),
      Self::GPS => Some("GPS"),
      Self::MET => Some("MET"),
      Self::MRT => Some("MRT"),
      Self::SCLK => Some("SCLK"),
      Self::TAI => Some("TAI"),
      Self::TCB => Some("TCB"),
      Self::TDB => Some("TDB"),
      Self::TCG => Some("TCG"),
      Self::TT => Some("TT"),
      Self::UT1 => Some("UT1"),
      Self::UTC => Some("UTC"),
      _ => None,
    }
  }
}
impl core::fmt::Debug for timeSystem {
  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 timeSystem {
  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 timeSystem {
    type Output = timeSystem;
    #[inline]
    unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
        flatbuffers::emplace_scalar::<i8>(dst, self.0);
    }
}

impl flatbuffers::EndianScalar for timeSystem {
  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 timeSystem {
  #[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 timeSystem {}
pub enum TIMOffset {}
#[derive(Copy, Clone, PartialEq)]

/// Time System
pub struct TIM<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

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

impl<'a> TIM<'a> {
  pub const VT_TIME_SYSTEM: flatbuffers::VOffsetT = 4;

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

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

  #[inline]
  pub fn TIME_SYSTEM(&self) -> timeSystem {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<timeSystem>(TIM::VT_TIME_SYSTEM, Some(timeSystem::GMST)).unwrap()}
  }
}

impl flatbuffers::Verifiable for TIM<'_> {
  #[inline]
  fn run_verifier(
    v: &mut flatbuffers::Verifier, pos: usize
  ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
    use self::flatbuffers::Verifiable;
    v.visit_table(pos)?
     .visit_field::<timeSystem>("TIME_SYSTEM", Self::VT_TIME_SYSTEM, false)?
     .finish();
    Ok(())
  }
}
pub struct TIMArgs {
    pub TIME_SYSTEM: timeSystem,
}
impl<'a> Default for TIMArgs {
  #[inline]
  fn default() -> Self {
    TIMArgs {
      TIME_SYSTEM: timeSystem::GMST,
    }
  }
}

pub struct TIMBuilder<'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> TIMBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_TIME_SYSTEM(&mut self, TIME_SYSTEM: timeSystem) {
    self.fbb_.push_slot::<timeSystem>(TIM::VT_TIME_SYSTEM, TIME_SYSTEM, timeSystem::GMST);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> TIMBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    TIMBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<TIM<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for TIM<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("TIM");
      ds.field("TIME_SYSTEM", &self.TIME_SYSTEM());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct TIMT {
  pub TIME_SYSTEM: timeSystem,
}
impl Default for TIMT {
  fn default() -> Self {
    Self {
      TIME_SYSTEM: timeSystem::GMST,
    }
  }
}
impl TIMT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<TIM<'b>> {
    let TIME_SYSTEM = self.TIME_SYSTEM;
    TIM::create(_fbb, &TIMArgs{
      TIME_SYSTEM,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `TIM`
/// 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_TIM_unchecked`.
pub fn root_as_TIM(buf: &[u8]) -> Result<TIM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<TIM>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `TIM` 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_TIM_unchecked`.
pub fn size_prefixed_root_as_TIM(buf: &[u8]) -> Result<TIM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<TIM>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `TIM` 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_TIM_unchecked`.
pub fn root_as_TIM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<TIM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<TIM<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `TIM` 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_TIM_unchecked`.
pub fn size_prefixed_root_as_TIM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<TIM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<TIM<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a TIM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `TIM`.
pub unsafe fn root_as_TIM_unchecked(buf: &[u8]) -> TIM {
  flatbuffers::root_unchecked::<TIM>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed TIM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `TIM`.
pub unsafe fn size_prefixed_root_as_TIM_unchecked(buf: &[u8]) -> TIM {
  flatbuffers::size_prefixed_root_unchecked::<TIM>(buf)
}
pub const TIM_IDENTIFIER: &str = "$TIM";

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

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

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

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