8 * Constructs a class KDB.
12 handle = ckdb::kdbOpen();
16 * The destructor closes the database.
20 ckdb::kdbClose(handle);
24 * Get all keys below parentKey inside returned.
26 * @param returned the keyset where the keys will be in
27 * @param parentKey the parentKey of returned
28 * @param options to change the behaviour which keys to fetch
30 size_t KDB::get (KeySet & returned, const Key & parentKey, option_t options)
32 ssize_t ret = ckdb::kdbGet (handle, returned.getKeySet(), parentKey.getKey(), options);
33 if (ret == -1) throw KDBException();
38 size_t KDB::set (KeySet & returned, const Key & parentKey, option_t options)
40 ssize_t ret = ckdb::kdbSet(handle, returned.getKeySet(), parentKey.getKey(), options);
41 if (ret == -1) throw KDBException();
46 size_t KDB::get (KeySet & returned, const std::string &parentName, option_t options)
48 ssize_t ret = ckdb::kdbGetByName (handle, returned.getKeySet(), parentName.c_str(), options);
49 if (ret == -1) throw KDBException();
53 size_t KDB::get (KeySet & returned, const char * parentName, option_t options)
55 ssize_t ret = ckdb::kdbGetByName (handle, returned.getKeySet(), parentName, options);
56 if (ret == -1) throw KDBException();
61 void KDB::getString (const std::string &keyname, std::string value, size_t maxSize)
63 char *c = new char[maxSize];
64 ckdb::kdbGetString(handle, keyname.c_str(), c, maxSize);
69 void KDB::setString (const std::string &keyname, const std::string &value)
71 ckdb::kdbSetString(handle, keyname.c_str(), value.c_str());
74 void KDB::remove (const std::string &keyname)
76 ckdb::kdbRemove(handle, keyname.c_str());
82 * @param toGet the key to get
84 void KDB::get (Key & toGet)
86 int ret = ckdb::kdbGetKey(handle, toGet.getKey());
87 if (ret == -1) throw KDBException();
90 void KDB::set (const Key & toSet)
92 int ret = ckdb::kdbSetKey(handle, toSet.getKey());
93 if (ret == -1) throw KDBException();
96 } // end of namespace kdb