Figured I'd announce this here in case it might be useful to others working with LMDB from C++:
https://github.com/bendiken/lmdbxx
This is a <lmdb++.h> header file that implements a comprehensive C++ wrapper for LMDB, offering both an error-checked procedural interface and an object-oriented resource interface with RAII semantics.
See here for a basic example program using this wrapper:
https://github.com/bendiken/lmdbxx/blob/master/example.cc#L1
A quick summary of features (read the README for more information):
• Designed to be entirely self-contained as a single <lmdb++.h> header file that can be dropped into a project. • Implements a straightforward mapping from C to C++, with consistent naming. • Provides both a procedural interface and an object-oriented RAII interface. • Simplifies error handling by translating error codes into C++ exceptions. • Carefully differentiates logic errors, runtime errors, and fatal errors. • Exception strings include the name of the LMDB function that failed. • Plays nice with others: all symbols are placed into the lmdb namespace. • 100% free and unencumbered public domain software.
The <lmdb++.h> header file requires a C++11 compiler and standard library. Recent releases of Clang or GCC will work fine.
The wrapper is pretty complete at this point and is used in a production setting in the implementation of an RDF graph database. Next steps would be to figure out a versioning policy (vis-a-vis LMDB), package it up as a tarball release, and publish the generated Doxygen HTML documentation somewhere.
Best regards from springtime Berlin, Arto
openldap-technical@openldap.org