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

Commit e4b3a9c1 authored by Matthieu Dorier's avatar Matthieu Dorier

completely moved private function in implementation classes

parent 46b3a0ef
......@@ -214,62 +214,10 @@ class DataStore {
*/
class Impl;
std::unique_ptr<Impl> m_impl; /*!< Pointer to implementation */
/**
* @brief Function used by the DataSet, Run, SubRuns, and Event
* classes to load binary data associated with a particular object.
*
* @param level Level of nesting (0 for data products)
* @param containerName Name of the container
* @param objectName Name of the object
* @param data Resulting byte buffer containing the object's data
*
* @return true if the object was found an loaded correctly,
* false otherwise.
*/
bool load(uint8_t level, const std::string& containerName,
const std::string& objectName, std::vector<char>& data) const;
/**
* @brief Function used by the DataSet, Run, SubRuns, and Event
* classes to load binary data associated with a particular object.
*
* @param level Level of nesting (0 for data products)
* @param containerName Name of the container
* @param objectName Name of the object
* @param data Byte buffer to write
*
* @return true is the object did not exist and was correctly written,
* false otherwise.
*/
bool store(uint8_t level, const std::string& containerName,
const std::string& objectName, const std::vector<char>& data);
/**
* @brief Given a lowerBound for dataset names, retrieve at most
* maxDataSets dataset names coming striclty after lowerBound
* from the DataStore, for a given level and container name.
* Returns the number of dataset names actually retrieved
*
* @param level Level of nesting
* @param containerName Name of the container in which to search
* @param lowerBound Lower bound name to search for
* @param keys Resulting vector of dataset names
* @param maxDataSets Maximum number of datasets to retrieve.
*
* @return The actual number of dataset names retrieved.
*/
size_t nextKeys(uint8_t level, const std::string& containerName,
const std::string& lowerBound,
std::vector<std::string>& keys, size_t maxDataSets) const;
};
class DataStore::const_iterator {
friend class DataStore::Impl;
friend class DataStore;
friend class DataSet;
protected:
/**
......@@ -278,6 +226,7 @@ class DataStore::const_iterator {
class Impl;
std::unique_ptr<Impl> m_impl; /*!< Pointer to implementation */
public:
/**
* @brief Constructor. Creates a const_iterator pointing
* to an invalid DataSet.
......@@ -300,8 +249,6 @@ class DataStore::const_iterator {
*/
const_iterator(DataSet&& current);
public:
typedef const_iterator self_type;
typedef DataSet value_type;
typedef DataSet& reference;
......@@ -404,11 +351,7 @@ class DataStore::const_iterator {
class DataStore::iterator : public DataStore::const_iterator {
friend class DataStore::Impl;
friend class DataStore;
friend class DataSet;
private:
public:
/**
* @brief Constructor. Builds an iterator pointing to an
......@@ -434,8 +377,6 @@ class DataStore::iterator : public DataStore::const_iterator {
*/
iterator(DataSet&& current);
public:
typedef iterator self_type;
typedef DataSet value_type;
typedef DataSet& reference;
......
......@@ -21,13 +21,14 @@ target_link_libraries (hepnos mercury margo yaml-cpp sdskv-client bake-client ch
target_include_directories (hepnos PUBLIC $<INSTALL_INTERFACE:include>)
# local include's BEFORE, in case old incompatable .h files in prefix/include
#target_include_directories (hepnos BEFORE PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
include_directories (hepnos ${CMAKE_CURRENT_SOURCE_DIR}/private)
target_include_directories (hepnos BEFORE PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>)
# for shared libs, establish the lib version
#set_target_properties (hepnos
# PROPERTIES VERSION ${HEPNOS_VERSION}
# SOVERSION ${HEPNOS_VERSION_MAJOR})
set_target_properties (hepnos
PROPERTIES VERSION ${HEPNOS_VERSION}
SOVERSION ${HEPNOS_VERSION_MAJOR})
#
# installation stuff (packaging and install commands)
......
#include "hepnos/DataSet.hpp"
#include "private/DataStoreImpl.hpp"
namespace hepnos {
......@@ -54,7 +55,7 @@ DataSet DataSet::next() const {
if(!valid()) return DataSet();
std::vector<std::string> keys;
size_t s = m_impl->m_datastore->nextKeys(
size_t s = m_impl->m_datastore->m_impl->nextKeys(
m_impl->m_level, m_impl->m_container, m_impl->m_name, keys, 1);
if(s == 0) return DataSet();
return DataSet(m_impl->m_datastore, m_impl->m_level, m_impl->m_container, keys[0]);
......@@ -70,7 +71,7 @@ bool DataSet::storeBuffer(const std::string& key, const std::vector<char>& buffe
throw Exception("Calling store() on invalid DataSet");
}
// forward the call to the datastore's store function
return m_impl->m_datastore->store(0, fullname(), key, buffer);
return m_impl->m_datastore->m_impl->store(0, fullname(), key, buffer);
}
bool DataSet::loadBuffer(const std::string& key, std::vector<char>& buffer) const {
......@@ -78,7 +79,7 @@ bool DataSet::loadBuffer(const std::string& key, std::vector<char>& buffer) cons
throw Exception("Calling load() on invalid DataSet");
}
// forward the call to the datastore's load function
return m_impl->m_datastore->load(0, fullname(), key, buffer);
return m_impl->m_datastore->m_impl->load(0, fullname(), key, buffer);
}
bool DataSet::operator==(const DataSet& other) const {
......@@ -113,7 +114,7 @@ DataSet DataSet::createDataSet(const std::string& name) {
throw Exception("Invalid character '/' in dataset name");
}
std::string parent = fullname();
m_impl->m_datastore->store(m_impl->m_level+1, parent, name, std::vector<char>());
m_impl->m_datastore->m_impl->store(m_impl->m_level+1, parent, name, std::vector<char>());
return DataSet(m_impl->m_datastore, m_impl->m_level+1, parent, name);
}
......@@ -129,7 +130,7 @@ DataSet::iterator DataSet::find(const std::string& datasetName) {
}
std::vector<char> data;
std::string parent = fullname();
bool b = m_impl->m_datastore->load(m_impl->m_level+1, parent, datasetName, data);
bool b = m_impl->m_datastore->m_impl->load(m_impl->m_level+1, parent, datasetName, data);
if(!b) {
return m_impl->m_datastore->end();
}
......
This diff is collapsed.
This diff is collapsed.
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