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>
impl<T: Sized> Table<T>
Sourcepub fn new(name: &str, options: TableOptions) -> Result<Self>
pub fn new(name: &str, options: TableOptions) -> Result<Self>
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.
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”.
Sourcepub fn load_from_file(&self, filename: &str) -> Result<()>
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.
Sourcepub fn load_from_slice(&self, data: &[T]) -> Result<()>
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.
Sourcepub fn manage(&self) -> Result<()>
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.
Sourcepub fn modified(&self) -> Result<()>
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.
Sourcepub fn get(&self) -> Result<TableAccessor<'_, T>>
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.
Sourcepub fn get_or_default(&self) -> T
pub fn get_or_default(&self) -> T
Returns the table data, or T::default() if the
table is not currently accessible.
Sourcepub fn handle(&self) -> TableHandle
pub fn handle(&self) -> TableHandle
Returns the underlying TableHandle.
Sourcepub fn get_info(name: &str) -> Result<TableInfo>
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”.
Sourcepub fn status(&self) -> Result<Status>
pub fn status(&self) -> Result<Status>
Obtains the current status of pending actions for a table.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates the contents of a table if a validation is pending.
Sourcepub fn dump_to_buffer(&self) -> Result<()>
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).
Sourcepub fn notify_by_message(
&self,
msg_id: MsgId,
command_code: u16,
parameter: u32,
) -> Result<()>
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.
Sourcepub unsafe fn get_accessors<const N: usize>(
handles: [TableHandle; N],
) -> Result<[TableAccessor<'static, ()>; N]>
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.