This commit is contained in:
DashyFox 2024-08-29 16:22:09 +03:00
parent 04af094f4b
commit d4dd0e95fd

View File

@ -650,179 +650,3 @@ inline void IR_DecoderRaw::infoPulse(uint8_t pin, uint8_t count)
} }
} }
#endif #endif
// Конструктор копирования
IR_DecoderRaw::IR_DecoderRaw(const IR_DecoderRaw& other)
: packInfo(other.packInfo),
encoder(other.encoder), // Если IR_Encoder имеет безопасный копируемый указатель
isAvailable(other.isAvailable),
packSize(other.packSize),
crcValue(other.crcValue),
isPairSending(other.isPairSending),
isRecive(other.isRecive),
isPreamb(other.isPreamb),
isSubBufferOverflow(other.isSubBufferOverflow),
isBufferOverflow(other.isBufferOverflow),
isWrongPack(other.isWrongPack),
riseSyncTime(other.riseSyncTime),
currentSubBufferIndex(other.currentSubBufferIndex),
subBuffer(other.subBuffer), // Копирование буфера
lastFront(other.lastFront),
firstUnHandledFront(other.firstUnHandledFront),
prevRise(other.prevRise),
prevPrevRise(other.prevPrevRise),
prevFall(other.prevFall),
prevPrevFall(other.prevPrevFall),
risePeriod(other.risePeriod),
highTime(other.highTime),
lowTime(other.lowTime),
oldTime(other.oldTime),
wrongCounter(other.wrongCounter),
highCount(other.highCount),
lowCount(other.lowCount),
allCount(other.allCount),
errorCounter(other.errorCounter),
preambFrontCounter(other.preambFrontCounter),
bufBitPos(other.bufBitPos),
isData(other.isData),
i_dataBuffer(other.i_dataBuffer),
nextControlBit(other.nextControlBit),
i_syncBit(other.i_syncBit),
err_syncBit(other.err_syncBit)
{
// Специфическое копирование, если нужно
}
// Оператор копирующего присваивания
IR_DecoderRaw& IR_DecoderRaw::operator=(const IR_DecoderRaw& other) {
if (this != &other) { // Проверка на самоприсваивание
packInfo = other.packInfo;
encoder = other.encoder;
isAvailable = other.isAvailable;
packSize = other.packSize;
crcValue = other.crcValue;
isPairSending = other.isPairSending;
isRecive = other.isRecive;
isPreamb = other.isPreamb;
isSubBufferOverflow = other.isSubBufferOverflow;
isBufferOverflow = other.isBufferOverflow;
isWrongPack = other.isWrongPack;
riseSyncTime = other.riseSyncTime;
currentSubBufferIndex = other.currentSubBufferIndex;
subBuffer = other.subBuffer;
lastFront = other.lastFront;
firstUnHandledFront = other.firstUnHandledFront;
prevRise = other.prevRise;
prevPrevRise = other.prevPrevRise;
prevFall = other.prevFall;
prevPrevFall = other.prevPrevFall;
risePeriod = other.risePeriod;
highTime = other.highTime;
lowTime = other.lowTime;
oldTime = other.oldTime;
wrongCounter = other.wrongCounter;
highCount = other.highCount;
lowCount = other.lowCount;
allCount = other.allCount;
errorCounter = other.errorCounter;
preambFrontCounter = other.preambFrontCounter;
bufBitPos = other.bufBitPos;
isData = other.isData;
i_dataBuffer = other.i_dataBuffer;
nextControlBit = other.nextControlBit;
i_syncBit = other.i_syncBit;
err_syncBit = other.err_syncBit;
}
return *this;
}
// Конструктор перемещения
IR_DecoderRaw::IR_DecoderRaw(IR_DecoderRaw&& other)
: packInfo(std::move(other.packInfo)),
encoder(other.encoder),
isAvailable(other.isAvailable),
packSize(other.packSize),
crcValue(other.crcValue),
isPairSending(other.isPairSending),
isRecive(other.isRecive),
isPreamb(other.isPreamb),
isSubBufferOverflow(other.isSubBufferOverflow),
isBufferOverflow(other.isBufferOverflow),
isWrongPack(other.isWrongPack),
riseSyncTime(other.riseSyncTime),
currentSubBufferIndex(other.currentSubBufferIndex),
subBuffer(std::move(other.subBuffer)),
lastFront(other.lastFront),
firstUnHandledFront(other.firstUnHandledFront),
prevRise(other.prevRise),
prevPrevRise(other.prevPrevRise),
prevFall(other.prevFall),
prevPrevFall(other.prevPrevFall),
risePeriod(other.risePeriod),
highTime(other.highTime),
lowTime(other.lowTime),
oldTime(other.oldTime),
wrongCounter(other.wrongCounter),
highCount(other.highCount),
lowCount(other.lowCount),
allCount(other.allCount),
errorCounter(other.errorCounter),
preambFrontCounter(other.preambFrontCounter),
bufBitPos(other.bufBitPos),
isData(other.isData),
i_dataBuffer(other.i_dataBuffer),
nextControlBit(other.nextControlBit),
i_syncBit(other.i_syncBit),
err_syncBit(other.err_syncBit)
{
other.encoder = nullptr;
other.lastFront = nullptr;
other.firstUnHandledFront = nullptr;
}
// Оператор перемещающего присваивания
IR_DecoderRaw& IR_DecoderRaw::operator=(IR_DecoderRaw&& other) {
if (this != &other) { // Проверка на самоприсваивание
packInfo = std::move(other.packInfo);
encoder = other.encoder;
isAvailable = other.isAvailable;
packSize = other.packSize;
crcValue = other.crcValue;
isPairSending = other.isPairSending;
isRecive = other.isRecive;
isPreamb = other.isPreamb;
isSubBufferOverflow = other.isSubBufferOverflow;
isBufferOverflow = other.isBufferOverflow;
isWrongPack = other.isWrongPack;
riseSyncTime = other.riseSyncTime;
currentSubBufferIndex = other.currentSubBufferIndex;
subBuffer = std::move(other.subBuffer);
lastFront = other.lastFront;
firstUnHandledFront = other.firstUnHandledFront;
prevRise = other.prevRise;
prevPrevRise = other.prevPrevRise;
prevFall = other.prevFall;
prevPrevFall = other.prevPrevFall;
risePeriod = other.risePeriod;
highTime = other.highTime;
lowTime = other.lowTime;
oldTime = other.oldTime;
wrongCounter = other.wrongCounter;
highCount = other.highCount;
lowCount = other.lowCount;
allCount = other.allCount;
errorCounter = other.errorCounter;
preambFrontCounter = other.preambFrontCounter;
bufBitPos = other.bufBitPos;
isData = other.isData;
i_dataBuffer = other.i_dataBuffer;
nextControlBit = other.nextControlBit;
i_syncBit = other.i_syncBit;
err_syncBit = other.err_syncBit;
other.encoder = nullptr;
other.lastFront = nullptr;
other.firstUnHandledFront = nullptr;
}
return *this;
}