more clang and clang-tidy improvements
All checks were successful
fsfw/fsfw/pipeline/head This commit looks good
All checks were successful
fsfw/fsfw/pipeline/head This commit looks good
This commit is contained in:
parent
b904d33cfe
commit
5425360876
@ -55,7 +55,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
|||||||
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
|
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
|
||||||
|
|
||||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const override {
|
||||||
if (timeStamp != nullptr) {
|
if (timeStamp != nullptr) {
|
||||||
/* Endianness will always be MACHINE, so we can simply use memcpy
|
/* Endianness will always be MACHINE, so we can simply use memcpy
|
||||||
here. */
|
here. */
|
||||||
@ -70,7 +70,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
|||||||
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
virtual size_t getSerializedSize() const override {
|
||||||
if (updateData == nullptr) {
|
if (updateData == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#elif defined(PLATFORM_UNIX)
|
#elif defined(PLATFORM_UNIX)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
||||||
@ -29,7 +31,7 @@ TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
|
|||||||
: SystemObject(objectId),
|
: SystemObject(objectId),
|
||||||
tmtcBridgeId(tmtcTcpBridge),
|
tmtcBridgeId(tmtcTcpBridge),
|
||||||
receptionMode(receptionMode),
|
receptionMode(receptionMode),
|
||||||
tcpConfig(customTcpServerPort),
|
tcpConfig(std::move(customTcpServerPort)),
|
||||||
receptionBuffer(receptionBufferSize),
|
receptionBuffer(receptionBufferSize),
|
||||||
ringBuffer(ringBufferSize, true) {}
|
ringBuffer(ringBufferSize, true) {}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class TcpTmTcBridge;
|
class TcpTmTcBridge;
|
||||||
@ -44,7 +45,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
|
|||||||
|
|
||||||
struct TcpConfig {
|
struct TcpConfig {
|
||||||
public:
|
public:
|
||||||
TcpConfig(std::string tcpPort) : tcpPort(tcpPort) {}
|
TcpConfig(std::string tcpPort) : tcpPort(std::move(tcpPort)) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passed to the recv call
|
* Passed to the recv call
|
||||||
@ -84,7 +85,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
|
|||||||
size_t ringBufferSize = RING_BUFFER_SIZE,
|
size_t ringBufferSize = RING_BUFFER_SIZE,
|
||||||
std::string customTcpServerPort = DEFAULT_SERVER_PORT,
|
std::string customTcpServerPort = DEFAULT_SERVER_PORT,
|
||||||
ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS);
|
ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS);
|
||||||
virtual ~TcpTmTcServer();
|
~TcpTmTcServer() override;
|
||||||
|
|
||||||
void enableWiretapping(bool enable);
|
void enableWiretapping(bool enable);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
|
|||||||
* @brief Currently, the executed object's lifetime is not coupled with
|
* @brief Currently, the executed object's lifetime is not coupled with
|
||||||
* the task object's lifetime, so the destructor is empty.
|
* the task object's lifetime, so the destructor is empty.
|
||||||
*/
|
*/
|
||||||
virtual ~FixedTimeslotTask(void);
|
~FixedTimeslotTask() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The method to start the task.
|
* @brief The method to start the task.
|
||||||
@ -48,7 +48,7 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
|
|||||||
* The address of the task object is passed as an argument
|
* The address of the task object is passed as an argument
|
||||||
* to the system call.
|
* to the system call.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t startTask(void);
|
ReturnValue_t startTask() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add timeslot to the polling sequence table.
|
* Add timeslot to the polling sequence table.
|
||||||
@ -57,13 +57,14 @@ class FixedTimeslotTask : public FixedTimeslotTaskIF {
|
|||||||
* @param executionStep
|
* @param executionStep
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep);
|
ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||||
|
int8_t executionStep) override;
|
||||||
|
|
||||||
ReturnValue_t checkSequence() const override;
|
ReturnValue_t checkSequence() const override;
|
||||||
|
|
||||||
uint32_t getPeriodMs() const;
|
uint32_t getPeriodMs() const override;
|
||||||
|
|
||||||
ReturnValue_t sleepFor(uint32_t ms);
|
ReturnValue_t sleepFor(uint32_t ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using chron_ms = std::chrono::milliseconds;
|
using chron_ms = std::chrono::milliseconds;
|
||||||
|
@ -33,7 +33,7 @@ PeriodicTask::PeriodicTask(const char* name, TaskPriority setPriority, TaskStack
|
|||||||
tasks::insertTaskName(mainThread.get_id(), taskName);
|
tasks::insertTaskName(mainThread.get_id(), taskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTask::~PeriodicTask(void) {
|
PeriodicTask::~PeriodicTask() {
|
||||||
// Do not delete objects, we were responsible for ptrs only.
|
// Do not delete objects, we were responsible for ptrs only.
|
||||||
terminateThread = true;
|
terminateThread = true;
|
||||||
if (mainThread.joinable()) {
|
if (mainThread.joinable()) {
|
||||||
@ -42,7 +42,7 @@ PeriodicTask::~PeriodicTask(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PeriodicTask::taskEntryPoint(void* argument) {
|
void PeriodicTask::taskEntryPoint(void* argument) {
|
||||||
PeriodicTask* originalTask(reinterpret_cast<PeriodicTask*>(argument));
|
auto* originalTask(reinterpret_cast<PeriodicTask*>(argument));
|
||||||
|
|
||||||
if (not originalTask->started) {
|
if (not originalTask->started) {
|
||||||
// we have to suspend/block here until the task is started.
|
// we have to suspend/block here until the task is started.
|
||||||
@ -82,7 +82,6 @@ void PeriodicTask::taskFunctionality() {
|
|||||||
std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period * 1000));
|
std::chrono::milliseconds periodChrono(static_cast<uint32_t>(period * 1000));
|
||||||
auto currentStartTime{std::chrono::duration_cast<std::chrono::milliseconds>(
|
auto currentStartTime{std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::system_clock::now().time_since_epoch())};
|
std::chrono::system_clock::now().time_since_epoch())};
|
||||||
auto nextStartTime{currentStartTime};
|
|
||||||
|
|
||||||
/* Enter the loop that defines the task behavior. */
|
/* Enter the loop that defines the task behavior. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -101,7 +100,7 @@ void PeriodicTask::taskFunctionality() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
|
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
|
||||||
ExecutableObjectIF* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
|
auto* newObject = ObjectManager::instance()->get<ExecutableObjectIF>(object);
|
||||||
return addComponent(newObject);
|
return addComponent(newObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ ReturnValue_t PeriodicTask::addComponent(ExecutableObjectIF* object) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PeriodicTask::getPeriodMs() const { return period * 1000; }
|
uint32_t PeriodicTask::getPeriodMs() const { return static_cast<uint32_t>(period * 1000); }
|
||||||
|
|
||||||
bool PeriodicTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) {
|
bool PeriodicTask::delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval) {
|
||||||
bool shouldDelay = false;
|
bool shouldDelay = false;
|
||||||
|
@ -126,7 +126,7 @@ class PeriodicTask : public PeriodicTaskIF {
|
|||||||
*/
|
*/
|
||||||
void taskFunctionality(void);
|
void taskFunctionality(void);
|
||||||
|
|
||||||
bool delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval);
|
static bool delayForInterval(chron_ms* previousWakeTimeMs, const chron_ms interval);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PERIODICTASK_H_ */
|
#endif /* PERIODICTASK_H_ */
|
||||||
|
@ -69,7 +69,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t getSerializedSize() const {
|
size_t getSerializedSize() const override {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
size += SerializeAdapter::getSerializedSize(&packetId);
|
size += SerializeAdapter::getSerializedSize(&packetId);
|
||||||
size += sizeof(packetSequenceControl);
|
size += sizeof(packetSequenceControl);
|
||||||
|
@ -18,7 +18,7 @@ class PeriodicTaskIF {
|
|||||||
/**
|
/**
|
||||||
* @brief A virtual destructor as it is mandatory for interfaces.
|
* @brief A virtual destructor as it is mandatory for interfaces.
|
||||||
*/
|
*/
|
||||||
virtual ~PeriodicTaskIF() {}
|
virtual ~PeriodicTaskIF() = default;
|
||||||
/**
|
/**
|
||||||
* @brief With the startTask method, a created task can be started
|
* @brief With the startTask method, a created task can be started
|
||||||
* for the first time.
|
* for the first time.
|
||||||
@ -50,4 +50,4 @@ class PeriodicTaskIF {
|
|||||||
virtual uint32_t getPeriodMs() const = 0;
|
virtual uint32_t getPeriodMs() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PERIODICTASKIF_H_ */
|
#endif /* FRAMEWORK_TASK_PERIODICTASKIF_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user