Skip to main content

Table

Struct Table 

Source
pub struct Table<T: Sized> { /* private fields */ }
Expand description

A handle to a cFE table, generic over the table’s data type T.

This struct handles registration and unregistration of the table, providing a safe, RAII-based interface.

Implementations§

Source§

impl<T: Sized> Table<T>

Source

pub fn new(name: &str, options: TableOptions) -> Result<Self>
where T: Default + Validate,

Registers a new table with cFE Table Services.

If T implements Validate with custom logic, cFE will call it before activating any ground load. The default Validate impl accepts all loads.

Source

pub fn share(name: &str) -> Result<Self>

Obtains a handle to a table registered by another application.

This does not take ownership of the table. When this Table instance is dropped, it only releases the shared handle; it does not unregister the table itself.

§Arguments
  • name: The full name of the table, in the format “AppName.TableName”.
Source

pub fn load_from_file(&self, filename: &str) -> Result<()>

Loads data into the table from a file.

This call can block. Must not be called from ISR context.

Source

pub fn load_from_slice(&self, data: &[T]) -> Result<()>

Loads data into the table from a memory slice.

This call can block. Must not be called from ISR context.

Source

pub fn manage(&self) -> Result<()>

Performs periodic processing for the table (update, validate, dump). This should be called once per application cycle for each owned table.

Source

pub fn modified(&self) -> Result<()>

Notifies Table Services that the application has modified the table’s contents. This is important for critical tables backed by the CDS.

Source

pub fn get(&self) -> Result<TableAccessor<'_, T>>

Gets a read-only accessor to the table’s data. The accessor locks the table and automatically releases it when dropped.

Source

pub fn get_or_default(&self) -> T
where T: Default + Copy,

Returns the table data, or T::default() if the table is not currently accessible.

Source

pub fn handle(&self) -> TableHandle

Returns the underlying TableHandle.

Source

pub fn get_info(name: &str) -> Result<TableInfo>

Obtains characteristics and information about a specified table by name.

§Arguments
  • name: The full name of the table, in the format “AppName.TableName”.
Source

pub fn status(&self) -> Result<Status>

Obtains the current status of pending actions for a table.

Source

pub fn update(&self) -> Result<()>

Updates the contents of the table if an update is pending.

Source

pub fn validate(&self) -> Result<()>

Validates the contents of a table if a validation is pending.

Source

pub fn dump_to_buffer(&self) -> Result<()>

Copies the contents of a Dump Only Table to a shared buffer.

This should only be called by the table owner in response to a dump request, typically after manage() returns Ok(TblInfoDumpPending).

Source

pub fn notify_by_message( &self, msg_id: MsgId, command_code: u16, parameter: u32, ) -> Result<()>

Instructs Table Services to send a message when this table requires management.

This allows an application to be event-driven for table maintenance instead of polling with manage().

§Arguments
  • msg_id: Message ID to be used in the notification message.
  • command_code: Command code to be placed in the secondary header.
  • parameter: Application-defined value to be passed as a parameter in the message.
Source

pub unsafe fn get_accessors<const N: usize>( handles: [TableHandle; N], ) -> Result<[TableAccessor<'static, ()>; N]>

Gets read-only accessors for multiple tables at once.

§Safety

The caller must ensure that the types U in the returned accessors match the actual types of the tables identified by the handles.

Trait Implementations§

Source§

impl<T: Debug + Sized> Debug for Table<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Sized> Drop for Table<T>

Source§

fn drop(&mut self)

Unregisters the table if this instance is the owner.

Auto Trait Implementations§

§

impl<T> Freeze for Table<T>

§

impl<T> RefUnwindSafe for Table<T>
where T: RefUnwindSafe,

§

impl<T> Send for Table<T>
where T: Send,

§

impl<T> Sync for Table<T>
where T: Sync,

§

impl<T> Unpin for Table<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Table<T>

§

impl<T> UnwindSafe for Table<T>
where T: UnwindSafe,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.