Skip to content

Commit

Permalink
tiny changes in RegisterBase
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed May 21, 2024
1 parent 2434e5c commit 24dba35
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/RegisterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const Content & RegisterBase<Content>::get(const std::vector<void*> & images,con
auto qualified_key=imageToString(*image) + ":" + key;
if(m.count(qualified_key)>0) return m.find(qualified_key)->second->content;
}
plumed_assert(m.count(key)>0);
plumed_assert(m.count(key)>0) << ", Missing key: \"" << key<<"\"";
return m.find(key)->second->content;
}

Expand All @@ -220,15 +220,15 @@ const std::string & RegisterBase<Content>::getFullPath(const std::vector<void*>
auto qualified_key=imageToString(*image) + ":" + key;
if(m.count(qualified_key)>0) return m.find(qualified_key)->second->fullPath;
}
plumed_assert(m.count(key)>0);
plumed_assert(m.count(key)>0) << ", Missing key: \"" << key<<"\"";
return m.find(key)->second->fullPath;
}

template<class Content>
const Content & RegisterBase<Content>::get(const std::string & key) const {
// lock map for reading
std::shared_lock<std::shared_mutex> lock(mutex);
plumed_assert(m.count(key)>0);
plumed_assert(m.count(key)>0) << ", Missing key: \"" << key<<"\"";
return m.find(key)->second->content;
}

Expand Down Expand Up @@ -288,5 +288,3 @@ void RegisterBase<Content>::clearStaged() noexcept {
}

#endif


0 comments on commit 24dba35

Please sign in to comment.