CASM  1.1.0
A Clusters Approach to Statistical Mechanics
PropertiesDatabase.cc
Go to the documentation of this file.
2 
4 
5 namespace CASM {
6 namespace DB {
9  const std::string &origin_A, const std::string &origin_B) const {
10  if (origin_A == origin_B) {
11  return false;
12  }
13  return m_score(*m_map->find_via_origin(origin_A)) <
14  m_score(*m_map->find_via_origin(origin_B));
15 }
16 
18 std::pair<PropertiesDatabase::iterator, bool> PropertiesDatabase::insert(
19  const MappedProperties &value) {
20  // insert data
21  auto res = _insert(value);
22  if (!res.second) {
23  return res;
24  }
25 
26  // insert 'to' -> 'origin' link
27  auto tset = all_origins(value.to);
28  tset.insert(value.origin);
29  _set_all_origins(value.to, tset);
30 
31  return res;
32 }
33 
36  auto tset = all_origins(pos->to);
37  tset.erase(pos->origin);
38  _set_all_origins(pos->to, tset);
39 
40  return _erase(pos);
41 }
42 
43 } // namespace DB
44 } // namespace CASM
bool operator()(const std::string &origin_A, const std::string &origin_B) const
Compare mapped properties 'origin_A' and 'origin_B', preferring self-mapped results.
virtual std::set< std::string, Compare > all_origins(std::string to_configname) const =0
Names of all configurations that relaxed 'origin'->'to'.
virtual std::pair< iterator, bool > _insert(const MappedProperties &value)=0
Private _insert MappedProperties, without modifying 'relaxed_from'.
virtual void _set_all_origins(std::string to_configname, const std::set< std::string, Compare > &_set)=0
Set sorted container of names of all configurations that relaxed 'from'->'to'.
virtual iterator find_via_origin(std::string origin) const =0
Return iterator to data entry that is from the specified origin.
std::pair< iterator, bool > insert(const MappedProperties &value)
Insert data.
iterator erase(iterator pos)
Erase data.
virtual iterator _erase(iterator pos)=0
Private _erase MappedProperties, without modifying 'relaxed_from'.
Wrapper class for specializations PropertiesDatabaseIteratorBase.
Main CASM namespace.
Definition: APICommand.hh:8