Skip to content

Commit

Permalink
Add support to GDS for struct member array (#161)
Browse files Browse the repository at this point in the history
* Add support to GDS for struct member array

* Fix name to support multiple array per struct
  • Loading branch information
SMorettini committed Feb 14, 2024
1 parent 42660b3 commit a46f835
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/fprime_gds/common/loaders/xml_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class XmlLoader(dict_loader.DictLoader):
SER_MEMB_FMT_STR_TAG = "format_specifier"
SER_MEMB_DESC_TAG = "description"
SER_MEMB_TYPE_TAG = "type"
SER_MEMB_SIZE_TAG = "size"

# Xml section names and tags for array types
ARR_SECT = "arrays"
Expand Down Expand Up @@ -256,7 +257,15 @@ def get_serializable_type(self, type_name, xml_obj):
fmt_str = memb.get(self.SER_MEMB_FMT_STR_TAG)
desc = memb.get(self.SER_MEMB_DESC_TAG)
memb_type_name = memb.get(self.SER_MEMB_TYPE_TAG)
memb_size = memb.get(self.SER_MEMB_SIZE_TAG)
type_obj = self.parse_type(memb_type_name, memb, xml_obj)
# memb_size is not None for member array
if(memb_size is not None):
type_obj = ArrayType.construct_type(
f"Array_{type_obj.__name__}_{memb_size}",
type_obj,
int(memb_size),
fmt_str)

members.append((name, type_obj, fmt_str, desc))

Expand Down

0 comments on commit a46f835

Please sign in to comment.