pub struct ElementType { /* private fields */ }
Expand description
ElementType
is an abstraction over element types in the specification.
It provides no public fields, but it has methods to get all the info needed to parse an arxml element.
Implementations§
Source§impl ElementType
impl ElementType
Sourcepub const ROOT: Self
pub const ROOT: Self
ElementType::ROOT
is the root ElementType
of the Autosar arxml document: this is the ElementType
of the AUTOSAR element
Sourcepub fn get_sub_element_version_mask(
&self,
element_indices: &[usize],
) -> Option<u32>
pub fn get_sub_element_version_mask( &self, element_indices: &[usize], ) -> Option<u32>
get the version mask of a sub element
Sourcepub fn get_sub_element_multiplicity(
&self,
element_indices: &[usize],
) -> Option<ElementMultiplicity>
pub fn get_sub_element_multiplicity( &self, element_indices: &[usize], ) -> Option<ElementMultiplicity>
get the multiplicity of a sub element within the current ElementType
The sub element is identified by an indx list, as returned by find_sub_element()
Sourcepub fn get_sub_element_container_mode(
&self,
element_indices: &[usize],
) -> ContentMode
pub fn get_sub_element_container_mode( &self, element_indices: &[usize], ) -> ContentMode
get the ContentMode
of the container of a sub element of the current ElementType
The sub element is identified by an index list, as returned by find_sub_element()
Sourcepub fn find_sub_element(
&self,
target_name: ElementName,
version: u32,
) -> Option<(ElementType, Vec<usize>)>
pub fn find_sub_element( &self, target_name: ElementName, version: u32, ) -> Option<(ElementType, Vec<usize>)>
find a sub element in the specification of the current ElementType
Note: Version here is NOT an AutosarVersion
, it is a u32. it is a bitmask which can contain multiple AutosarVersions
, or any version by using u32::MAX
In almost all cases this is simple: there is a flat list of sub elements that either contains the target_name
or not.
The result in those simple cases is a vec with one entry which is the index of the element in the list.
There are a handfull of complicated situations though, where the list of sub elements contains groups of
elements that have a different ContentMode
than the other elements.
For example:
PRM-CHAR (Sequence)
-> Element: COND
-> Group (Choice)
-> Group (Sequence)
-> Group (Choice)
-> Group (Sequence)
-> Element: ABS
-> Element: TOL
-> Group (Sequence)
-> Element: MIN
-> Element: TYP
-> Element: MAX
-> Element: PRM-UNIT
-> Element: TEXT
-> Element: REMARK
When searching for TOL in PRM-CHAR, the result should be Some(vec![1, 0, 0, 0, 1])!
Sourcepub fn find_common_group(
&self,
element_indices: &[usize],
element_indices2: &[usize],
) -> GroupType
pub fn find_common_group( &self, element_indices: &[usize], element_indices2: &[usize], ) -> GroupType
find the commmon group of two subelements of the current ElementType
The subelements are identified by their index lists, returned by find_sub_element
().
In simple cases without sub-groups of elements, the “common group” is simply the element group of the current ElementType
.
Sourcepub fn is_named_in_version(&self, version: AutosarVersion) -> bool
pub fn is_named_in_version(&self, version: AutosarVersion) -> bool
are elements of this elementType named in the given Autosar version
Named elements must have a SHORT-NAME sub element. For some elements this depends on the Autosar version.
One example of this is END-2-END-METHOD-PROTECTION-PROPS, which was first
defined in Autosar_00048
, but only has a name in Autosar_00050
.
Sourcepub const fn content_mode(&self) -> ContentMode
pub const fn content_mode(&self) -> ContentMode
get the content mode for this ElementType
Sourcepub const fn chardata_spec(&self) -> Option<&'static CharacterDataSpec>
pub const fn chardata_spec(&self) -> Option<&'static CharacterDataSpec>
get the character data spec for this ElementType
Sourcepub fn find_attribute_spec(
&self,
attrname: AttributeName,
) -> Option<AttributeSpec>
pub fn find_attribute_spec( &self, attrname: AttributeName, ) -> Option<AttributeSpec>
find the spec for a single attribute by name
Sourcepub const fn attribute_spec_iter(&self) -> AttrDefinitionsIter ⓘ
pub const fn attribute_spec_iter(&self) -> AttrDefinitionsIter ⓘ
create an iterator over all attribute definitions in the current ElementType
Sourcepub fn sub_element_spec_iter(&self) -> SubelemDefinitionsIter ⓘ
pub fn sub_element_spec_iter(&self) -> SubelemDefinitionsIter ⓘ
create an iterator over all sub elements of the current ElementType
Sourcepub const fn is_ordered(&self) -> bool
pub const fn is_ordered(&self) -> bool
Is this ElementType
ordered
It this is true, then the position of the sub elements of this element is semantically meaningful and they may not be sorted / re-ordered without changing the meaning of the file.
An example of this is ARGUMENTS in BSW-MODULE-ENTRY. ARGUMENTS is ordered, because each of its SW-SERVICE-ARG sub elements represents a function argument
Sourcepub const fn splittable(&self) -> u32
pub const fn splittable(&self) -> u32
Is this ElementType
splittable
This function returns a bitfield that indicates in which versions (if any) the ElementType
is marked as splittable.
A splittable element may be split across multiple arxml files
Sourcepub const fn splittable_in(&self, version: AutosarVersion) -> bool
pub const fn splittable_in(&self, version: AutosarVersion) -> bool
Is the current ElementType
splittable in the given version
A splittable element may be split across multiple arxml files
Sourcepub const fn std_restriction(&self) -> StdRestrict
pub const fn std_restriction(&self) -> StdRestrict
Is this ElementType
restricted to a particular edition of the Autosar standard
Returns an StdRestrict
enum, whose values are ClassicPlatform
, AdaptivePlatform
, NotRestricted
Sourcepub fn reference_dest_value(&self, other: &ElementType) -> Option<EnumItem>
pub fn reference_dest_value(&self, other: &ElementType) -> Option<EnumItem>
find the correct EnumItem
to use in the DEST attribute when referring from this element to the other element
Returns Some(enum_item)
if the reference is possible, and None otherwise.
Example:
When referring to a <CAN-TP-CONNECTION><IDENT><SHORT-NAME>foo...
the referrring <PHYSICAL-REQUEST-REF [...]>
must set DEST=“TP-CONNECTION-IDENT”
Sourcepub fn verify_reference_dest(&self, dest_value: EnumItem) -> bool
pub fn verify_reference_dest(&self, dest_value: EnumItem) -> bool
verify that the given dest_value
is a valid enum item that can be used to refer to this element type
Trait Implementations§
Source§impl Clone for ElementType
impl Clone for ElementType
Source§fn clone(&self) -> ElementType
fn clone(&self) -> ElementType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ElementType
custom implementation of Debug for ElementType - make the output more compact, since the long form is not very useful
impl Debug for ElementType
custom implementation of Debug for ElementType - make the output more compact, since the long form is not very useful