Data Types

What types of data can be logged in Hobbes?

Primitive types

Essentially, whatever you’d expect. Because the persistence format is binary, it’s both space-efficient and type safe, meaning the datatype you persist is what you get out. As such, the following primitive types can be persisted:

bool
uint8_t
char
16, 32, and 64 bit signed and unsigned ints
single and double precision floats
std::string and const char*

Aggregate types

If a type T can be persisted, then its array type T[] and its vector std::vector<T> can be persisted.

If types T0, T1, ..., Tn can be persisted, then a tuple std::tuple<T0, T1, ..., Tn> can also be persisted.

Custom types

You can create a struct that Hobbes can log using the DEFINE_PACKED_HSTORE_STRUCT macro, as long as the member types are persistable:

DEFINE_PACKED_HSTORE_STRUCT(TemperatureAndPressure,
  (double, Temperature),
  (double, Pressure)
);

With a little work, you can even make a custom class loggable as a field by specialising the hobbes::storage::store<T> type and implementing the static functions found inside.

You’ll find store in include/Storage.h in the github repo.