Commit c350d83f authored by Matthieu Dorier's avatar Matthieu Dorier

can create datasets inside datasets now

parent c71d3a17
......@@ -242,6 +242,23 @@ class DataSet {
* entry in the HEPnOS service, true otherwise.
*/
bool operator!=(const DataSet& other) const;
/**
* @brief Creates a dataset with a given name inside the
* DataSet. This name must not have the '/' and '#' characters.
* A DataSet object pointing to the created dataset is returned.
* If a dataset with this name already exists in the DataStore,
* it is not created, but a DataSet object pointing to the
* existing one is returned instead.
*
* @param name Name of DataSet.
*
* @return A DataSet instance pointing to the created dataset.
*/
DataSet createDataSet(const std::string& name);
typedef DataStore::const_iterator const_dataset_iterator;
typedef DataStore::iterator dataset_iterator;
};
}
......
......@@ -108,6 +108,11 @@ std::string DataSet::fullname() const {
return ss.str();
}
DataSet DataSet::createDataSet(const std::string& name) {
if(name.find('/') != std::string::npos) {
throw Exception("Invalid character '/' in dataset name");
}
m_impl->m_datastore->store(m_impl->m_level+1, fullname(), name, std::vector<char>());
}
}
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