/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#pragma once
#include "NetObjTemporaryPtr.hpp"
#include "cereal/archives/portable_binary.hpp"
#include
namespace NetworkingObjects {
template void default_serialize_write_func(const NetObjTemporaryPtr& o, cereal::PortableBinaryOutputArchive& a) {
a(*o);
}
template void default_serialize_read_func_client(const NetObjTemporaryPtr& o, cereal::PortableBinaryInputArchive& a, const std::shared_ptr&) {
a(*o);
}
template void default_serialize_read_constructor_func(const NetObjTemporaryPtr& o, cereal::PortableBinaryInputArchive& a, const std::shared_ptr&) {
a(*o);
}
template void register_generic_serialized_class(NetObjManager& objMan) {
objMan.register_class({
.writeConstructorFuncClient = default_serialize_write_func,
.readConstructorFuncClient = default_serialize_read_constructor_func,
.readUpdateFuncClient = default_serialize_read_func_client,
.writeConstructorFuncServer = default_serialize_write_func,
.readConstructorFuncServer = default_serialize_read_constructor_func,
.readUpdateFuncServer = [](const NetObjTemporaryPtr& o, cereal::PortableBinaryInputArchive& a, const std::shared_ptr&) {
a(*o);
o.send_server_update_to_all_clients(RELIABLE_COMMAND_CHANNEL, [](const NetObjTemporaryPtr& o, cereal::PortableBinaryOutputArchive& a) {
a(*o);
});
},
});
}
template void generic_serialized_class_send_update_to_all(const NetObjTemporaryPtr& o) {
o.send_update_to_all(RELIABLE_COMMAND_CHANNEL, default_serialize_write_func);
}
}