Resource ID

/**
 * @brief Create an association between a memory_resource* and a unique std::size_t
 * @param res memory_resource* a resource to identify with the additional numeric id
 * @param id  std::size_t      a numeric id by which to identify the specified memory_resource*, must not be the special value of 0.
 */
void identify_resource_with(memory_resource* res, std::size_t id);
/**
 * @brief Query the associated identifier of a given memory_resource.
 * @param res memory_resource* which had an identifier previously set by a call to @see identify_resource_with
 * @return the identifier that was previously assigned to this resource or the special value of 0 if no such identifier.
 */
std::size_t get_resource_identifier(memory_resource* res);
>

Serialization

/**
 * @brief Serialize *everything* into a serialization_buffer, using a serial_context.
 * @param buf serialization_buffer object that will contain the serialization when the call returns.
 * @param ctx serial_context the context to use for vtable numbering of types.
 */
void serialize_buffer(serialization_buffer& buf, serial_context ctx = G_DEFAULT_SERIAL_CONTEXT);
/**
 * @brief Serialize offsets into a serialization_buffer, using a serial_context, and by cross-referring to a set of known ranges.
 * @param offsets memory_range_offsets object which should contain the ranges (e.g., by calls to @see memcontour).
 * @param ranges memory_range_offsets object returned by @see expand_ranges.
 * @param buf serialization_buffer object that will contain the serialization when the call returns.
 * @param ctx serial_context the context to use for vtable numbering of types.
 */
void serialize_buffer_ranges(memory_range_offsets& offsets, const memory_range_offsets& ranges, serialization_buffer& buf, serial_context ctx = G_DEFAULT_SERIAL_CONTEXT);
<

Persistence

/**
 * @brief Writes all relocatable memory which can currently be found, as complete chunks, including currently unallocated memory, to a file with specified name.
 * @param fn const char* pointing to pathname of file to overwrite
 * @param ctx serial_context to number types with
 * @see persist_ranges
 * @see restore(const char*)
 */
void persist(serial_context ctx = G_DEFAULT_SERIAL_CONTEXT, const char* fn = G_DEFAULT_PERSIST_FILENAME);
/**
 * @brief Writes only specified memory contours to file with specified name.
 * @param fn const char* pointing to pathname of file to overwrite
 * @param ctx serial_context to number types with
 * @param ranges the ranges to persist
 * @param expanded_ranges the output of @see expand_ranges.
 * @see persist
 * @see restore
 * @see memcontour
 */
void persist_ranges(memory_range_offsets& ranges, const memory_range_offsets& expanded_ranges, serial_context ctx = G_DEFAULT_SERIAL_CONTEXT, const char* fn = G_DEFAULT_PERSIST_FILENAME);
>

Restoration

/**
 * @brief Reads file with specified filename, and restores state as found specified.
 * @param fn const char* pointing to pathname of file to read
 * @param ctx serial_context to number types with
 * @see persist
 * @see persist_ranges
 * @see restore
 */
void restore_file(serial_context ctx = G_DEFAULT_SERIAL_CONTEXT, const char* fn = G_DEFAULT_PERSIST_FILENAME);
/**
 * @brief Reads serialization starting at a certain address.
 * @param p void* pointer to the starting address
 * @see restore
 */
void restore(void* p, std::size_t nbytes, serial_context = G_DEFAULT_SERIAL_CONTEXT);
<

vnew / vdelete

/**
 * @brief To be used with registered types in lieu of new-expression.
 * @param T The type to construct.
 * @param args... Arguments to pass to the constructor
 * @return A correctly typed pointer to the new object.
 */
T* p = vnew<T>(args...);
/**
 * @brief To be used with registered types in lieu of delete-expression.
 * @param p T* The object to delete.
 */
vdelete(T* p);

>

Placement vnew

/**
 * @brief To be used with registered types in lieu of placement-new-expression.
 * @param T The type to construct.
 * @param placement void* The address where to construct.
 * @param args... Arguments to pass to the constructor
 * @return A correctly typed pointer to the new object.
 */
T* p = vpnew<T>((void*)placement)(args...););
/**
 * @brief To be used with registered types in lieu of placement-new-expression.
 * @param T The type to construct.
 * @param placement... The placement arguments.
 * @param args... Arguments to pass to the constructor
 * @return A correctly typed pointer to the new object.
 */
T* p = vpnew<T>(placement...)(args...););
<

Memory contouring

/**
 * @brief Traverse a graph of pointers.
 * @param starting_point void* Where to start traversal.
 * @return A memory_range_offsets object containing all ranges.
 */
memory_range_offsets mro = memcontour((void*)starting_point);

Register types

/**
 * @brief Registers types as having virtual methods as well as needing serialization, or renders the type identifiable in a message.
 * @param ctx serial_context a small logical index number, at least 0, grouping the ordering of types within.
 * @param Types... A pack of types to register.
 */
void register_types<Types...>(serial_context ctx = G_DEFAULT_SERIAL_CONTEXT);
<
<
GrimoireGrimoire
The book is always better.