add copy and assignment ctor for mode definition

This commit is contained in:
Robin Müller 2023-03-07 16:03:28 +01:00
parent 2745b2080d
commit 4c48668125
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 20 additions and 1 deletions

View File

@ -13,7 +13,7 @@ enum SpecialSubmodeFlags : uint8_t { INHERIT = 1 << 0, ALLOWED_MASK = 1 << 1 };
class ModeListEntry : public SerialLinkedListAdapter<SerializeIF>,
public LinkedElement<ModeListEntry> {
public:
ModeListEntry() : LinkedElement<ModeListEntry>(this) { setLinks(); }
ModeListEntry() : SerialLinkedListAdapter(), LinkedElement<ModeListEntry>(this) { setLinks(); }
SerializeElement<uint32_t> value1 = 0;
SerializeElement<uint32_t> value2 = 0;
@ -21,6 +21,25 @@ class ModeListEntry : public SerialLinkedListAdapter<SerializeIF>,
SerializeElement<uint8_t> value4 = 0;
SerializeElement<uint8_t> value5 = 0;
ModeListEntry(const ModeListEntry& other)
: SerialLinkedListAdapter(), LinkedElement<ModeListEntry>(this) {
value1.entry = other.value1.entry;
value2.entry = other.value2.entry;
value3.entry = other.value3.entry;
value4.entry = other.value4.entry;
value5.entry = other.value5.entry;
setLinks();
}
ModeListEntry& operator=(const ModeListEntry& other) {
this->value1.entry = other.value1.entry;
this->value2.entry = other.value2.entry;
this->value3.entry = other.value3.entry;
this->value4.entry = other.value4.entry;
this->value5.entry = other.value5.entry;
return *this;
}
void setLinks() {
setStart(&value1);
value1.setNext(&value2);