mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
Allow FPP arrays of arbitrary size (#4073)
* Revise array tests Update constructor calls to conform to new code gen Format the code * Reformat FppTest * Revise requirements.txt * Update requirements.txt * Update fpp version * Revise Ref to conform to FPP changes * Remove trailing spaces --------- Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
This commit is contained in:
parent
287a0211eb
commit
9ec8c559de
@ -118,22 +118,22 @@ void FppTest::Array::setTestVals<AliasOfArray>(EA (&a)[AliasOfArray::SIZE]) {
|
||||
// Specializations for multi element constructor
|
||||
template <>
|
||||
Enum FppTest::Array::getMultiElementConstructedArray<Enum>(E (&a)[Enum::SIZE]) {
|
||||
return Enum(a[0], a[1], a[2]);
|
||||
return Enum({a[0], a[1], a[2]});
|
||||
}
|
||||
|
||||
template <>
|
||||
::String FppTest::Array::getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) {
|
||||
return ::String(a[0], a[1], a[2]);
|
||||
return ::String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])});
|
||||
}
|
||||
|
||||
template <>
|
||||
Struct FppTest::Array::getMultiElementConstructedArray<Struct>(S (&a)[Struct::SIZE]) {
|
||||
return Struct(a[0], a[1], a[2]);
|
||||
return Struct({a[0], a[1], a[2]});
|
||||
}
|
||||
|
||||
template <>
|
||||
Uint32Array FppTest::Array::getMultiElementConstructedArray<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
|
||||
return Uint32Array(a[0], a[1], a[2]);
|
||||
return Uint32Array({a[0], a[1], a[2]});
|
||||
}
|
||||
|
||||
// Specializations for serialized size
|
||||
|
||||
@ -31,9 +31,9 @@ namespace Ref {
|
||||
this->dpContainer.serializeRecord_BooleanRecord(true);
|
||||
this->dpContainer.serializeRecord_I32Record(-100);
|
||||
this->dpContainer.serializeRecord_F64Record(1.25);
|
||||
this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array(1, 2, 3, 4, 5));
|
||||
this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array(1.1f, 2.2f, 3.3f));
|
||||
this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray(true, false));
|
||||
this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array({1, 2, 3, 4, 5}));
|
||||
this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array({1.1f, 2.2f, 3.3f}));
|
||||
this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray({true, false}));
|
||||
// Array Records
|
||||
// Array record of strings
|
||||
Fw::String str0("String array element 0");
|
||||
@ -43,72 +43,72 @@ namespace Ref {
|
||||
this->dpContainer.serializeRecord_StringArrayRecord(strings, 3);
|
||||
// Array record of arrays
|
||||
const DpDemo_StringArray arrayArray[1] = {
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("0 - String array record element 0"),
|
||||
Fw::String("0 - String array record element 1")
|
||||
)
|
||||
})
|
||||
};
|
||||
this->dpContainer.serializeRecord_ArrayArrayRecord(arrayArray, 1);
|
||||
// Array record of structs
|
||||
const DpDemo_StructWithStringMembers structArray[2] = {
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("0 - String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("0 - String array element 0"),
|
||||
Fw::String("0 - String array element 1")
|
||||
)
|
||||
})
|
||||
),
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("1 - String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("1 - String array element 0"),
|
||||
Fw::String("1 - String array element 1")
|
||||
)
|
||||
})
|
||||
)
|
||||
};
|
||||
this->dpContainer.serializeRecord_StructArrayRecord(structArray, 2);
|
||||
this->dpContainer.serializeRecord_ArrayOfStringArrayRecord(
|
||||
DpDemo_ArrayOfStringArray(
|
||||
DpDemo_StringArray(
|
||||
DpDemo_ArrayOfStringArray({
|
||||
DpDemo_StringArray({
|
||||
Fw::String("0 - String array element 0"),
|
||||
Fw::String("0 - String array element 1")
|
||||
),
|
||||
DpDemo_StringArray(
|
||||
}),
|
||||
DpDemo_StringArray({
|
||||
Fw::String("1 - String array element 0"),
|
||||
Fw::String("1 - String array element 1")
|
||||
),
|
||||
DpDemo_StringArray(
|
||||
}),
|
||||
DpDemo_StringArray({
|
||||
Fw::String("2 - String array element 0"),
|
||||
Fw::String("2 - String array element 1")
|
||||
)
|
||||
)
|
||||
})
|
||||
})
|
||||
);
|
||||
this->dpContainer.serializeRecord_ArrayOfStructsRecord(
|
||||
DpDemo_ArrayOfStructs(
|
||||
DpDemo_ArrayOfStructs({
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("0 - String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("0 - String array element 0"),
|
||||
Fw::String("0 - String array element 1")
|
||||
)
|
||||
})
|
||||
),
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("1 - String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("1 - String array element 0"),
|
||||
Fw::String("1 - String array element 1")
|
||||
)
|
||||
})
|
||||
),
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("2 - String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("2 - String array element 0"),
|
||||
Fw::String("2 - String array element 1")
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
})
|
||||
);
|
||||
this->dpContainer.serializeRecord_EnumArrayRecord(DpDemo_EnumArray(DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE));
|
||||
this->dpContainer.serializeRecord_EnumArrayRecord(DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}));
|
||||
this->dpContainer.serializeRecord_StructWithEverythingRecord(DpDemo_StructWithEverything(
|
||||
-1,
|
||||
2.5,
|
||||
@ -116,38 +116,38 @@ namespace Ref {
|
||||
false,
|
||||
this->selectedColor,
|
||||
{
|
||||
DpDemo_U32Array(1, 2, 3, 4, 5),
|
||||
DpDemo_U32Array(6, 7, 8, 9, 10)
|
||||
DpDemo_U32Array({1, 2, 3, 4, 5}),
|
||||
DpDemo_U32Array({6, 7, 8, 9, 10})
|
||||
},
|
||||
DpDemo_F32Array(4.4f, 5.5f, 6.6f),
|
||||
DpDemo_U32Array(6, 7, 8, 9, 10),
|
||||
DpDemo_EnumArray(DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_F32Array({4.4f, 5.5f, 6.6f}),
|
||||
DpDemo_U32Array({6, 7, 8, 9, 10}),
|
||||
DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}),
|
||||
DpDemo_StringArray({
|
||||
Fw::String("String array element 0"),
|
||||
Fw::String("String array element 1")
|
||||
),
|
||||
DpDemo_BooleanArray(true, false),
|
||||
}),
|
||||
DpDemo_BooleanArray({true, false}),
|
||||
DpDemo_StructWithStringMembers(
|
||||
Fw::String("String member"),
|
||||
DpDemo_StringArray(
|
||||
DpDemo_StringArray({
|
||||
Fw::String("String array element 0"),
|
||||
Fw::String("String array element 1")
|
||||
)
|
||||
})
|
||||
),
|
||||
DpDemo_ArrayOfStringArray(
|
||||
DpDemo_StringArray(
|
||||
DpDemo_ArrayOfStringArray({
|
||||
DpDemo_StringArray({
|
||||
Fw::String("0 - String array element 0"),
|
||||
Fw::String("0 - String array element 1")
|
||||
),
|
||||
DpDemo_StringArray(
|
||||
}),
|
||||
DpDemo_StringArray({
|
||||
Fw::String("1 - String array element 0"),
|
||||
Fw::String("1 - String array element 1")
|
||||
),
|
||||
DpDemo_StringArray(
|
||||
}),
|
||||
DpDemo_StringArray({
|
||||
Fw::String("2 - String array element 0"),
|
||||
Fw::String("2 - String array element 1")
|
||||
)
|
||||
)
|
||||
})
|
||||
})
|
||||
));
|
||||
this->log_ACTIVITY_LO_DpComplete(this->numRecords);
|
||||
this->cleanupAndSendDp();
|
||||
|
||||
@ -107,7 +107,7 @@ void TypeDemo ::DUMP_TYPED_PARAMETERS_cmdHandler(const FwOpcodeType opCode, cons
|
||||
Ref::ManyChoices choices = this->paramGet_CHOICES_PRM(validity);
|
||||
this->log_ACTIVITY_HI_ChoicesPrmEv(choices, validity);
|
||||
|
||||
Ref::TooManyChoices tooManyChoices = this->paramGet_EXTRA_CHOICES_PRM(validity);
|
||||
Ref::TooManyChoices tooManyChoices = Ref::TooManyChoices(this->paramGet_EXTRA_CHOICES_PRM(validity));
|
||||
this->log_ACTIVITY_HI_ExtraChoicesPrmEv(tooManyChoices, validity);
|
||||
|
||||
Ref::ChoicePair choicePair = this->paramGet_CHOICE_PAIR_PRM(validity);
|
||||
|
||||
@ -20,7 +20,7 @@ Flask-Compress==1.15
|
||||
Flask-RESTful==0.3.10
|
||||
fprime-fpl-layout==1.0.3
|
||||
fprime-fpl-write-pic==1.0.3
|
||||
fprime-fpp==3.0.0
|
||||
fprime-fpp==3.0.1a1
|
||||
fprime-gds==4.0.2a3
|
||||
fprime-tools==4.0.1
|
||||
fprime-visual==1.0.2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user