C++

GDBM class for Boost C++ serializable objects

I havn't writtin the iterators yet, but below is a simple class wrapping a GDBM database allowing you to store Boost serializable objects in the file on disk. Usage is pretty simple:

  Gdbm st(databaseName);

  std::map<std::string, double> amap;
  amap["a"] = 10;
  amap["b"] = 12.5;
  cout << "Into file a: " << amap["a"] << endl;
  st.store("example", amap); //Serialize and store the map

  std::map<std::string, double> fromFile;
  st.load("example", fromFile); //Serialize and restore the map
  cout << "From file a: " << fromFile["a"] << endl;

Syndicate content