Commit a3b5ce99 by Maarten L. Hekkelman

loading extra compound info changed

cif::file constructors
parent 9eb06e92
......@@ -100,10 +100,22 @@ class file : public std::list<datablock>
}
/** @cond */
file(const file &) = default;
file(file &&) = default;
file &operator=(const file &) = default;
file &operator=(file &&) = default;
file(const file &rhs)
: std::list<datablock>(rhs)
{
}
file(file &&rhs)
{
this->swap(rhs);
}
file &operator=(file f)
{
this->swap(f);
return *this;
}
/** @endcond */
/**
......
......@@ -49,7 +49,7 @@ namespace cif
/**
* @brief Implementation of an iterator that can return
* multiple values in a tuple. Of course, that tuple can
* then used in structured binding to receive the values
* then be used in structured binding to receive the values
* in a for loop e.g.
*
* @tparam Category The category for this iterator
......
......@@ -550,7 +550,7 @@ class local_compound_factory_impl : public compound_factory_impl
compound *create(const std::string &id) override;
private:
const cif::file &m_local_file;
cif::file m_local_file;
};
compound *local_compound_factory_impl::create(const std::string &id)
......@@ -559,11 +559,19 @@ compound *local_compound_factory_impl::create(const std::string &id)
for (auto &db : m_local_file)
{
if (db.name() == "comp_" + id)
if (db.name() == id)
{
cif::datablock db_copy(db);
result = new compound(db_copy, 1);
try
{
result = new compound(db_copy, 1);
}
catch (const std::exception &ex)
{
std::throw_with_nested(std::runtime_error("Error loading compound " + id));
}
std::shared_lock lock(mMutex);
m_compounds.push_back(result);
......
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