spacedatastandards-org 1.73.12

Space data standards framework based on CCSDS standards and Google FlatBuffers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
// automatically generated by the FlatBuffers compiler, do not modify


// @generated

use crate::main_generated::*;
use crate::main_generated::*;
use crate::main_generated::*;
use crate::main_generated::*;
use core::mem;
use core::cmp::Ordering;

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

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

/// Conjunction Summary Message
pub struct CSM<'a> {
  pub _tab: flatbuffers::Table<'a>,
}

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

impl<'a> CSM<'a> {
  pub const VT_OBJECT_1: flatbuffers::VOffsetT = 4;
  pub const VT_DSE_1: flatbuffers::VOffsetT = 6;
  pub const VT_OBJECT_2: flatbuffers::VOffsetT = 8;
  pub const VT_DSE_2: flatbuffers::VOffsetT = 10;
  pub const VT_TCA: flatbuffers::VOffsetT = 12;
  pub const VT_TCA_RANGE: flatbuffers::VOffsetT = 14;
  pub const VT_TCA_RELATIVE_SPEED: flatbuffers::VOffsetT = 16;
  pub const VT_MAX_PROB: flatbuffers::VOffsetT = 18;
  pub const VT_DILUTION: flatbuffers::VOffsetT = 20;

  #[inline]
  pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
    CSM { _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 CSMArgs<'args>
  ) -> flatbuffers::WIPOffset<CSM<'bldr>> {
    let mut builder = CSMBuilder::new(_fbb);
    builder.add_DILUTION(args.DILUTION);
    builder.add_MAX_PROB(args.MAX_PROB);
    builder.add_TCA_RELATIVE_SPEED(args.TCA_RELATIVE_SPEED);
    builder.add_TCA_RANGE(args.TCA_RANGE);
    builder.add_TCA(args.TCA);
    builder.add_DSE_2(args.DSE_2);
    builder.add_DSE_1(args.DSE_1);
    if let Some(x) = args.OBJECT_2 { builder.add_OBJECT_2(x); }
    if let Some(x) = args.OBJECT_1 { builder.add_OBJECT_1(x); }
    builder.finish()
  }

  pub fn unpack(&self) -> CSMT {
    let OBJECT_1 = self.OBJECT_1().map(|x| {
      Box::new(x.unpack())
    });
    let DSE_1 = self.DSE_1();
    let OBJECT_2 = self.OBJECT_2().map(|x| {
      Box::new(x.unpack())
    });
    let DSE_2 = self.DSE_2();
    let TCA = self.TCA();
    let TCA_RANGE = self.TCA_RANGE();
    let TCA_RELATIVE_SPEED = self.TCA_RELATIVE_SPEED();
    let MAX_PROB = self.MAX_PROB();
    let DILUTION = self.DILUTION();
    CSMT {
      OBJECT_1,
      DSE_1,
      OBJECT_2,
      DSE_2,
      TCA,
      TCA_RANGE,
      TCA_RELATIVE_SPEED,
      MAX_PROB,
      DILUTION,
    }
  }

  /// Satellite name for the first object
  #[inline]
  pub fn OBJECT_1(&self) -> Option<CAT<'a>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<CAT>>(CSM::VT_OBJECT_1, None)}
  }
  /// Days since epoch for the first object
  #[inline]
  pub fn DSE_1(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_DSE_1, Some(0.0)).unwrap()}
  }
  /// Satellite name for the second object
  #[inline]
  pub fn OBJECT_2(&self) -> Option<CAT<'a>> {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<CAT>>(CSM::VT_OBJECT_2, None)}
  }
  /// Days since epoch for the second object
  #[inline]
  pub fn DSE_2(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_DSE_2, Some(0.0)).unwrap()}
  }
  /// Time of closest approach as a Unix timestamp
  #[inline]
  pub fn TCA(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_TCA, Some(0.0)).unwrap()}
  }
  /// The distance or range between the two objects at TCA
  #[inline]
  pub fn TCA_RANGE(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_TCA_RANGE, Some(0.0)).unwrap()}
  }
  /// The magnitude of the relative velocity at TCA
  #[inline]
  pub fn TCA_RELATIVE_SPEED(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_TCA_RELATIVE_SPEED, Some(0.0)).unwrap()}
  }
  /// Maximum probability
  #[inline]
  pub fn MAX_PROB(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_MAX_PROB, Some(0.0)).unwrap()}
  }
  /// Standard deviation that produces the maximum probability
  #[inline]
  pub fn DILUTION(&self) -> f64 {
    // Safety:
    // Created from valid Table for this object
    // which contains a valid value in this slot
    unsafe { self._tab.get::<f64>(CSM::VT_DILUTION, Some(0.0)).unwrap()}
  }
}

impl flatbuffers::Verifiable for CSM<'_> {
  #[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<CAT>>("OBJECT_1", Self::VT_OBJECT_1, false)?
     .visit_field::<f64>("DSE_1", Self::VT_DSE_1, false)?
     .visit_field::<flatbuffers::ForwardsUOffset<CAT>>("OBJECT_2", Self::VT_OBJECT_2, false)?
     .visit_field::<f64>("DSE_2", Self::VT_DSE_2, false)?
     .visit_field::<f64>("TCA", Self::VT_TCA, false)?
     .visit_field::<f64>("TCA_RANGE", Self::VT_TCA_RANGE, false)?
     .visit_field::<f64>("TCA_RELATIVE_SPEED", Self::VT_TCA_RELATIVE_SPEED, false)?
     .visit_field::<f64>("MAX_PROB", Self::VT_MAX_PROB, false)?
     .visit_field::<f64>("DILUTION", Self::VT_DILUTION, false)?
     .finish();
    Ok(())
  }
}
pub struct CSMArgs<'a> {
    pub OBJECT_1: Option<flatbuffers::WIPOffset<CAT<'a>>>,
    pub DSE_1: f64,
    pub OBJECT_2: Option<flatbuffers::WIPOffset<CAT<'a>>>,
    pub DSE_2: f64,
    pub TCA: f64,
    pub TCA_RANGE: f64,
    pub TCA_RELATIVE_SPEED: f64,
    pub MAX_PROB: f64,
    pub DILUTION: f64,
}
impl<'a> Default for CSMArgs<'a> {
  #[inline]
  fn default() -> Self {
    CSMArgs {
      OBJECT_1: None,
      DSE_1: 0.0,
      OBJECT_2: None,
      DSE_2: 0.0,
      TCA: 0.0,
      TCA_RANGE: 0.0,
      TCA_RELATIVE_SPEED: 0.0,
      MAX_PROB: 0.0,
      DILUTION: 0.0,
    }
  }
}

pub struct CSMBuilder<'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> CSMBuilder<'a, 'b, A> {
  #[inline]
  pub fn add_OBJECT_1(&mut self, OBJECT_1: flatbuffers::WIPOffset<CAT<'b >>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<CAT>>(CSM::VT_OBJECT_1, OBJECT_1);
  }
  #[inline]
  pub fn add_DSE_1(&mut self, DSE_1: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_DSE_1, DSE_1, 0.0);
  }
  #[inline]
  pub fn add_OBJECT_2(&mut self, OBJECT_2: flatbuffers::WIPOffset<CAT<'b >>) {
    self.fbb_.push_slot_always::<flatbuffers::WIPOffset<CAT>>(CSM::VT_OBJECT_2, OBJECT_2);
  }
  #[inline]
  pub fn add_DSE_2(&mut self, DSE_2: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_DSE_2, DSE_2, 0.0);
  }
  #[inline]
  pub fn add_TCA(&mut self, TCA: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_TCA, TCA, 0.0);
  }
  #[inline]
  pub fn add_TCA_RANGE(&mut self, TCA_RANGE: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_TCA_RANGE, TCA_RANGE, 0.0);
  }
  #[inline]
  pub fn add_TCA_RELATIVE_SPEED(&mut self, TCA_RELATIVE_SPEED: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_TCA_RELATIVE_SPEED, TCA_RELATIVE_SPEED, 0.0);
  }
  #[inline]
  pub fn add_MAX_PROB(&mut self, MAX_PROB: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_MAX_PROB, MAX_PROB, 0.0);
  }
  #[inline]
  pub fn add_DILUTION(&mut self, DILUTION: f64) {
    self.fbb_.push_slot::<f64>(CSM::VT_DILUTION, DILUTION, 0.0);
  }
  #[inline]
  pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CSMBuilder<'a, 'b, A> {
    let start = _fbb.start_table();
    CSMBuilder {
      fbb_: _fbb,
      start_: start,
    }
  }
  #[inline]
  pub fn finish(self) -> flatbuffers::WIPOffset<CSM<'a>> {
    let o = self.fbb_.end_table(self.start_);
    flatbuffers::WIPOffset::new(o.value())
  }
}

impl core::fmt::Debug for CSM<'_> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    let mut ds = f.debug_struct("CSM");
      ds.field("OBJECT_1", &self.OBJECT_1());
      ds.field("DSE_1", &self.DSE_1());
      ds.field("OBJECT_2", &self.OBJECT_2());
      ds.field("DSE_2", &self.DSE_2());
      ds.field("TCA", &self.TCA());
      ds.field("TCA_RANGE", &self.TCA_RANGE());
      ds.field("TCA_RELATIVE_SPEED", &self.TCA_RELATIVE_SPEED());
      ds.field("MAX_PROB", &self.MAX_PROB());
      ds.field("DILUTION", &self.DILUTION());
      ds.finish()
  }
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq)]
pub struct CSMT {
  pub OBJECT_1: Option<Box<CATT>>,
  pub DSE_1: f64,
  pub OBJECT_2: Option<Box<CATT>>,
  pub DSE_2: f64,
  pub TCA: f64,
  pub TCA_RANGE: f64,
  pub TCA_RELATIVE_SPEED: f64,
  pub MAX_PROB: f64,
  pub DILUTION: f64,
}
impl Default for CSMT {
  fn default() -> Self {
    Self {
      OBJECT_1: None,
      DSE_1: 0.0,
      OBJECT_2: None,
      DSE_2: 0.0,
      TCA: 0.0,
      TCA_RANGE: 0.0,
      TCA_RELATIVE_SPEED: 0.0,
      MAX_PROB: 0.0,
      DILUTION: 0.0,
    }
  }
}
impl CSMT {
  pub fn pack<'b, A: flatbuffers::Allocator + 'b>(
    &self,
    _fbb: &mut flatbuffers::FlatBufferBuilder<'b, A>
  ) -> flatbuffers::WIPOffset<CSM<'b>> {
    let OBJECT_1 = self.OBJECT_1.as_ref().map(|x|{
      x.pack(_fbb)
    });
    let DSE_1 = self.DSE_1;
    let OBJECT_2 = self.OBJECT_2.as_ref().map(|x|{
      x.pack(_fbb)
    });
    let DSE_2 = self.DSE_2;
    let TCA = self.TCA;
    let TCA_RANGE = self.TCA_RANGE;
    let TCA_RELATIVE_SPEED = self.TCA_RELATIVE_SPEED;
    let MAX_PROB = self.MAX_PROB;
    let DILUTION = self.DILUTION;
    CSM::create(_fbb, &CSMArgs{
      OBJECT_1,
      DSE_1,
      OBJECT_2,
      DSE_2,
      TCA,
      TCA_RANGE,
      TCA_RELATIVE_SPEED,
      MAX_PROB,
      DILUTION,
    })
  }
}
#[inline]
/// Verifies that a buffer of bytes contains a `CSM`
/// 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_CSM_unchecked`.
pub fn root_as_CSM(buf: &[u8]) -> Result<CSM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root::<CSM>(buf)
}
#[inline]
/// Verifies that a buffer of bytes contains a size prefixed
/// `CSM` 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_CSM_unchecked`.
pub fn size_prefixed_root_as_CSM(buf: &[u8]) -> Result<CSM, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root::<CSM>(buf)
}
#[inline]
/// Verifies, with the given options, that a buffer of bytes
/// contains a `CSM` 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_CSM_unchecked`.
pub fn root_as_CSM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<CSM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::root_with_opts::<CSM<'b>>(opts, buf)
}
#[inline]
/// Verifies, with the given verifier options, that a buffer of
/// bytes contains a size prefixed `CSM` 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_CSM_unchecked`.
pub fn size_prefixed_root_as_CSM_with_opts<'b, 'o>(
  opts: &'o flatbuffers::VerifierOptions,
  buf: &'b [u8],
) -> Result<CSM<'b>, flatbuffers::InvalidFlatbuffer> {
  flatbuffers::size_prefixed_root_with_opts::<CSM<'b>>(opts, buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a CSM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `CSM`.
pub unsafe fn root_as_CSM_unchecked(buf: &[u8]) -> CSM {
  flatbuffers::root_unchecked::<CSM>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed CSM and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `CSM`.
pub unsafe fn size_prefixed_root_as_CSM_unchecked(buf: &[u8]) -> CSM {
  flatbuffers::size_prefixed_root_unchecked::<CSM>(buf)
}
pub const CSM_IDENTIFIER: &str = "$CSM";

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

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

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

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