I'm building a system, with C++, that uses Tokyo Cabinet (original API in C). The problem is I want to store a class such as:
class Entity {
public:
string entityName;
short type;
vector<another_struct> x;
vector<another_struct> y
vector<string> z;
};
The problem is that vectors and strings have variable length. When I pass a void* (my object) to Tokyo Cabinet so it can store it, I also have to pass the size of the object in bytes. But that can't be trivially done.
What is the best way to determine the number of bytes of an object? Or what is the best way to store variable length objects in Tokyo Cabinet.
I'm already considering looking for serialization libs.
Thanks