Skip to content

Commit

Permalink
Merge pull request #386 from fprime-community/dp-container-members
Browse files Browse the repository at this point in the history
Revise code gen for DpContainer
  • Loading branch information
bocchino authored Jan 27, 2024
2 parents ccdf416 + 152a21f commit 81e93b7
Show file tree
Hide file tree
Showing 17 changed files with 421 additions and 390 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ case class ComponentDataProducts (
| sizeof(FwDpIdType) +
| $typeSize;
|Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
|if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
|if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
| const FwDpIdType id = this->baseId + RecordId::$name;
| status = this->dataBuffer.serialize(id);
| status = this->m_dataBuffer.serialize(id);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| status = this->dataBuffer.serialize(elt);
| status = this->m_dataBuffer.serialize(elt);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| this->dataSize += sizeDelta;
| this->m_dataSize += sizeDelta;
|}
|else {
| status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down Expand Up @@ -425,11 +425,11 @@ case class ComponentDataProducts (
// Optimize the U8 case
case Type.U8 =>
"""| const bool omitSerializedLength = true;
| status = this->dataBuffer.serialize(array, size, omitSerializedLength);
| status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);"""
case _ =>
"""| for (FwSizeType i = 0; i < size; i++) {
| status = this->dataBuffer.serialize(array[i]);
| status = this->m_dataBuffer.serialize(array[i]);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| }"""
}).stripMargin
Expand All @@ -440,14 +440,14 @@ case class ComponentDataProducts (
| sizeof(FwSizeType) +
| size * $eltSize;
|Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
|if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
|if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
| const FwDpIdType id = this->baseId + RecordId::$name;
| status = this->dataBuffer.serialize(id);
| status = this->m_dataBuffer.serialize(id);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
| status = this->dataBuffer.serialize(size);
| status = this->m_dataBuffer.serialize(size);
| FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
|$serializeElts
| this->dataSize += sizeDelta;
| this->m_dataSize += sizeDelta;
|}
|else {
| status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * ActiveAsyncProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -130,13 +130,13 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
ActiveAsyncProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -156,17 +156,17 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -181,13 +181,13 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32Record;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -207,16 +207,16 @@ Fw::SerializeStatus ActiveAsyncProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U8);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
const bool omitSerializedLength = true;
status = this->dataBuffer.serialize(array, size, omitSerializedLength);
status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * ActiveGetProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -128,13 +128,13 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
ActiveGetProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -154,17 +154,17 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -179,13 +179,13 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32Record;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -205,16 +205,16 @@ Fw::SerializeStatus ActiveGetProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U8);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
const bool omitSerializedLength = true;
status = this->dataBuffer.serialize(array, size, omitSerializedLength);
status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * ActiveGuardedProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -128,13 +128,13 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
ActiveGuardedProducts_Data::SERIALIZED_SIZE;
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::DataRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -154,17 +154,17 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
for (FwSizeType i = 0; i < size; i++) {
status = this->dataBuffer.serialize(array[i]);
status = this->m_dataBuffer.serialize(array[i]);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
}
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -179,13 +179,13 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer ::
sizeof(FwDpIdType) +
sizeof(U32);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U32Record;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(elt);
status = this->m_dataBuffer.serialize(elt);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand All @@ -205,16 +205,16 @@ Fw::SerializeStatus ActiveGuardedProductsComponentBase::DpContainer ::
sizeof(FwSizeType) +
size * sizeof(U8);
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK;
if (this->dataBuffer.getBuffLength() + sizeDelta <= this->dataBuffer.getBuffCapacity()) {
if (this->m_dataBuffer.getBuffLength() + sizeDelta <= this->m_dataBuffer.getBuffCapacity()) {
const FwDpIdType id = this->baseId + RecordId::U8ArrayRecord;
status = this->dataBuffer.serialize(id);
status = this->m_dataBuffer.serialize(id);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
status = this->dataBuffer.serialize(size);
status = this->m_dataBuffer.serialize(size);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
const bool omitSerializedLength = true;
status = this->dataBuffer.serialize(array, size, omitSerializedLength);
status = this->m_dataBuffer.serialize(array, size, omitSerializedLength);
FW_ASSERT(status == Fw::FW_SERIALIZE_OK, status);
this->dataSize += sizeDelta;
this->m_dataSize += sizeDelta;
}
else {
status = Fw::FW_SERIALIZE_NO_ROOM_LEFT;
Expand Down
Loading

0 comments on commit 81e93b7

Please sign in to comment.