From fc5472c053a41b63284685dfafb0a8dc95de33b5 Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Fri, 13 Apr 2018 15:50:19 +0200 Subject: [PATCH] storeRawData and loadRawData are now public --- include/hepnos/DataSet.hpp | 55 +++++++++++++++++++------------------- src/DataSet.cpp | 4 +-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/include/hepnos/DataSet.hpp b/include/hepnos/DataSet.hpp index e29fb29..16eca9b 100644 --- a/include/hepnos/DataSet.hpp +++ b/include/hepnos/DataSet.hpp @@ -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& 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& 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& 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& 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 buffer(serialized.begin(), serialized.end()); - return storeBuffer(key, buffer); + return storeRawData(key, buffer); } /** @@ -209,7 +210,7 @@ class DataSet { template bool load(const K& key, V& value) const { std::vector buffer; - if(!loadBuffer(key, buffer)) { + if(!loadRawData(key, buffer)) { return false; } try { diff --git a/src/DataSet.cpp b/src/DataSet.cpp index ed6a4b5..568e858 100644 --- a/src/DataSet.cpp +++ b/src/DataSet.cpp @@ -66,7 +66,7 @@ bool DataSet::valid() const { } -bool DataSet::storeBuffer(const std::string& key, const std::vector& buffer) { +bool DataSet::storeRawData(const std::string& key, const std::vector& buffer) { if(!valid()) { throw Exception("Calling store() on invalid DataSet"); } @@ -74,7 +74,7 @@ bool DataSet::storeBuffer(const std::string& key, const std::vector& buffe return m_impl->m_datastore->m_impl->store(0, fullname(), key, buffer); } -bool DataSet::loadBuffer(const std::string& key, std::vector& buffer) const { +bool DataSet::loadRawData(const std::string& key, std::vector& buffer) const { if(!valid()) { throw Exception("Calling load() on invalid DataSet"); } -- 2.26.2