1 #ifndef CASM_PropertiesDatabase
2 #define CASM_PropertiesDatabase
4 #include <boost/iterator/iterator_facade.hpp>
12 struct MappedProperties;
16 class PropertiesDatabaseIterator;
62 std::unique_ptr<PropertiesDatabaseIteratorBase>
clone()
const {
63 return std::unique_ptr<PropertiesDatabaseIteratorBase>(this->
_clone());
115 public boost::iterator_facade<PropertiesDatabaseIterator, MappedProperties,
116 std::forward_iterator_tag,
117 const MappedProperties &, long> {
129 friend boost::iterator_core_access;
204 const std::string &origin_B)
const;
259 double score(std::string origin)
const {
294 const std::set<std::string, Compare> &_set) = 0;
Fully generic database interface for use by DatabaseHandler.
Compare type for std::set<std::string, Compare>, which sorts to determine the 'origin' configname for...
const PropertiesDatabase * m_map
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.
const ScoreMappedProperties & score_method() const
Compare(const PropertiesDatabase *_map, std::string _to_configname, const ScoreMappedProperties &_score)
ScoreMappedProperties m_score
virtual std::set< std::string, Compare > all_origins(std::string to_configname) const =0
Names of all configurations that relaxed 'origin'->'to'.
MappedProperties value_type
double best_score(std::string to_configname) const
Best score of configurations that relaxed 'origin'->'to'.
PropertiesDatabaseIterator iterator
virtual std::pair< iterator, bool > _insert(const MappedProperties &value)=0
Private _insert MappedProperties, without modifying 'relaxed_from'.
size_type erase_via_origin(std::string origin)
Erase data.
virtual iterator begin() const =0
Begin iterator over data entries.
PropertiesDatabase(const PrimClex &_primclex)
virtual iterator end() const =0
End iterator over data entries.
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'.
double score(const MappedProperties &value) const
Score mapping 'from'->'to'.
double score(std::string origin) const
Score mapping 'origin'->'to'.
virtual iterator find_via_to(std::string to_configname) const =0
Return iterator to data entry that is the best mapping to specified config.
virtual iterator find_via_origin(std::string origin) const =0
Return iterator to data entry that is from the specified origin.
virtual void set_score_method(std::string to_configname, const ScoreMappedProperties &score)=0
Change the score method for a single configuration.
std::pair< iterator, bool > insert(const MappedProperties &value)
Insert data.
ScoreMappedProperties score_method(std::string to_configname) const
Name of ScoreMappedProperties method.
virtual size_type size() const =0
iterator erase(iterator pos)
Erase data.
virtual iterator _erase(iterator pos)=0
Private _erase MappedProperties, without modifying 'relaxed_from'.
virtual ~PropertiesDatabaseIteratorBase()
PropertiesDatabaseIteratorBase()
virtual void increment()=0
std::unique_ptr< PropertiesDatabaseIteratorBase > clone() const
const value_type & reference
virtual PropertiesDatabaseIteratorBase * _clone() const =0
MappedProperties value_type
virtual bool equal(const PropertiesDatabaseIteratorBase &other) const =0
virtual reference dereference() const =0
friend PropertiesDatabaseIterator
virtual long distance_to(const PropertiesDatabaseIteratorBase &other) const =0
Wrapper class for specializations PropertiesDatabaseIteratorBase.
void increment()
boost::iterator_facade implementation
notstd::cloneable_ptr< PropertiesDatabaseIteratorBase > m_ptr
long distance_to(const PropertiesDatabaseIterator &B) const
PropertiesDatabaseIterator()
Default constructor.
PropertiesDatabaseIterator(const PropertiesDatabaseIteratorBase &it)
Construct iterator.
const MappedProperties & dereference() const
boost::iterator_facade implementation
bool equal(const PropertiesDatabaseIterator &B) const
boost::iterator_facade implementation
PropertiesDatabaseIteratorBase * get() const
PrimClex is the top-level data structure for a CASM project.
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
GenericDatumFormatter< std::string, Result > to_configname()
INDEX_TYPE Index
For long integer indexing:
Non-std smart pointer classes and functions.
std::unique_ptr< T > clone(const T &obj)