pub struct NodeMap { /* private fields */ }Expand description
Runtime nodemap built from an [XmlModel] capable of reading and writing
feature values via a RegisterIo transport.
Implementations§
Source§impl NodeMap
impl NodeMap
Sourcepub fn version(&self) -> &str
pub fn version(&self) -> &str
Return the schema version string associated with the XML description.
Sourcepub fn node_names(&self) -> impl Iterator<Item = &str>
pub fn node_names(&self) -> impl Iterator<Item = &str>
Return an iterator over all node names in the map.
Sourcepub fn dependents(&self, name: &str) -> &[String]
pub fn dependents(&self, name: &str) -> &[String]
Return the list of nodes that should be invalidated when name changes.
Returns an empty slice if the node has no dependents.
Sourcepub fn categories(&self) -> Vec<(&str, &[String])>
pub fn categories(&self) -> Vec<(&str, &[String])>
Return all category nodes as (name, children) pairs.
Sourcepub fn nodes_at_visibility(&self, level: Visibility) -> Vec<&str>
pub fn nodes_at_visibility(&self, level: Visibility) -> Vec<&str>
Return names of nodes visible at the given level or below.
A node with Visibility::Expert is visible at level Expert and Guru,
but not at Beginner.
Sourcepub fn try_from_xml(model: XmlModel) -> Result<Self, GenApiError>
pub fn try_from_xml(model: XmlModel) -> Result<Self, GenApiError>
Construct a NodeMap from an [XmlModel], validating SwissKnife expressions.
Sourcepub fn get_integer(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<i64, GenApiError>
pub fn get_integer( &self, name: &str, io: &dyn RegisterIo, ) -> Result<i64, GenApiError>
Read an integer feature value using the provided transport.
Sourcepub fn set_integer(
&mut self,
name: &str,
value: i64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_integer( &mut self, name: &str, value: i64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write an integer feature and update dependent caches.
Sourcepub fn get_float(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<f64, GenApiError>
pub fn get_float( &self, name: &str, io: &dyn RegisterIo, ) -> Result<f64, GenApiError>
Read a floating point feature.
Sourcepub fn set_float(
&mut self,
name: &str,
value: f64,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_float( &mut self, name: &str, value: f64, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a floating point feature using the scale/offset conversion.
Sourcepub fn get_enum(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<String, GenApiError>
pub fn get_enum( &self, name: &str, io: &dyn RegisterIo, ) -> Result<String, GenApiError>
Read an enumeration feature returning the symbolic entry name.
Sourcepub fn set_enum(
&mut self,
name: &str,
entry: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_enum( &mut self, name: &str, entry: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write an enumeration entry.
Sourcepub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenApiError>
pub fn enum_entries(&self, name: &str) -> Result<Vec<String>, GenApiError>
List the available entry names for an enumeration feature.
Sourcepub fn is_implemented(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn is_implemented( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Evaluate pIsImplemented for name, returning true when the feature
is implemented by the device.
Absent pIsImplemented defaults to true (matching the GenICam spec:
an undeclared predicate means “always implemented”). Evaluation errors
propagate to the caller so bad XML is visible rather than silently
reported as implemented.
Sourcepub fn is_available(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn is_available( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Evaluate pIsAvailable plus selector gating for name.
Returns false when the feature is not implemented, when
pIsAvailable evaluates to zero, or when any selected_if rule is
violated by the current selector value. Callers that want pure XML
gating without selector checks should use NodeMap::is_implemented
instead.
Sourcepub fn effective_access_mode(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<AccessMode, GenApiError>
pub fn effective_access_mode( &self, name: &str, io: &dyn RegisterIo, ) -> Result<AccessMode, GenApiError>
Return the effective AccessMode for name given the current
device state.
- If the feature is unavailable (see
NodeMap::is_available), the function returnsAccessMode::RO— we cannot report “NA” without introducing a new variant, and Studio’s wire protocol carries the availability flag separately. - If
pIsLockedevaluates truthy,RWdowngrades toRO;ROandWOare unaffected. - Otherwise the statically declared access mode applies.
Sourcepub fn available_enum_entries(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<Vec<String>, GenApiError>
pub fn available_enum_entries( &self, name: &str, io: &dyn RegisterIo, ) -> Result<Vec<String>, GenApiError>
Return the subset of enum entries currently reported as available by
the device, or the full static list when no entry declares an
pIsImplemented/pIsAvailable.
Falling back to the full list preserves current behaviour for XMLs that don’t gate individual entries, so callers stop seeing the stale static list when the new predicates are added and otherwise behave as before.
Sourcepub fn get_bool(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<bool, GenApiError>
pub fn get_bool( &self, name: &str, io: &dyn RegisterIo, ) -> Result<bool, GenApiError>
Read a boolean feature.
Sourcepub fn set_bool(
&mut self,
name: &str,
value: bool,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_bool( &mut self, name: &str, value: bool, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a boolean feature.
Sourcepub fn exec_command(
&mut self,
name: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn exec_command( &mut self, name: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Execute a command feature by writing a value to the command register.
Sourcepub fn get_converter(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<f64, GenApiError>
pub fn get_converter( &self, name: &str, io: &dyn RegisterIo, ) -> Result<f64, GenApiError>
Read a Converter feature value (float) using the provided transport.
Sourcepub fn get_int_converter(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<i64, GenApiError>
pub fn get_int_converter( &self, name: &str, io: &dyn RegisterIo, ) -> Result<i64, GenApiError>
Read an IntConverter feature value (integer) using the provided transport.
Sourcepub fn get_string(
&self,
name: &str,
io: &dyn RegisterIo,
) -> Result<String, GenApiError>
pub fn get_string( &self, name: &str, io: &dyn RegisterIo, ) -> Result<String, GenApiError>
Read a String feature value using the provided transport.
Sourcepub fn set_string(
&self,
name: &str,
value: &str,
io: &dyn RegisterIo,
) -> Result<(), GenApiError>
pub fn set_string( &self, name: &str, value: &str, io: &dyn RegisterIo, ) -> Result<(), GenApiError>
Write a String feature value using the provided transport.