54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
/* ************************************************************************** */
|
||
/* */
|
||
/* ::: :::::::: */
|
||
/* Serializer.cpp :+: :+: :+: */
|
||
/* +:+ +:+ +:+ */
|
||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||
/* +#+#+#+#+#+ +#+ */
|
||
/* Created: 2025/04/09 11:08:07 by adjoly #+# #+# */
|
||
/* Updated: 2025/04/09 12:23:14 by adjoly ### ########.fr */
|
||
/* */
|
||
/* ************************************************************************** */
|
||
|
||
#include "Serializer.hpp"
|
||
#include <string>
|
||
|
||
void _log(std::string emoji, std::string what, std::string who,
|
||
std::string str) {
|
||
#ifdef VERBOSE
|
||
if (who.empty())
|
||
std::cout << "「" << emoji << "」" << what << ": " << str << std::endl;
|
||
else
|
||
std::cout << "「" << emoji << "」" << what << "(" << who << "): " << str
|
||
<< std::endl;
|
||
#else
|
||
(void)emoji, (void)what, (void)who, (void)str;
|
||
#endif
|
||
}
|
||
|
||
uintptr_t Serializer::serialize(Data *ptr) {
|
||
return reinterpret_cast<uintptr_t>(ptr);
|
||
}
|
||
|
||
Data *Serializer::deserialize(uintptr_t raw) {
|
||
return reinterpret_cast<Data *>(raw);
|
||
}
|
||
|
||
Serializer::Serializer(void) {
|
||
_log("➕", "Serializer", "", "default constructor called");
|
||
}
|
||
|
||
Serializer::Serializer(const Serializer &cpy) {
|
||
_log("➕", "Serializer", "", "copy constructor called");
|
||
if (this != &cpy)
|
||
*this = cpy;
|
||
}
|
||
|
||
Serializer::~Serializer(void) {
|
||
_log("➖", "Serializer", "", "destructor called");
|
||
}
|
||
|
||
Serializer &Serializer::operator=(const Serializer &) {
|
||
return *this;
|
||
}
|