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
impl XtceDb
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self, XtceError>
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.
Sourcepub fn source(&self) -> Option<&Path>
pub fn source(&self) -> Option<&Path>
The file this database was loaded from, when it came from disk.
Sourcepub fn xmlns(&self) -> Option<&str>
pub fn xmlns(&self) -> Option<&str>
The XML namespace declared on the root element, which identifies the XTCE version.
Sourcepub fn skipped_sections(&self) -> &[String]
pub fn skipped_sections(&self) -> &[String]
Document sections dropped during parsing because telemetry decoding never reads
them, such as CommandMetaData.
Sourcepub fn unsupported(&self) -> &[Unsupported]
pub fn unsupported(&self) -> &[Unsupported]
Constructs that were modelled but cannot be decoded.
Sourcepub fn space_systems(&self) -> &[SpaceSystem]
pub fn space_systems(&self) -> &[SpaceSystem]
All space systems, the root first.
Sourcepub fn types(&self) -> &[ParameterType]
pub fn types(&self) -> &[ParameterType]
All parameter types, in document order.
Sourcepub fn parameters(&self) -> &[Parameter]
pub fn parameters(&self) -> &[Parameter]
All parameters, in document order.
Sourcepub fn containers(&self) -> &[Container]
pub fn containers(&self) -> &[Container]
All containers, in document order.
Sourcepub fn entries(&self) -> &[Entry]
pub fn entries(&self) -> &[Entry]
The shared entry arena. Slice it with Container::entries.
Sourcepub fn meta_commands(&self) -> &[MetaCommand]
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.
Sourcepub fn meta_command(&self, id: MetaCommandId) -> Option<&MetaCommand>
pub fn meta_command(&self, id: MetaCommandId) -> Option<&MetaCommand>
A telecommand by index.
Sourcepub fn fixed_value(&self, span: Span) -> &[u8] ⓘ
pub fn fixed_value(&self, span: Span) -> &[u8] ⓘ
The bytes an EntryKind::FixedValue carries.
Sourcepub fn find_meta_command(&self, name: &str) -> Option<MetaCommandId>
pub fn find_meta_command(&self, name: &str) -> Option<MetaCommandId>
Finds a telecommand by its name or by its qualified name.
Sourcepub fn root_containers(&self) -> &[ContainerId]
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.
Sourcepub fn space_system(&self, id: SpaceSystemId) -> Option<&SpaceSystem>
pub fn space_system(&self, id: SpaceSystemId) -> Option<&SpaceSystem>
A space system by index.
Sourcepub fn parameter_type(&self, id: TypeId) -> Option<&ParameterType>
pub fn parameter_type(&self, id: TypeId) -> Option<&ParameterType>
A parameter type by index.
Sourcepub fn container(&self, id: ContainerId) -> Option<&Container>
pub fn container(&self, id: ContainerId) -> Option<&Container>
A container by index.
Sourcepub fn container_entries(&self, id: ContainerId) -> &[Entry]
pub fn container_entries(&self, id: ContainerId) -> &[Entry]
The entries of a container, as a slice of the shared arena.
Sourcepub fn type_of(&self, id: ParamId) -> Option<&ParameterType>
pub fn type_of(&self, id: ParamId) -> Option<&ParameterType>
The type of a parameter.
Sourcepub fn find_parameter(&self, name: &str) -> Option<ParamId>
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.
Sourcepub fn find_container(&self, name: &str) -> Option<ContainerId>
pub fn find_container(&self, name: &str) -> Option<ContainerId>
Looks up a container by fully qualified name or, failing that, by unqualified name.
Sourcepub fn find_type(&self, name: &str) -> Option<TypeId>
pub fn find_type(&self, name: &str) -> Option<TypeId>
Looks up a parameter type by fully qualified name or, failing that, by unqualified name.
Sourcepub fn boolean_label(&self, id: TypeId, value: bool) -> Option<&str>
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.
Sourcepub fn default_root_container(&self) -> Option<ContainerId>
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.