Commit fe9485cf authored by Matthieu Dorier's avatar Matthieu Dorier

replaced internal classes for implementation with external ones

parent 5c651736
......@@ -28,21 +28,20 @@ class DataSet : public KeyValueContainer {
friend class DataStore;
friend class RunSet;
friend class DataSetImpl;
private:
/**
* @brief Implementation class (used for the Pimpl idiom).
*/
class Impl;
std::shared_ptr<Impl> m_impl; /*!< Pointer to implementation. */
std::shared_ptr<DataSetImpl> m_impl; /*!< Pointer to implementation. */
/**
* @brief Constructor.
*/
DataSet(const std::shared_ptr<Impl>& impl);
DataSet(std::shared_ptr<Impl>&& impl);
DataSet(const std::shared_ptr<DataSetImpl>& impl);
DataSet(std::shared_ptr<DataSetImpl>&& impl);
public:
......
......@@ -18,6 +18,12 @@ class RunSet;
class Run;
class SubRun;
class Event;
class DataStoreImpl;
class DataSetImpl;
class RunSetImpl;
class RunImpl;
class SubRunImpl;
class EventImpl;
template<typename T, typename C = std::vector<T>> class Ptr;
class WriteBatch;
......@@ -34,6 +40,7 @@ class DataStore {
friend class SubRun;
friend class Event;
friend class WriteBatch;
friend class DataStoreImpl;
public:
......@@ -334,16 +341,15 @@ class DataStore {
/**
* @brief Implementation of the class (using Pimpl idiom)
*/
class Impl;
std::shared_ptr<Impl> m_impl; /*!< Pointer to implementation */
std::shared_ptr<DataStoreImpl> m_impl; /*!< Pointer to implementation */
/**
* @brief Constructor from a pointer to implementation.
*
* @param impl
*/
DataStore(std::shared_ptr<Impl>&& impl);
DataStore(const std::shared_ptr<Impl>& impl);
DataStore(std::shared_ptr<DataStoreImpl>&& impl);
DataStore(const std::shared_ptr<DataStoreImpl>& impl);
/**
* @brief Loads the raw data corresponding to a product.
......
......@@ -21,14 +21,13 @@ class Event : public KeyValueContainer {
friend class SubRun;
class Impl;
std::shared_ptr<Impl> m_impl;
std::shared_ptr<EventImpl> m_impl;
/**
* @brief Constructor.
*/
Event(std::shared_ptr<Impl>&& impl);
Event(const std::shared_ptr<Impl>& impl);
Event(std::shared_ptr<EventImpl>&& impl);
Event(const std::shared_ptr<EventImpl>& impl);
public:
......
......@@ -20,6 +20,7 @@ class DataStore;
class ProductID {
friend class DataStore;
friend class DataStoreImpl;
friend class WriteBatch;
friend class boost::serialization::access;
......
......@@ -25,14 +25,13 @@ class Run : public KeyValueContainer {
friend class RunSet;
friend class DataSet;
class Impl;
std::shared_ptr<Impl> m_impl;
std::shared_ptr<RunImpl> m_impl;
/**
* @brief Constructor.
*/
Run(const std::shared_ptr<Impl>& impl);
Run(std::shared_ptr<Impl>&& impl);
Run(const std::shared_ptr<RunImpl>& impl);
Run(std::shared_ptr<RunImpl>&& impl);
public:
......
......@@ -28,15 +28,14 @@ class RunSet {
/**
* @brief Implementation class (used for the Pimpl idiom).
*/
using Impl = DataSet::Impl;
std::shared_ptr<Impl> m_impl; /*!< Pointer to implementation. */
using RunSetImpl = DataSetImpl;
std::shared_ptr<RunSetImpl> m_impl; /*!< Pointer to implementation. */
/**
* @brief Constructor.
*/
RunSet(const std::shared_ptr<Impl>& impl);
RunSet(std::shared_ptr<Impl>&& impl);
RunSet(const std::shared_ptr<RunSetImpl>& impl);
RunSet(std::shared_ptr<RunSetImpl>&& impl);
public:
......
......@@ -22,14 +22,13 @@ class SubRun : public KeyValueContainer {
friend class Run;
class Impl;
std::shared_ptr<Impl> m_impl;
std::shared_ptr<SubRunImpl> m_impl;
/**
* @brief Constructor.
*/
SubRun(std::shared_ptr<Impl>&& impl);
SubRun(const std::shared_ptr<Impl>& impl);
SubRun(std::shared_ptr<SubRunImpl>&& impl);
SubRun(const std::shared_ptr<SubRunImpl>& impl);
public:
......
......@@ -14,12 +14,12 @@
namespace hepnos {
DataSet::DataSet()
: m_impl(std::make_shared<DataSet::Impl>(nullptr, 0, std::make_shared<std::string>(""), "")) {}
: m_impl(std::make_shared<DataSetImpl>(nullptr, 0, std::make_shared<std::string>(""), "")) {}
DataSet::DataSet(const std::shared_ptr<DataSet::Impl>& impl)
DataSet::DataSet(const std::shared_ptr<DataSetImpl>& impl)
: m_impl(impl) {}
DataSet::DataSet(std::shared_ptr<DataSet::Impl>&& impl)
DataSet::DataSet(std::shared_ptr<DataSetImpl>&& impl)
: m_impl(std::move(impl)) {}
DataStore DataSet::datastore() const {
......@@ -36,7 +36,7 @@ DataSet DataSet::next() const {
size_t s = m_impl->m_datastore->nextKeys(
m_impl->m_level, *m_impl->m_container, m_impl->m_name, keys, 1);
if(s == 0) return DataSet();
return DataSet(std::make_shared<Impl>(m_impl->m_datastore, m_impl->m_level, keys[0]));
return DataSet(std::make_shared<DataSetImpl>(m_impl->m_datastore, m_impl->m_level, keys[0]));
}
bool DataSet::valid() const {
......@@ -120,7 +120,7 @@ DataSet DataSet::createDataSet(const std::string& name) {
}
std::string parent = fullname();
m_impl->m_datastore->store(m_impl->m_level+1, parent, name);
return DataSet(std::make_shared<Impl>(
return DataSet(std::make_shared<DataSetImpl>(
m_impl->m_datastore, m_impl->m_level+1,
std::make_shared<std::string>(parent), name));
}
......@@ -133,7 +133,7 @@ Run DataSet::createRun(const RunNumber& runNumber) {
std::string runStr = makeKeyStringFromNumber(runNumber);
m_impl->m_datastore->store(m_impl->m_level+1, parent, runStr);
return Run(
std::make_shared<Run::Impl>(
std::make_shared<RunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
std::make_shared<std::string>(parent), runNumber));
}
......@@ -146,7 +146,7 @@ Run DataSet::createRun(WriteBatch& batch, const RunNumber& runNumber) {
std::string runStr = makeKeyStringFromNumber(runNumber);
batch.m_impl->store(m_impl->m_level+1, parent, runStr);
return Run(
std::make_shared<Run::Impl>(
std::make_shared<RunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
std::make_shared<std::string>(parent), runNumber));
}
......@@ -196,7 +196,7 @@ DataSet::iterator DataSet::find(const std::string& datasetPath) {
}
return iterator(
DataSet(
std::make_shared<Impl>(
std::make_shared<DataSetImpl>(
m_impl->m_datastore,
level,
std::make_shared<std::string>(containerName),
......@@ -215,7 +215,7 @@ DataSet::iterator DataSet::begin() {
// we use the prefix "&" because we need something that comes after "%"
// (which represents runs) and is not going to be in a dataset name
DataSet ds(
std::make_shared<Impl>(
std::make_shared<DataSetImpl>(
m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(fullname()),
......@@ -269,7 +269,7 @@ DataSet::iterator DataSet::lower_bound(const std::string& lb) {
return it;
}
DataSet ds(
std::make_shared<Impl>(
std::make_shared<DataSetImpl>(
m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(fullname()),
......@@ -290,7 +290,7 @@ DataSet::iterator DataSet::upper_bound(const std::string& ub) {
throw Exception("Calling DataSet member function on an invalid DataSet");
}
DataSet ds(
std::make_shared<Impl>(
std::make_shared<DataSetImpl>(
m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(fullname()), ub));
......
......@@ -12,16 +12,16 @@
namespace hepnos {
class DataSet::Impl {
class DataSetImpl {
public:
std::shared_ptr<DataStore::Impl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_container;
std::string m_name;
std::shared_ptr<DataStoreImpl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_container;
std::string m_name;
Impl(const std::shared_ptr<DataStore::Impl>& ds,
DataSetImpl(const std::shared_ptr<DataStoreImpl>& ds,
uint8_t level,
const std::shared_ptr<std::string>& container,
const std::string& name)
......@@ -30,7 +30,7 @@ class DataSet::Impl {
, m_container(container)
, m_name(name) {}
Impl(const std::shared_ptr<DataStore::Impl>& ds,
DataSetImpl(const std::shared_ptr<DataStoreImpl>& ds,
uint8_t level,
const std::string& fullname)
: m_datastore(ds)
......
......@@ -20,10 +20,10 @@ namespace hepnos {
// DataStore implementation
////////////////////////////////////////////////////////////////////////////////////////////
DataStore::DataStore(std::shared_ptr<Impl>&& impl)
DataStore::DataStore(std::shared_ptr<DataStoreImpl>&& impl)
: m_impl(std::move(impl)) {}
DataStore::DataStore(const std::shared_ptr<Impl>& impl)
DataStore::DataStore(const std::shared_ptr<DataStoreImpl>& impl)
: m_impl(impl) {}
bool DataStore::valid() const {
......@@ -35,13 +35,13 @@ DataStore DataStore::connect() {
if(file == nullptr)
throw Exception("HEPNOS_CONFIG_FILE environment variable not set");
std::string configFile(file);
auto impl = std::make_shared<Impl>();
auto impl = std::make_shared<DataStoreImpl>();
impl->init(configFile);
return DataStore(std::move(impl));
}
DataStore DataStore::connect(const std::string& configFile) {
auto impl = std::make_shared<Impl>();
auto impl = std::make_shared<DataStoreImpl>();
impl->init(configFile);
return DataStore(std::move(impl));
}
......@@ -78,7 +78,7 @@ DataStore::iterator DataStore::find(const std::string& datasetPath) {
}
return iterator(
DataSet(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, level, std::make_shared<std::string>(containerName), datasetName)));
}
......@@ -99,7 +99,7 @@ DataStore::iterator DataStore::begin() {
throw Exception("Calling DataStore member function on an invalid DataStore object");
}
DataSet ds(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, 1, std::make_shared<std::string>(""), ""));
ds = ds.next();
if(ds.valid()) return iterator(std::move(ds));
......@@ -144,7 +144,7 @@ DataStore::iterator DataStore::lower_bound(const std::string& lb) {
return it;
}
DataSet ds(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, 1, std::make_shared<std::string>(""), lb2));
ds = ds.next();
if(!ds.valid()) return end();
......@@ -161,7 +161,7 @@ DataStore::iterator DataStore::upper_bound(const std::string& ub) {
throw Exception("Calling DataStore member function on an invalid DataStore object");
}
DataSet ds(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, 1, std::make_shared<std::string>(""), ub));
ds = ds.next();
if(!ds.valid()) return end();
......@@ -183,7 +183,7 @@ DataSet DataStore::createDataSet(const std::string& name) {
}
m_impl->store(1, "", name);
return DataSet(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, 1, std::make_shared<std::string>(""), name));
}
......@@ -197,7 +197,7 @@ DataSet DataStore::createDataSet(WriteBatch& batch, const std::string& name) {
}
batch.m_impl->store(1, "", name);
return DataSet(
std::make_shared<DataSet::Impl>(
std::make_shared<DataSetImpl>(
m_impl, 1, std::make_shared<std::string>(""), name));
}
......
......@@ -22,10 +22,10 @@
namespace hepnos {
////////////////////////////////////////////////////////////////////////////////////////////
// DataStore::Impl implementation
// DataStoreImpl implementation
////////////////////////////////////////////////////////////////////////////////////////////
class DataStore::Impl {
class DataStoreImpl {
public:
margo_instance_id m_mid; // Margo instance
......@@ -35,7 +35,7 @@ class DataStore::Impl {
struct ch_placement_instance* m_chi_sdskv; // ch-placement instance for SDSKV
const DataStore::iterator m_end; // iterator for the end() of the DataStore
Impl()
DataStoreImpl()
: m_mid(MARGO_INSTANCE_NULL)
, m_chi_sdskv(nullptr)
, m_end() {}
......
......@@ -11,13 +11,13 @@
namespace hepnos {
Event::Event()
: m_impl(std::make_shared<Impl>(nullptr, 0, std::make_shared<std::string>(""),
: m_impl(std::make_shared<EventImpl>(nullptr, 0, std::make_shared<std::string>(""),
InvalidRunNumber, InvalidSubRunNumber, InvalidEventNumber)) {}
Event::Event(std::shared_ptr<Impl>&& impl)
Event::Event(std::shared_ptr<EventImpl>&& impl)
: m_impl(std::move(impl)) { }
Event::Event(const std::shared_ptr<Impl>& impl)
Event::Event(const std::shared_ptr<EventImpl>& impl)
: m_impl(impl) { }
DataStore Event::datastore() const {
......@@ -40,7 +40,7 @@ Event Event::next() const {
if(keys[0].size() <= i) return Event();
EventNumber n = parseNumberFromKeyString<EventNumber>(&keys[0][i]);
if(n == InvalidEventNumber) return Event();
return Event(std::make_shared<Impl>(m_impl->m_datastore,
return Event(std::make_shared<EventImpl>(m_impl->m_datastore,
m_impl->m_level, m_impl->m_dataset_name,
m_impl->m_run_number, m_impl->m_subrun_number, n));
}
......
......@@ -18,18 +18,18 @@
namespace hepnos {
class Event::Impl {
class EventImpl {
public:
std::shared_ptr<DataStore::Impl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
SubRunNumber m_subrun_number;
EventNumber m_event_number;
std::shared_ptr<DataStoreImpl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
SubRunNumber m_subrun_number;
EventNumber m_event_number;
Impl(const std::shared_ptr<DataStore::Impl>& ds,
EventImpl(const std::shared_ptr<DataStoreImpl>& ds,
uint8_t level,
const std::shared_ptr<std::string>& dataset,
const RunNumber& rn,
......
......@@ -11,15 +11,15 @@
namespace hepnos {
Run::iterator Run::Impl::m_end;
Run::iterator RunImpl::m_end;
Run::Run()
: m_impl(std::make_shared<Impl>(nullptr, 0, std::make_shared<std::string>(""), InvalidRunNumber)) {}
: m_impl(std::make_shared<RunImpl>(nullptr, 0, std::make_shared<std::string>(""), InvalidRunNumber)) {}
Run::Run(std::shared_ptr<Impl>&& impl)
Run::Run(std::shared_ptr<RunImpl>&& impl)
: m_impl(std::move(impl)) { }
Run::Run(const std::shared_ptr<Impl>& impl)
Run::Run(const std::shared_ptr<RunImpl>& impl)
: m_impl(impl) { }
DataStore Run::datastore() const {
......@@ -41,7 +41,7 @@ Run Run::next() const {
if(keys[0].size() <= i) return Run();
RunNumber rn = parseNumberFromKeyString<RunNumber>(&keys[0][i]);
if(rn == InvalidRunNumber) return Run();
return Run(std::make_shared<Impl>(
return Run(std::make_shared<RunImpl>(
m_impl->m_datastore,
m_impl->m_level,
m_impl->m_dataset_name,
......@@ -123,7 +123,7 @@ SubRun Run::createSubRun(const SubRunNumber& subRunNumber) {
std::string parent = m_impl->fullpath();
std::string subRunStr = makeKeyStringFromNumber(subRunNumber);
m_impl->m_datastore->store(m_impl->m_level+1, parent, subRunStr);
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, subRunNumber);
return SubRun(std::move(new_subrun_impl));
......@@ -136,7 +136,7 @@ SubRun Run::createSubRun(WriteBatch& batch, const SubRunNumber& subRunNumber) {
std::string parent = m_impl->fullpath();
std::string subRunStr = makeKeyStringFromNumber(subRunNumber);
batch.m_impl->store(m_impl->m_level+1, parent, subRunStr);
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, subRunNumber);
return SubRun(std::move(new_subrun_impl));
......@@ -160,7 +160,7 @@ Run::iterator Run::find(const SubRunNumber& subRunNumber) {
if(!b) {
return m_impl->m_end;
}
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, subRunNumber);
return iterator(SubRun(std::move(new_subrun_impl)));
......@@ -175,7 +175,7 @@ Run::iterator Run::begin() {
auto it = find(0);
if(it != end()) return *it;
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, 0);
......@@ -221,7 +221,7 @@ Run::iterator Run::lower_bound(const SubRunNumber& lb) {
if(it != end()) {
return it;
} else {
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, 0);
SubRun subrun(std::move(new_subrun_impl));
......@@ -235,7 +235,7 @@ Run::iterator Run::lower_bound(const SubRunNumber& lb) {
++it;
return it;
}
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, lb-1);
SubRun subrun(std::move(new_subrun_impl));
......@@ -254,7 +254,7 @@ Run::iterator Run::upper_bound(const SubRunNumber& ub) {
if(!valid()) {
throw Exception("Calling Run member function on an invalid Run object");
}
auto new_subrun_impl = std::make_shared<SubRun::Impl>(
auto new_subrun_impl = std::make_shared<SubRunImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, ub);
SubRun subrun(std::move(new_subrun_impl));
......
......@@ -15,18 +15,18 @@
namespace hepnos {
class Run::Impl {
class RunImpl {
public:
std::shared_ptr<DataStore::Impl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
std::shared_ptr<DataStoreImpl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
static iterator m_end;
static Run::iterator m_end;
Impl(const std::shared_ptr<DataStore::Impl>& ds,
RunImpl(const std::shared_ptr<DataStoreImpl>& ds,
uint8_t level,
const std::shared_ptr<std::string>& dataset,
const RunNumber& rn)
......
......@@ -20,10 +20,10 @@ namespace hepnos {
static RunSet::iterator RunSet_end;
RunSet::RunSet(const std::shared_ptr<Impl>& impl)
RunSet::RunSet(const std::shared_ptr<RunSetImpl>& impl)
: m_impl(impl) {}
RunSet::RunSet(std::shared_ptr<Impl>&& impl)
RunSet::RunSet(std::shared_ptr<RunSetImpl>&& impl)
: m_impl(std::move(impl)) {}
Run RunSet::operator[](const RunNumber& runNumber) {
......@@ -46,7 +46,7 @@ RunSet::iterator RunSet::find(const RunNumber& runNumber) {
bool b = datastore->exists(level+1, parent, strNum);
if(!b) return end();
return iterator(
std::make_shared<Run::Impl>(
std::make_shared<RunImpl>(
datastore,
level+1,
std::make_shared<std::string>(parent),
......@@ -65,7 +65,7 @@ RunSet::iterator RunSet::begin() {
auto ds_level = m_impl->m_level;
auto datastore = m_impl->m_datastore;
std::string container = m_impl->fullname();
auto new_run_impl = std::make_shared<Run::Impl>(datastore,
auto new_run_impl = std::make_shared<RunImpl>(datastore,
ds_level+1, std::make_shared<std::string>(container), 0);
Run run(std::move(new_run_impl));
run = run.next();
......@@ -100,7 +100,7 @@ RunSet::iterator RunSet::lower_bound(const RunNumber& lb) {
if(it != end()) {
return it;
} else {
Run run(std::make_shared<Run::Impl>(
Run run(std::make_shared<RunImpl>(
m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(m_impl->fullname()), 0));
......@@ -114,7 +114,7 @@ RunSet::iterator RunSet::lower_bound(const RunNumber& lb) {
++it;
return it;
}
Run run(std::make_shared<Run::Impl>(
Run run(std::make_shared<RunImpl>(
m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(m_impl->fullname()), lb-1));
......@@ -130,7 +130,7 @@ RunSet::const_iterator RunSet::lower_bound(const RunNumber& lb) const {
}
RunSet::iterator RunSet::upper_bound(const RunNumber& ub) {
Run run(std::make_shared<Run::Impl>(m_impl->m_datastore,
Run run(std::make_shared<RunImpl>(m_impl->m_datastore,
m_impl->m_level+1,
std::make_shared<std::string>(m_impl->fullname()), ub));
run = run.next();
......
......@@ -13,15 +13,15 @@
namespace hepnos {
SubRun::iterator SubRun::Impl::m_end;
SubRun::iterator SubRunImpl::m_end;
SubRun::SubRun()
: m_impl(std::make_shared<Impl>(nullptr, 0, std::make_shared<std::string>(""), InvalidRunNumber, InvalidSubRunNumber)) {}
: m_impl(std::make_shared<SubRunImpl>(nullptr, 0, std::make_shared<std::string>(""), InvalidRunNumber, InvalidSubRunNumber)) {}
SubRun::SubRun(std::shared_ptr<Impl>&& impl)
SubRun::SubRun(std::shared_ptr<SubRunImpl>&& impl)
: m_impl(std::move(impl)) { }
SubRun::SubRun(const std::shared_ptr<Impl>& impl)
SubRun::SubRun(const std::shared_ptr<SubRunImpl>& impl)
: m_impl(impl) { }
DataStore SubRun::datastore() const {
......@@ -44,7 +44,7 @@ SubRun SubRun::next() const {
if(keys[0].size() <= i) return SubRun();
SubRunNumber srn = parseNumberFromKeyString<SubRunNumber>(&keys[0][i]);
if(srn == InvalidSubRunNumber) return SubRun();
auto new_subrun_impl = std::make_shared<Impl>(m_impl->m_datastore, m_impl->m_level,
auto new_subrun_impl = std::make_shared<SubRunImpl>(m_impl->m_datastore, m_impl->m_level,
m_impl->m_dataset_name, m_impl->m_run_number, srn);
return SubRun(std::move(new_subrun_impl));
}
......@@ -114,7 +114,7 @@ Event SubRun::createEvent(const EventNumber& eventNumber) {
std::string parent = m_impl->fullpath();
std::string eventStr = makeKeyStringFromNumber(eventNumber);
m_impl->m_datastore->store(m_impl->m_level+1, parent, eventStr);
return Event(std::make_shared<Event::Impl>(m_impl->m_datastore, m_impl->m_level+1,
return Event(std::make_shared<EventImpl>(m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, m_impl->m_subrun_number, eventNumber));
}
......@@ -125,7 +125,7 @@ Event SubRun::createEvent(WriteBatch& batch, const EventNumber& eventNumber) {
std::string parent = m_impl->fullpath();
std::string eventStr = makeKeyStringFromNumber(eventNumber);
batch.m_impl->store(m_impl->m_level+1, parent, eventStr);
return Event(std::make_shared<Event::Impl>(m_impl->m_datastore, m_impl->m_level+1,
return Event(std::make_shared<EventImpl>(m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, m_impl->m_subrun_number, eventNumber));
}
......@@ -147,7 +147,7 @@ SubRun::iterator SubRun::find(const EventNumber& eventNumber) {
if(!b) {
return m_impl->m_end;
}
return iterator(Event(std::make_shared<Event::Impl>(
return iterator(Event(std::make_shared<EventImpl>(
m_impl->m_datastore, m_impl->m_level+1,
m_impl->m_dataset_name, m_impl->m_run_number, m_impl->m_subrun_number, eventNumber)));
}
......@@ -164,7 +164,7 @@ SubRun::iterator SubRun::begin() {
auto level = m_impl->m_level;
auto datastore = m_impl->m_datastore;
std::string container = m_impl->fullpath();
Event event(std::make_shared<Event::Impl>(datastore,
Event event(std::make_shared<EventImpl>(datastore,
level+1, m_impl->m_dataset_name, m_impl->m_run_number, m_impl->m_subrun_number, 0));
event = event.next();
......@@ -207,7 +207,7 @@ SubRun::iterator SubRun::lower_bound(const EventNumber& lb) {
if(it != end()) {
return it;
} else {
Event event(std::make_shared<Event::Impl>(m_impl->m_datastore,
Event event(std::make_shared<EventImpl>(m_impl->m_datastore,
m_impl->m_level+1, m_impl->m_dataset_name,
m_impl->m_run_number, m_impl->m_subrun_number, 0));
event = event.next();
......@@ -220,7 +220,7 @@ SubRun::iterator SubRun::lower_bound(const EventNumber& lb) {
++it;
return it;
}
Event event(std::make_shared<Event::Impl>(m_impl->m_datastore,
Event event(std::make_shared<EventImpl>(m_impl->m_datastore,
m_impl->m_level+1, m_impl->m_dataset_name,
m_impl->m_run_number, m_impl->m_subrun_number, lb-1));
event = event.next();
......@@ -238,7 +238,7 @@ SubRun::iterator SubRun::upper_bound(const EventNumber& ub) {
if(!valid()) {
throw Exception("Calling SubRun member function on invalid SubRun object");
}
Event event(std::make_shared<Event::Impl>(m_impl->m_datastore,
Event event(std::make_shared<EventImpl>(m_impl->m_datastore,
m_impl->m_level+1, m_impl->m_dataset_name,
m_impl->m_run_number, m_impl->m_subrun_number, ub));
event = event.next();
......
......@@ -16,19 +16,19 @@
namespace hepnos {
class SubRun::Impl {
class SubRunImpl {
public:
std::shared_ptr<DataStore::Impl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
SubRunNumber m_subrun_number;
std::shared_ptr<DataStoreImpl> m_datastore;
uint8_t m_level;
std::shared_ptr<std::string> m_dataset_name;
RunNumber m_run_number;
SubRunNumber m_subrun_number;
static iterator m_end;
static SubRun::iterator m_end;