Skip to content

Commit

Permalink
Removed a_ prefix on arguments (#2513)
Browse files Browse the repository at this point in the history
* Removed a_ prefix on arguments

* Removed pointer in the getter name

* Renamed getter
  • Loading branch information
JohanBertrand authored Feb 14, 2024
1 parent 4342da8 commit f18e540
Show file tree
Hide file tree
Showing 26 changed files with 333 additions and 248 deletions.
8 changes: 4 additions & 4 deletions Fw/FilePacket/CancelPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ namespace Fw {
void FilePacket::CancelPacket ::
initialize(const U32 sequenceIndex)
{
this->header.initialize(FilePacket::T_CANCEL, sequenceIndex);
this->m_header.initialize(FilePacket::T_CANCEL, sequenceIndex);
}

U32 FilePacket::CancelPacket ::
bufferSize() const
{
return this->header.bufferSize();
return this->m_header.bufferSize();
}

SerializeStatus FilePacket::CancelPacket ::
Expand All @@ -34,14 +34,14 @@ namespace Fw {
buffer.getData(),
buffer.getSize()
);
return this->header.toSerialBuffer(serialBuffer);
return this->m_header.toSerialBuffer(serialBuffer);
}

SerializeStatus FilePacket::CancelPacket ::
fromSerialBuffer(SerialBuffer& serialBuffer)
{

FW_ASSERT(this->header.type == T_CANCEL);
FW_ASSERT(this->m_header.m_type == T_CANCEL);

if (serialBuffer.getBuffLeft() != 0)
return FW_DESERIALIZE_SIZE_MISMATCH;
Expand Down
48 changes: 24 additions & 24 deletions Fw/FilePacket/DataPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ namespace Fw {
void FilePacket::DataPacket ::
initialize(
const U32 sequenceIndex,
const U32 a_byteOffset,
const U16 a_dataSize,
const U8 *const a_data
const U32 byteOffset,
const U16 dataSize,
const U8 *const data
)
{
this->header.initialize(FilePacket::T_DATA, sequenceIndex);
this->byteOffset = a_byteOffset;
this->dataSize = a_dataSize;
this->data = a_data;
this->m_header.initialize(FilePacket::T_DATA, sequenceIndex);
this->m_byteOffset = byteOffset;
this->m_dataSize = dataSize;
this->m_data = data;
}

U32 FilePacket::DataPacket ::
bufferSize() const
{
return
this->header.bufferSize() +
sizeof(this->byteOffset) +
sizeof(this->dataSize) +
this->dataSize;
this->m_header.bufferSize() +
sizeof(this->m_byteOffset) +
sizeof(this->m_dataSize) +
this->m_dataSize;
}

SerializeStatus FilePacket::DataPacket ::
Expand All @@ -53,21 +53,21 @@ namespace Fw {
fromSerialBuffer(SerialBuffer& serialBuffer)
{

FW_ASSERT(this->header.type == T_DATA);
FW_ASSERT(this->m_header.m_type == T_DATA);

SerializeStatus status = serialBuffer.deserialize(this->byteOffset);
SerializeStatus status = serialBuffer.deserialize(this->m_byteOffset);
if (status != FW_SERIALIZE_OK)
return status;

status = serialBuffer.deserialize(this->dataSize);
status = serialBuffer.deserialize(this->m_dataSize);
if (status != FW_SERIALIZE_OK)
return status;

if (serialBuffer.getBuffLeft() != this->dataSize)
if (serialBuffer.getBuffLeft() != this->m_dataSize)
return FW_DESERIALIZE_SIZE_MISMATCH;

U8 *const addr = serialBuffer.getBuffAddr();
this->data = &addr[this->fixedLengthSize()];
this->m_data = &addr[this->fixedLengthSize()];

return FW_SERIALIZE_OK;

Expand All @@ -77,32 +77,32 @@ namespace Fw {
fixedLengthSize() const
{
return
this->header.bufferSize() +
sizeof(this->byteOffset) +
sizeof(this->dataSize);
this->m_header.bufferSize() +
sizeof(this->m_byteOffset) +
sizeof(this->m_dataSize);
}

SerializeStatus FilePacket::DataPacket ::
toSerialBuffer(SerialBuffer& serialBuffer) const
{

FW_ASSERT(this->header.type == T_DATA);
FW_ASSERT(this->m_header.m_type == T_DATA);

SerializeStatus status;

status = this->header.toSerialBuffer(serialBuffer);
status = this->m_header.toSerialBuffer(serialBuffer);
if (status != FW_SERIALIZE_OK)
return status;

status = serialBuffer.serialize(this->byteOffset);
status = serialBuffer.serialize(this->m_byteOffset);
if (status != FW_SERIALIZE_OK)
return status;

status = serialBuffer.serialize(this->dataSize);
status = serialBuffer.serialize(this->m_dataSize);
if (status != FW_SERIALIZE_OK)
return status;

status = serialBuffer.pushBytes(this->data, dataSize);
status = serialBuffer.pushBytes(this->m_data, this->m_dataSize);

return status;

Expand Down
10 changes: 5 additions & 5 deletions Fw/FilePacket/EndPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ namespace Fw {
const CFDP::Checksum& checksum
)
{
this->header.initialize(FilePacket::T_END, sequenceIndex);
this->m_header.initialize(FilePacket::T_END, sequenceIndex);
this->setChecksum(checksum);
}

U32 FilePacket::EndPacket ::
bufferSize() const
{
return this->header.bufferSize() + sizeof(this->m_checksumValue);
return this->m_header.bufferSize() + sizeof(this->m_checksumValue);
}

SerializeStatus FilePacket::EndPacket ::
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace Fw {
fromSerialBuffer(SerialBuffer& serialBuffer)
{

FW_ASSERT(this->header.type == T_END);
FW_ASSERT(this->m_header.m_type == T_END);

const SerializeStatus status =
serialBuffer.deserialize(this->m_checksumValue);
Expand All @@ -74,11 +74,11 @@ namespace Fw {
toSerialBuffer(SerialBuffer& serialBuffer) const
{

FW_ASSERT(this->header.type == T_END);
FW_ASSERT(this->m_header.m_type == T_END);

SerializeStatus status;

status = this->header.toSerialBuffer(serialBuffer);
status = this->m_header.toSerialBuffer(serialBuffer);
if (status != FW_SERIALIZE_OK)
return status;

Expand Down
22 changes: 11 additions & 11 deletions Fw/FilePacket/FilePacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,63 +40,63 @@ namespace Fw {
const FilePacket::StartPacket& FilePacket ::
asStartPacket() const
{
FW_ASSERT(this->m_header.type == T_START);
FW_ASSERT(this->m_header.m_type == T_START);
return this->m_startPacket;
}

const FilePacket::DataPacket& FilePacket ::
asDataPacket() const
{
FW_ASSERT(this->m_header.type == T_DATA);
FW_ASSERT(this->m_header.m_type == T_DATA);
return this->m_dataPacket;
}

const FilePacket::EndPacket& FilePacket ::
asEndPacket() const
{
FW_ASSERT(this->m_header.type == T_END);
FW_ASSERT(this->m_header.m_type == T_END);
return this->m_endPacket;
}

const FilePacket::CancelPacket& FilePacket ::
asCancelPacket() const
{
FW_ASSERT(this->m_header.type == T_CANCEL);
FW_ASSERT(this->m_header.m_type == T_CANCEL);
return this->m_cancelPacket;
}

void FilePacket ::
fromStartPacket(const StartPacket& startPacket)
{
this->m_startPacket = startPacket;
this->m_header.type = T_START;
this->m_header.m_type = T_START;
}

void FilePacket ::
fromDataPacket(const DataPacket& dataPacket)
{
this->m_dataPacket = dataPacket;
this->m_header.type = T_DATA;
this->m_header.m_type = T_DATA;
}

void FilePacket ::
fromEndPacket(const EndPacket& endPacket)
{
this->m_endPacket = endPacket;
this->m_header.type = T_END;
this->m_header.m_type = T_END;
}

void FilePacket ::
fromCancelPacket(const CancelPacket& cancelPacket)
{
this->m_cancelPacket = cancelPacket;
this->m_header.type = T_CANCEL;
this->m_header.m_type = T_CANCEL;
}

U32 FilePacket ::
bufferSize() const
{
switch (this->m_header.type) {
switch (this->m_header.m_type) {
case T_START:
return this->m_startPacket.bufferSize();
case T_DATA:
Expand All @@ -116,7 +116,7 @@ namespace Fw {
SerializeStatus FilePacket ::
toBuffer(Buffer& buffer) const
{
switch (this->m_header.type) {
switch (this->m_header.m_type) {
case T_START:
return this->m_startPacket.toBuffer(buffer);
case T_DATA:
Expand All @@ -142,7 +142,7 @@ namespace Fw {
status = this->m_header.fromSerialBuffer(serialBuffer);
if (status != FW_SERIALIZE_OK)
return status;
switch (this->m_header.type) {
switch (this->m_header.m_type) {
case T_START:
status = this->m_startPacket.fromSerialBuffer(serialBuffer);
break;
Expand Down
Loading

0 comments on commit f18e540

Please sign in to comment.