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 BEMOffset {}
#[derive(Copy, Clone, PartialEq)]

/// Antenna Beam
pub struct BEM<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

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

impl<'a> BEM<'a> {
  pub const VT_ID: flatbuffers::VOffsetT = 4;
  pub const VT_BEAM_NAME: flatbuffers::VOffsetT = 6;
  pub const VT_NOTES: flatbuffers::VOffsetT = 8;
  pub const VT_BEAM_CONTOURS: flatbuffers::VOffsetT = 10;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    BEM { _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 BEMArgs<'args>
  ) -> flatbuffers::WIPOffset<BEM<'bldr>> {
    let mut builder = BEMBuilder::new(_fbb);
    if let Some(x) = args.BEAM_CONTOURS { builder.add_BEAM_CONTOURS(x); }
    if let Some(x) = args.NOTES { builder.add_NOTES(x); }
    if let Some(x) = args.BEAM_NAME { builder.add_BEAM_NAME(x); }
    if let Some(x) = args.ID { builder.add_ID(x); }
    builder.finish()
  }

  pub fn unpack(&self) -> BEMT {
    let ID = self.ID().map(|x| {
      x.to_string()
    });
    let BEAM_NAME = self.BEAM_NAME().map(|x| {
      x.to_string()
    });
    let NOTES = self.NOTES().map(|x| {
      x.to_string()
    });
    let BEAM_CONTOURS = self.BEAM_CONTOURS().map(|x| {
      x.iter().map(|s| s.to_string()).collect()
    });
    BEMT {
      ID,
      BEAM_NAME,
      NOTES,
      BEAM_CONTOURS,
    }
  }

  #[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>>(BEM::VT_ID, None)}
  }
  #[inline]
  pub fn BEAM_NAME(&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>>(BEM::VT_BEAM_NAME, None)}
  }
  #[inline]
  pub fn NOTES(&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>>(BEM::VT_NOTES, None)}
  }
  #[inline]
  pub fn BEAM_CONTOURS(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>> {
    // 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, flatbuffers::ForwardsUOffset<&'a str>>>>(BEM::VT_BEAM_CONTOURS, None)}
  }
}

impl flatbuffers::Verifiable for BEM<'_> {
  #[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>>("BEAM_NAME", Self::VT_BEAM_NAME, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<&str>>("NOTES", Self::VT_NOTES, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<&'_ str>>>>("BEAM_CONTOURS", Self::VT_BEAM_CONTOURS, false)?
     .finish();
    Ok(())
  }
}
pub struct BEMArgs<'a> {
    pub ID: Option<flatbuffers::WIPOffset<&'a str>>,
    pub BEAM_NAME: Option<flatbuffers::WIPOffset<&'a str>>,
    pub NOTES: Option<flatbuffers::WIPOffset<&'a str>>,
    pub BEAM_CONTOURS: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<&'a str>>>>,
}
impl<'a> Default for BEMArgs<'a> {
  #[inline]
  fn default() -> Self {
    BEMArgs {
      ID: None,
      BEAM_NAME: None,
      NOTES: None,
      BEAM_CONTOURS: None,
    }
  }
}

pub struct BEMBuilder<'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> BEMBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_ID(&mut self, ID: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(BEM::VT_ID, ID);
  }
  #[inline]
  pub fn add_BEAM_NAME(&mut self, BEAM_NAME: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(BEM::VT_BEAM_NAME, BEAM_NAME);
  }
  #[inline]
  pub fn add_NOTES(&mut self, NOTES: flatbuffers::WIPOffset<&'b  str>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(BEM::VT_NOTES, NOTES);
  }
  #[inline]
  pub fn add_BEAM_CONTOURS(&mut self, BEAM_CONTOURS: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<&'b  str>>>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(BEM::VT_BEAM_CONTOURS, BEAM_CONTOURS);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BEMBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    BEMBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<BEM<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for BEM<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("BEM");
      ds.field("ID", &self.ID());
      ds.field("BEAM_NAME", &self.BEAM_NAME());
      ds.field("NOTES", &self.NOTES());
      ds.field("BEAM_CONTOURS", &self.BEAM_CONTOURS());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct BEMT {
  pub ID: Option<String>,
  pub BEAM_NAME: Option<String>,
  pub NOTES: Option<String>,
  pub BEAM_CONTOURS: Option<Vec<String>>,
}
impl Default for BEMT {
  fn default() -> Self {
    Self {
      ID: None,
      BEAM_NAME: None,
      NOTES: None,
      BEAM_CONTOURS: None,
    }
  }
}
impl BEMT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<BEM<'b>> {
    let ID = self.ID.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let BEAM_NAME = self.BEAM_NAME.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let NOTES = self.NOTES.as_ref().map(|x|{
      _fbb.create_string(x)
    });
    let BEAM_CONTOURS = self.BEAM_CONTOURS.as_ref().map(|x|{
      let w: Vec<_> = x.iter().map(|s| _fbb.create_string(s)).collect();_fbb.create_vector(&w)
    });
    BEM::create(_fbb, &BEMArgs{
      ID,
      BEAM_NAME,
      NOTES,
      BEAM_CONTOURS,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `BEM`
/// 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_BEM_unchecked`.
pub fn root_as_BEM(buf: &[u8]) -> Result<BEM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<BEM>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `BEM` 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_BEM_unchecked`.
pub fn size_prefixed_root_as_BEM(buf: &[u8]) -> Result<BEM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<BEM>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `BEM` 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_BEM_unchecked`.
pub fn root_as_BEM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<BEM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<BEM<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `BEM` 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_BEM_unchecked`.
pub fn size_prefixed_root_as_BEM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<BEM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<BEM<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a BEM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `BEM`.
pub unsafe fn root_as_BEM_unchecked(buf: &[u8]) -> BEM {
  flatbuffers::root_unchecked::<BEM>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed BEM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `BEM`.
pub unsafe fn size_prefixed_root_as_BEM_unchecked(buf: &[u8]) -> BEM {
  flatbuffers::size_prefixed_root_unchecked::<BEM>(buf)
}
pub const BEM_IDENTIFIER: &str = "$BEM";

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

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

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

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