Solar/cbf_store_pylon.cpp
2025-09-03 22:38:18 +02:00

71 lines
2.9 KiB
C++

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