GitLab maintenance scheduled for Today, 2019-12-05, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit fc5472c0 authored by Matthieu Dorier's avatar Matthieu Dorier

storeRawData and loadRawData are now public

parent e4b3a9c1
......@@ -43,31 +43,6 @@ class DataSet {
*/
DataSet(DataStore* ds, uint8_t level, const std::string& container, const std::string& name);
/**
* @brief Stores binary data associated with a particular key into this DataSet.
* This function will return true if the key did not already exist and the
* write succeeded. It will return false otherwise.
*
* @param key Key.
* @param buffer Binary data to insert.
*
* @return trye if the key did not already exist and the write succeeded,
* false otherwise.
*/
bool storeBuffer(const std::string& key, const std::vector<char>& buffer);
/**
* @brief Loads binary data associated with a particular key from the DataSet.
* This function will return true if the key exists and the read succeeded.
* It will return false otherwise.
*
* @param key Key.
* @param buffer Buffer in which to put the binary data.
*
* @return true if the key exists and the read succeeded,
* false otherwise.
*/
bool loadBuffer(const std::string& key, std::vector<char>& buffer) const;
/**
* @brief Implementation class (used for the Pimpl idiom).
......@@ -162,6 +137,32 @@ class DataSet {
*/
bool valid() const;
/**
* @brief Stores binary data associated with a particular key into this DataSet.
* This function will return true if the key did not already exist and the
* write succeeded. It will return false otherwise.
*
* @param key Key.
* @param buffer Binary data to insert.
*
* @return trye if the key did not already exist and the write succeeded,
* false otherwise.
*/
bool storeRawData(const std::string& key, const std::vector<char>& buffer);
/**
* @brief Loads binary data associated with a particular key from the DataSet.
* This function will return true if the key exists and the read succeeded.
* It will return false otherwise.
*
* @param key Key.
* @param buffer Buffer in which to put the binary data.
*
* @return true if the key exists and the read succeeded,
* false otherwise.
*/
bool loadRawData(const std::string& key, std::vector<char>& buffer) const;
/**
* @brief Stores a key/value pair into the DataSet.
* The type of the key should have operator<< available
......@@ -188,7 +189,7 @@ class DataSet {
}
std::string serialized = ss_value.str();
std::vector<char> buffer(serialized.begin(), serialized.end());
return storeBuffer(key, buffer);
return storeRawData(key, buffer);
}
/**
......@@ -209,7 +210,7 @@ class DataSet {
template<typename K, typename V>
bool load(const K& key, V& value) const {
std::vector<char> buffer;
if(!loadBuffer(key, buffer)) {
if(!loadRawData(key, buffer)) {
return false;
}
try {
......
......@@ -66,7 +66,7 @@ bool DataSet::valid() const {
}
bool DataSet::storeBuffer(const std::string& key, const std::vector<char>& buffer) {
bool DataSet::storeRawData(const std::string& key, const std::vector<char>& buffer) {
if(!valid()) {
throw Exception("Calling store() on invalid DataSet");
}
......@@ -74,7 +74,7 @@ bool DataSet::storeBuffer(const std::string& key, const std::vector<char>& buffe
return m_impl->m_datastore->m_impl->store(0, fullname(), key, buffer);
}
bool DataSet::loadBuffer(const std::string& key, std::vector<char>& buffer) const {
bool DataSet::loadRawData(const std::string& key, std::vector<char>& buffer) const {
if(!valid()) {
throw Exception("Calling load() on invalid DataSet");
}
......
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