-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (21 loc) · 935 Bytes
/
main.cpp
File metadata and controls
26 lines (21 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "defines.hpp"
#include "Data.hpp"
#include "Serializer.hpp"
int main()
{
Data batman = {"Bruce", "Wayne", 42};
print (TITTLE YELLOW_BOLD "Data members before serialization\n" RESET);
print (YELLOW "Name: " RESET << batman.name);
print (YELLOW "Second name: " RESET << batman.second_name);
print (YELLOW "Age: " RESET << batman.age);
print (TITTLE YELLOW_BOLD "Serializing\n" RESET);
uintptr_t raw = Serializer::serialize(&batman);
print (YELLOW "Data pointer serialized: " RESET << raw);
print (TITTLE YELLOW_BOLD "Deserializing\n" RESET);
Data *batman_ptr = Serializer::deserialize(raw);
print (YELLOW "Data pointer deserialized: " RESET << batman_ptr);
print (TITTLE YELLOW_BOLD "Checking data members by deserialized pointer\n" RESET);
print (YELLOW "Name: " RESET << batman_ptr->name);
print (YELLOW "Second name: " RESET << batman_ptr->second_name);
print (YELLOW "Age: " RESET << batman_ptr->age);
}