Skip to content

Commit 324678d

Browse files
bocchinothomas-bc
andcommitted
Allow FPP arrays of arbitrary size (nasa#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 <[email protected]>
1 parent 3d7ab57 commit 324678d

File tree

4 files changed

+54
-54
lines changed

4 files changed

+54
-54
lines changed

FppTestProject/FppTest/array/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ void FppTest::Array::setTestVals<AliasOfArray>(EA (&a)[AliasOfArray::SIZE]) {
118118
// Specializations for multi element constructor
119119
template <>
120120
Enum FppTest::Array::getMultiElementConstructedArray<Enum>(E (&a)[Enum::SIZE]) {
121-
return Enum(a[0], a[1], a[2]);
121+
return Enum({a[0], a[1], a[2]});
122122
}
123123

124124
template <>
125125
::String FppTest::Array::getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) {
126-
return ::String(a[0], a[1], a[2]);
126+
return ::String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])});
127127
}
128128

129129
template <>
130130
Struct FppTest::Array::getMultiElementConstructedArray<Struct>(S (&a)[Struct::SIZE]) {
131-
return Struct(a[0], a[1], a[2]);
131+
return Struct({a[0], a[1], a[2]});
132132
}
133133

134134
template <>
135135
Uint32Array FppTest::Array::getMultiElementConstructedArray<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
136-
return Uint32Array(a[0], a[1], a[2]);
136+
return Uint32Array({a[0], a[1], a[2]});
137137
}
138138

139139
// Specializations for serialized size

Ref/DpDemo/DpDemo.cpp

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace Ref {
3131
this->dpContainer.serializeRecord_BooleanRecord(true);
3232
this->dpContainer.serializeRecord_I32Record(-100);
3333
this->dpContainer.serializeRecord_F64Record(1.25);
34-
this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array(1, 2, 3, 4, 5));
35-
this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array(1.1f, 2.2f, 3.3f));
36-
this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray(true, false));
34+
this->dpContainer.serializeRecord_U32ArrayRecord(DpDemo_U32Array({1, 2, 3, 4, 5}));
35+
this->dpContainer.serializeRecord_F32ArrayRecord(DpDemo_F32Array({1.1f, 2.2f, 3.3f}));
36+
this->dpContainer.serializeRecord_BooleanArrayRecord(DpDemo_BooleanArray({true, false}));
3737
// Array Records
3838
// Array record of strings
3939
Fw::String str0("String array element 0");
@@ -42,112 +42,112 @@ namespace Ref {
4242
const Fw::StringBase* strings[3] = { &str0, &str1, &str2 };
4343
this->dpContainer.serializeRecord_StringArrayRecord(strings, 3);
4444
// Array record of arrays
45-
const DpDemo_StringArray arrayArray[1] = {
46-
DpDemo_StringArray(
45+
const DpDemo_StringArray arrayArray[1] = {
46+
DpDemo_StringArray({
4747
Fw::String("0 - String array record element 0"),
4848
Fw::String("0 - String array record element 1")
49-
)
49+
})
5050
};
5151
this->dpContainer.serializeRecord_ArrayArrayRecord(arrayArray, 1);
5252
// Array record of structs
53-
const DpDemo_StructWithStringMembers structArray[2] = {
53+
const DpDemo_StructWithStringMembers structArray[2] = {
5454
DpDemo_StructWithStringMembers(
5555
Fw::String("0 - String member"),
56-
DpDemo_StringArray(
56+
DpDemo_StringArray({
5757
Fw::String("0 - String array element 0"),
5858
Fw::String("0 - String array element 1")
59-
)
59+
})
6060
),
6161
DpDemo_StructWithStringMembers(
6262
Fw::String("1 - String member"),
63-
DpDemo_StringArray(
63+
DpDemo_StringArray({
6464
Fw::String("1 - String array element 0"),
6565
Fw::String("1 - String array element 1")
66-
)
66+
})
6767
)
6868
};
6969
this->dpContainer.serializeRecord_StructArrayRecord(structArray, 2);
7070
this->dpContainer.serializeRecord_ArrayOfStringArrayRecord(
71-
DpDemo_ArrayOfStringArray(
72-
DpDemo_StringArray(
71+
DpDemo_ArrayOfStringArray({
72+
DpDemo_StringArray({
7373
Fw::String("0 - String array element 0"),
7474
Fw::String("0 - String array element 1")
75-
),
76-
DpDemo_StringArray(
75+
}),
76+
DpDemo_StringArray({
7777
Fw::String("1 - String array element 0"),
7878
Fw::String("1 - String array element 1")
79-
),
80-
DpDemo_StringArray(
79+
}),
80+
DpDemo_StringArray({
8181
Fw::String("2 - String array element 0"),
8282
Fw::String("2 - String array element 1")
83-
)
84-
)
83+
})
84+
})
8585
);
8686
this->dpContainer.serializeRecord_ArrayOfStructsRecord(
87-
DpDemo_ArrayOfStructs(
87+
DpDemo_ArrayOfStructs({
8888
DpDemo_StructWithStringMembers(
8989
Fw::String("0 - String member"),
90-
DpDemo_StringArray(
90+
DpDemo_StringArray({
9191
Fw::String("0 - String array element 0"),
9292
Fw::String("0 - String array element 1")
93-
)
93+
})
9494
),
9595
DpDemo_StructWithStringMembers(
9696
Fw::String("1 - String member"),
97-
DpDemo_StringArray(
97+
DpDemo_StringArray({
9898
Fw::String("1 - String array element 0"),
9999
Fw::String("1 - String array element 1")
100-
)
100+
})
101101
),
102102
DpDemo_StructWithStringMembers(
103103
Fw::String("2 - String member"),
104-
DpDemo_StringArray(
104+
DpDemo_StringArray({
105105
Fw::String("2 - String array element 0"),
106106
Fw::String("2 - String array element 1")
107-
)
107+
})
108108
)
109-
)
109+
})
110110
);
111-
this->dpContainer.serializeRecord_EnumArrayRecord(DpDemo_EnumArray(DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE));
111+
this->dpContainer.serializeRecord_EnumArrayRecord(DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}));
112112
this->dpContainer.serializeRecord_StructWithEverythingRecord(DpDemo_StructWithEverything(
113113
-1,
114114
2.5,
115115
Fw::String("String Member"),
116116
false,
117117
this->selectedColor,
118-
{
119-
DpDemo_U32Array(1, 2, 3, 4, 5),
120-
DpDemo_U32Array(6, 7, 8, 9, 10)
118+
{
119+
DpDemo_U32Array({1, 2, 3, 4, 5}),
120+
DpDemo_U32Array({6, 7, 8, 9, 10})
121121
},
122-
DpDemo_F32Array(4.4f, 5.5f, 6.6f),
123-
DpDemo_U32Array(6, 7, 8, 9, 10),
124-
DpDemo_EnumArray(DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE),
125-
DpDemo_StringArray(
122+
DpDemo_F32Array({4.4f, 5.5f, 6.6f}),
123+
DpDemo_U32Array({6, 7, 8, 9, 10}),
124+
DpDemo_EnumArray({DpDemo_ColorEnum::RED, DpDemo_ColorEnum::GREEN, DpDemo_ColorEnum::BLUE}),
125+
DpDemo_StringArray({
126126
Fw::String("String array element 0"),
127127
Fw::String("String array element 1")
128-
),
129-
DpDemo_BooleanArray(true, false),
128+
}),
129+
DpDemo_BooleanArray({true, false}),
130130
DpDemo_StructWithStringMembers(
131131
Fw::String("String member"),
132-
DpDemo_StringArray(
132+
DpDemo_StringArray({
133133
Fw::String("String array element 0"),
134134
Fw::String("String array element 1")
135-
)
135+
})
136136
),
137-
DpDemo_ArrayOfStringArray(
138-
DpDemo_StringArray(
137+
DpDemo_ArrayOfStringArray({
138+
DpDemo_StringArray({
139139
Fw::String("0 - String array element 0"),
140140
Fw::String("0 - String array element 1")
141-
),
142-
DpDemo_StringArray(
141+
}),
142+
DpDemo_StringArray({
143143
Fw::String("1 - String array element 0"),
144144
Fw::String("1 - String array element 1")
145-
),
146-
DpDemo_StringArray(
145+
}),
146+
DpDemo_StringArray({
147147
Fw::String("2 - String array element 0"),
148148
Fw::String("2 - String array element 1")
149-
)
150-
)
149+
})
150+
})
151151
));
152152
this->log_ACTIVITY_LO_DpComplete(this->numRecords);
153153
this->cleanupAndSendDp();
@@ -183,7 +183,7 @@ namespace Ref {
183183
DpDemo_BooleanArray::SERIALIZED_SIZE +
184184
DpDemo_EnumArray::SERIALIZED_SIZE +
185185
DpDemo_StringArray::SERIALIZED_SIZE +
186-
DpDemo_StructWithEverything::SERIALIZED_SIZE +
186+
DpDemo_StructWithEverything::SERIALIZED_SIZE +
187187
DpDemo_StructWithStringMembers::SERIALIZED_SIZE +
188188
(DpDemo_StringArray::SERIALIZED_SIZE * 3) +
189189
(DpDemo_StringArray::SERIALIZED_SIZE * 1) +

Ref/TypeDemo/TypeDemo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void TypeDemo ::DUMP_TYPED_PARAMETERS_cmdHandler(const FwOpcodeType opCode, cons
107107
Ref::ManyChoices choices = this->paramGet_CHOICES_PRM(validity);
108108
this->log_ACTIVITY_HI_ChoicesPrmEv(choices, validity);
109109

110-
Ref::TooManyChoices tooManyChoices = this->paramGet_EXTRA_CHOICES_PRM(validity);
110+
Ref::TooManyChoices tooManyChoices = Ref::TooManyChoices(this->paramGet_EXTRA_CHOICES_PRM(validity));
111111
this->log_ACTIVITY_HI_ExtraChoicesPrmEv(tooManyChoices, validity);
112112

113113
Ref::ChoicePair choicePair = this->paramGet_CHOICE_PAIR_PRM(validity);

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Flask-Compress==1.15
2020
Flask-RESTful==0.3.10
2121
fprime-fpl-layout==1.0.3
2222
fprime-fpl-write-pic==1.0.3
23-
fprime-fpp==3.0.0
23+
fprime-fpp==3.0.1a1
2424
fprime-gds==4.0.2a3
2525
fprime-tools==4.0.1
2626
fprime-visual==1.0.2

0 commit comments

Comments
 (0)