Solar/cbf_store_sthome.cpp
2025-10-10 17:25:17 +02:00

71 lines
2.9 KiB
C++

#include "cbf_store_sthome.h"
namespace solar
{
cbf_store_sthome::cbf_store_sthome(int msg_id, uint32_t can_id, const byte_vector& frame, bool rtr, time_t timestamp)
: cb_frame(msg_id, can_id, frame, rtr), cbf_store(msg_id, can_id, 0, timestamp, timestamp) //, cbf_sthome(msg_id, can_id, frame, rtr)
{
this->id = 0;
this->count = 0;
// ESP_LOGI(tag("store_sthome CTOR1").c_str(), "%-20s %s", "Created store_sthome", this->to_string().c_str());
}
cbf_store_sthome::cbf_store_sthome(const cbf_store_sthome& b)
: cb_frame(b), cbf_store(b) // call base class copy constructor
{
// ESP_LOGI(tag("store_sthome CCTOR").c_str(), "%-20s %s", "Copied store_sthome", this->to_string().c_str());
}
cbf_store_sthome& cbf_store_sthome::operator=(const cbf_store_sthome& b)
{
if (this != &b) {
cbf_store_sthome tmp(b);
swap(tmp);
// ESP_LOGI(tag("store_sthome AOPP").c_str(), "%-20s %s", "Assigned store_sthome", this->to_string().c_str());
}
return *this;
}
cbf_store_sthome::cbf_store_sthome(cbf_store_sthome&& src)
: cb_frame(src), cbf_store(src)
{
src.clear();
// ESP_LOGI(tag("store_sthome MCCTOR").c_str(), "%-20s %s", "Copied store_sthome", this->to_string().c_str());
}
cbf_store_sthome& cbf_store_sthome::operator=(cbf_store_sthome&& src)
{
if (this != &src) {
cbf_store::operator=(std::move(src));
cb_frame::operator=(std::move(src));
src.clear();
// ESP_LOGI(tag("store_sthome MOASS").c_str(), "%-20s %s", "Assigned store_sthome", this->to_string().c_str());
}
return *this;
}
std::shared_ptr<cbf_store_sthome> cbf_store_sthome::clone() const
{
return std::static_pointer_cast<cbf_store_sthome>(clone_impl()); // static_pointer_cast is safe here because we know the underlying type is cbf_store_sthome
}
std::shared_ptr<cbf_store> cbf_store_sthome::clone_impl() const
{
//ESP_LOGI(tag("store_sthome CLONE").c_str(), "%-20s", "Cloning store_sthome");
return std::make_shared<cbf_store_sthome>(*this);
}
void cbf_store_sthome::clear()
{
cb_frame::clear();
cbf_store::clear();
}
void cbf_store_sthome::swap(cbf_store_sthome &s)
{
cb_frame::swap(s);
cbf_store::swap(s);
}
cbf_store::cbf_updateresult cbf_store_sthome::update(const cbf_store& newitem, const int *comparecolumns)
{
//ESP_LOGI(tag("store_sthome UPDATE").c_str(), "%-20s %s", "Updating store_sthome", this->to_string().c_str());
return cbf_store::update(newitem, publish_spec, rtr_publish_spec, comparecolumns);
}
std::string cbf_store_sthome::to_string() const
{
return cb_frame::to_string() + " " + cbf_sthome::to_string();
}
} // namespace solar