Skip to main content

XtceDb

Struct XtceDb 

Source
pub struct XtceDb { /* private fields */ }
Expand description

A loaded XTCE telemetry database.

Every entity lives in a flat arena addressed by a typed index; see crate::ids. The database is immutable once built, and Send + Sync, so one instance can be shared by any number of decoding threads.

Implementations§

Source§

impl XtceDb

Source

pub fn from_path(path: impl AsRef<Path>) -> Result<Self, XtceError>

Loads an XTCE document from disk.

§Errors

Returns XtceError::Io if the file cannot be read, and any XtceError the parser or lowering pass produces.

Source

pub fn from_xml(text: &str) -> Result<Self, XtceError>

Parses an XTCE document held in memory.

§Errors

Returns XtceError if the document is not well-formed XML, is not rooted at <SpaceSystem>, contains an unresolvable reference, or defines cyclic container inheritance.

Source

pub fn source(&self) -> Option<&Path>

The file this database was loaded from, when it came from disk.

Source

pub fn xmlns(&self) -> Option<&str>

The XML namespace declared on the root element, which identifies the XTCE version.

Source

pub fn skipped_sections(&self) -> &[String]

Document sections dropped during parsing because telemetry decoding never reads them, such as CommandMetaData.

Source

pub fn unsupported(&self) -> &[Unsupported]

Constructs that were modelled but cannot be decoded.

Source

pub fn interner(&self) -> &Interner

The string interner backing every name in this database.

Source

pub fn name(&self, id: NameId) -> &str

Resolves an interned handle to its text.

Source

pub fn space_systems(&self) -> &[SpaceSystem]

All space systems, the root first.

Source

pub fn types(&self) -> &[ParameterType]

All parameter types, in document order.

Source

pub fn parameters(&self) -> &[Parameter]

All parameters, in document order.

Source

pub fn containers(&self) -> &[Container]

All containers, in document order.

Source

pub fn entries(&self) -> &[Entry]

The shared entry arena. Slice it with Container::entries.

Source

pub fn meta_commands(&self) -> &[MetaCommand]

Every telecommand the <CommandMetaData> section defines, in document order.

Empty for a definition with no command half, which is most of them.

Source

pub fn meta_command(&self, id: MetaCommandId) -> Option<&MetaCommand>

A telecommand by index.

Source

pub fn fixed_value(&self, span: Span) -> &[u8] ⓘ

The bytes an EntryKind::FixedValue carries.

Source

pub fn find_meta_command(&self, name: &str) -> Option<MetaCommandId>

Finds a telecommand by its name or by its qualified name.

Source

pub fn root_containers(&self) -> &[ContainerId]

Containers that declare no <BaseContainer>, i.e. candidate decoding roots.

Includes the roots of the command tree, which are containers like any other. See Self::default_root_container for why the default root ignores them.

Source

pub fn space_system(&self, id: SpaceSystemId) -> Option<&SpaceSystem>

A space system by index.

Source

pub fn parameter(&self, id: ParamId) -> Option<&Parameter>

A parameter by index.

Source

pub fn parameter_type(&self, id: TypeId) -> Option<&ParameterType>

A parameter type by index.

Source

pub fn container(&self, id: ContainerId) -> Option<&Container>

A container by index.

Source

pub fn container_entries(&self, id: ContainerId) -> &[Entry]

The entries of a container, as a slice of the shared arena.

Source

pub fn type_of(&self, id: ParamId) -> Option<&ParameterType>

The type of a parameter.

Source

pub fn find_parameter(&self, name: &str) -> Option<ParamId>

Looks up a parameter by fully qualified name (/Root/PKT_APID) or, failing that, by unqualified name.

Source

pub fn find_container(&self, name: &str) -> Option<ContainerId>

Looks up a container by fully qualified name or, failing that, by unqualified name.

Source

pub fn find_type(&self, name: &str) -> Option<TypeId>

Looks up a parameter type by fully qualified name or, failing that, by unqualified name.

Source

pub fn boolean_label(&self, id: TypeId, value: bool) -> Option<&str>

The display label a boolean parameter type gives to value.

XTCE calls booleans “a restricted form of enumeration”, and this exposes the zeroStringValue / oneStringValue labels. The decoder itself yields a plain bool, matching the reference implementation.

Source

pub fn default_root_container(&self) -> Option<ContainerId>

The container a decoder should start from when none is named.

Prefers the conventional CCSDS root names, then falls back to the only base-less container if the document has exactly one.

Source

pub fn stats(&self) -> Stats

Counts for reporting, computed on demand.

Auto Trait Implementations§

§

impl Forget for XtceDb

§

impl Freeze for XtceDb

§

impl Move for XtceDb

§

impl RefUnwindSafe for XtceDb

§

impl Send for XtceDb

§

impl Sync for XtceDb

§

impl Unpin for XtceDb

§

impl UnsafeUnpin for XtceDb

§

impl UnwindSafe for XtceDb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.