run auto-formatter

This commit is contained in:
2022-07-29 15:54:17 +02:00
parent c7b4dc349a
commit f4beef8c9f
5 changed files with 58 additions and 80 deletions

View File

@ -4,7 +4,7 @@
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
class CcsdsUnpacker: public ExecutableObjectIF, public AcceptsTelecommandsIF {
class CcsdsUnpacker : public ExecutableObjectIF, public AcceptsTelecommandsIF {
public:
CcsdsUnpacker();
ReturnValue_t performOperation(uint8_t operationCode) override;

View File

@ -1,57 +1,38 @@
#ifndef FSFW_UTIL_OBJECTID_H
#define FSFW_UTIL_OBJECTID_H
#include "fsfw/objectmanager.h"
#include "UnsignedByteField.h"
#include <functional>
class ObjectId: public UnsignedByteField<object_id_t> {
#include "UnsignedByteField.h"
#include "fsfw/objectmanager.h"
class ObjectId : public UnsignedByteField<object_id_t> {
public:
ObjectId(object_id_t id, const char* name): UnsignedByteField<object_id_t>(id), name_(name) {}
ObjectId(object_id_t id, const char* name) : UnsignedByteField<object_id_t>(id), name_(name) {}
[[nodiscard]] const char* name() const {
return name_;
}
[[nodiscard]] const char* name() const { return name_; }
[[nodiscard]] object_id_t id() const {
return getValue();
}
[[nodiscard]] object_id_t id() const { return getValue(); }
bool operator==(const ObjectId& other) const {
return id() == other.id();
}
bool operator==(const ObjectId& other) const { return id() == other.id(); }
bool operator!=(const ObjectId& other) const {
return id() != other.id();
}
bool operator!=(const ObjectId& other) const { return id() != other.id(); }
bool operator<(const ObjectId& other) const {
return id() < other.id();
}
bool operator<(const ObjectId& other) const { return id() < other.id(); }
bool operator>(const ObjectId& other) const {
return id() > other.id();
}
bool operator>(const ObjectId& other) const { return id() > other.id(); }
bool operator>=(const ObjectId& other) const {
return id() >= other.id();
}
bool operator>=(const ObjectId& other) const { return id() >= other.id(); }
bool operator<=(const ObjectId& other) const { return id() <= other.id(); }
bool operator<=(const ObjectId& other) const {
return id() <= other.id();
}
private:
const char* name_;
};
template<>
struct std::hash<ObjectId>
{
std::size_t operator()(ObjectId const& s) const noexcept
{
return std::hash<uint32_t>{}(s.id());
}
template <>
struct std::hash<ObjectId> {
std::size_t operator()(ObjectId const& s) const noexcept { return std::hash<uint32_t>{}(s.id()); }
};
#endif // FSFW_UTIL_OBJECTID_H

View File

@ -3,50 +3,45 @@
#include "fsfw/serialize.h"
template<typename T>
class UnsignedByteField: public SerializeIF {
template <typename T>
class UnsignedByteField : public SerializeIF {
public:
static_assert(std::is_unsigned<T>::value);
explicit UnsignedByteField(T value): value(value) {}
explicit UnsignedByteField(T value) : value(value) {}
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override {
Endianness streamEndianness) const override {
return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness);
}
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
}
[[nodiscard]] size_t getSerializedSize() const override {
return sizeof(T);
}
[[nodiscard]] size_t getSerializedSize() const override { return sizeof(T); }
[[nodiscard]] T getValue() const {
return value;
}
[[nodiscard]] T getValue() const { return value; }
void setValue(T value_) { value = value_; }
void setValue(T value_) {
value = value_;
}
private:
T value;
};
class U32ByteField: public UnsignedByteField<uint32_t> {
class U32ByteField : public UnsignedByteField<uint32_t> {
public:
explicit U32ByteField(uint32_t value): UnsignedByteField<uint32_t>(value) {}
explicit U32ByteField(uint32_t value) : UnsignedByteField<uint32_t>(value) {}
};
class U16ByteField: public UnsignedByteField<uint16_t> {
class U16ByteField : public UnsignedByteField<uint16_t> {
public:
explicit U16ByteField(uint16_t value): UnsignedByteField<uint16_t>(value) {}
explicit U16ByteField(uint16_t value) : UnsignedByteField<uint16_t>(value) {}
};
class U8ByteField: public UnsignedByteField<uint8_t> {
class U8ByteField : public UnsignedByteField<uint8_t> {
public:
explicit U8ByteField(uint8_t value): UnsignedByteField<uint8_t>(value) {}
explicit U8ByteField(uint8_t value) : UnsignedByteField<uint8_t>(value) {}
};
#endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H