Runtime objects

Objects of types that are registered with DBOO are all behaving just like any normal C++ objects. There is no performance or size overhead for just registering the classes.

Object id

The object id is central in DBOO. It is a 64 bit integer unique for each object. The object id is generated the first time the API gets to know about the object.

It is a 64 bit integer unique for each object. The current implementation is constructing the id from process id, thread id, time and an incremental number.

Object lifetime

In Node.js, the object lifetime is handled by the node environment. DBOO has weak references to all objects it knows about and updates it’s internal list when they are moved or removes them from it’s registry when they are garbage collected.

In C++, you manage your own objects. It is important to remove them from the DBOO registry when destroying them using the odb::rmobj() functions. The C++ function odb::free_all() can destroy all objects known to DBOO, but in that case the destructors must not destroy any pointed-to objects.

// Destroy objects known to DBOO:
delete db.rmobj(object);

// Destroy all objects known to DBOO:
db.free_all();