Commit e2b04965 authored by Matthieu Dorier's avatar Matthieu Dorier

added length_packed to C++ interface

parent eeb9b5de
......@@ -478,6 +478,40 @@ class client {
return vsizes;
}
//////////////////////////
// LENGTH_PACKED methods
//////////////////////////
/**
* @brief Equivalent to sdskv_length_packed.
*
* @param db Database instance.
* @param num Number of keys.
* @param keys Packed keys.
* @param ksizes Array of key sizes.
* @param vsizes Resulting value sizes.
*/
bool length_packed(const database& db,
hg_size_t num, const void* keys,
const hg_size_t* ksizes, hg_size_t* vsizes) const;
/**
* Version of length_packed that takes an std::string as packed buffer.
*
* @tparam K Type of keys.
* @param db Database instance.
* @param keys Packed keys.
* @param vsizes Resulting vector of value sizes.
*/
template<typename K>
inline bool length_multi(const database& db,
const std::string& keys,
const std::vector<hg_size_t>& ksizes,
std::vector<hg_size_t>& vsizes) const {
vsizes.resize(ksizes.size());
return length_packed(db, ksizes.size(), keys.data(), ksizes.data(), vsizes.data());
}
//////////////////////////
// GET methods
//////////////////////////
......@@ -1362,6 +1396,14 @@ class database {
return m_ph.m_client->length_multi(*this, std::forward<T>(args)...);
}
/**
* @brief @see client::length_packed.
*/
template<typename ... T>
decltype(auto) length_packed(T&& ... args) const {
return m_ph.m_client->length_packed(*this, std::forward<T>(args)...);
}
/**
* @brief @see client::get.
*/
......@@ -1512,6 +1554,15 @@ inline bool client::length_multi(const database& db,
return true;
}
inline bool client::length_packed(const database& db,
hg_size_t num, const void* keys,
const hg_size_t* ksizes, hg_size_t* vsizes) const {
int ret = sdskv_length_packed(db.m_ph.m_ph, db.m_db_id,
num, keys, ksizes, vsizes);
_CHECK_RET(ret);
return true;
}
inline bool client::get(const database& db,
const void* key, hg_size_t ksize,
void* value, hg_size_t* vsize) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment