mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
no default construct
This commit is contained in:
parent
784365181e
commit
2f4ac3ddf8
@ -6,14 +6,17 @@ std::list<IR_Decoder*>& IR_Decoder::get_dec_list() // определение ф
|
||||
return dec_list; // возвращается ссылка на переменную
|
||||
}
|
||||
|
||||
IR_Decoder::IR_Decoder(){};
|
||||
// IR_Decoder::IR_Decoder() {};
|
||||
IR_Decoder::IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair)
|
||||
: IR_DecoderRaw(pin, addr, encPair)
|
||||
{
|
||||
get_dec_list().push_back(this);
|
||||
};
|
||||
|
||||
void IR_Decoder::operator()() { isr(); }
|
||||
std::function<void()> IR_Decoder::operator()()
|
||||
{
|
||||
return std::bind(&IR_Decoder::isr, this);
|
||||
}
|
||||
|
||||
IR_Decoder::~IR_Decoder()
|
||||
{
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
PacketTypes::Request gotRequest;
|
||||
PacketTypes::BasePack gotRaw;
|
||||
|
||||
IR_Decoder();
|
||||
// IR_Decoder();
|
||||
IR_Decoder(const uint8_t pin, uint16_t addr, IR_Encoder *encPair = nullptr);
|
||||
|
||||
void operator()() ;
|
||||
std::function<void()> operator()();
|
||||
|
||||
~IR_Decoder();
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "IR_DecoderRaw.h"
|
||||
#include "IR_Encoder.h"
|
||||
|
||||
IR_DecoderRaw::IR_DecoderRaw(){};
|
||||
IR_DecoderRaw::IR_DecoderRaw(const uint8_t pin, uint16_t addr, IR_Encoder *encPair) : encoder(encPair)
|
||||
{
|
||||
setPin(pin);
|
||||
@ -651,3 +650,179 @@ inline void IR_DecoderRaw::infoPulse(uint8_t pin, uint8_t count)
|
||||
}
|
||||
}
|
||||
#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;
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IR_DecoderRaw();
|
||||
/// @brief Конструктор
|
||||
/// @param pin Номер вывода прерывания/данных от приёмника (2 или 3 для atmega 328p)
|
||||
/// @param addr Адрес приёмника
|
||||
|
@ -11,7 +11,6 @@ std::list<IR_Encoder*>& IR_Encoder::get_enc_list() // определение ф
|
||||
return dec_list; // возвращается ссылка на переменную
|
||||
}
|
||||
|
||||
IR_Encoder::IR_Encoder(){};
|
||||
|
||||
IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair)
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ public:
|
||||
private:
|
||||
uint16_t id; /// @brief Адрес передатчика
|
||||
public:
|
||||
IR_Encoder();
|
||||
/// @brief Класс передатчика
|
||||
/// @param addr Адрес передатчика
|
||||
/// @param pin Вывод передатчика
|
||||
|
Loading…
x
Reference in New Issue
Block a user