Skip to content

Commit

Permalink
Get the makeFppArray binary to work
Browse files Browse the repository at this point in the history
  • Loading branch information
watney committed May 14, 2024
1 parent b7f9389 commit 10ed427
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/fprime_gds/executables/data_product_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,19 @@ def kind_qualifiedIdentifier(cls, v):
raise ValueError('Check the "kind" field')
return v

class StructMember(BaseModel):
type: Union[IntegerType, FloatType, BoolType, QualifiedType]
size: int = 1

class StructType(BaseModel):
kind: str
qualifiedName: str
members: Dict[str, Type]
members: Dict[str, StructMember]

# class StructType(BaseModel):
# kind: str
# qualifiedName: str
# members: Dict[str, Type]

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

@field_validator('kind')
def kind_qualifiedIdentifier(cls, v):
Expand Down Expand Up @@ -427,10 +436,13 @@ def get_struct_item(field_name: str, typeKind: TypeKind, typeList: List[TypeDef]
parent_dict[field_name] = array_list

elif isinstance(typeKind, StructType):
struct_dict = {}
array_list = []
for key, member in typeKind.members.items():
get_struct_item(key, member.type, typeList, struct_dict)
parent_dict[field_name] = struct_dict
for i in range(member.size):
element_dict = {}
get_struct_item(key, member.type, typeList, element_dict)
array_list.append(element_dict[key])
parent_dict[field_name] = array_list

elif isinstance(typeKind, QualifiedType):
qualType = get_struct_type(typeList, typeKind.name)
Expand Down

0 comments on commit 10ed427

Please sign in to comment.