CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <Database.hh>
Generic interface for database of a particular CASM type.
Currently all ValueType use the same interface, though it is possible to specialization this interface for a particular ValueType.
ValueType must have:
Derived classes must implement public methods:
Database insert methods by convention do not enforce canonical form or any other logic, they simply insert as is. By convention, a ValueType::insert method shold be implemented to enforce canonical form and any other constraints. But in cases where it is known that ValueType are being generated in the correct form for insertion in the database, the Database insert methods may be used directly. For example, see the method insert_unique_canon_configs.
Definition at line 221 of file Database.hh.
Public Types | |
typedef DatabaseIterator< ValueType > | iterator |
typedef ValueType | value_type |
typedef Index | size_type |
typedef Base::MostDerived | MostDerived |
Public Member Functions | |
ValDatabase (const PrimClex &_primclex) | |
virtual | ~ValDatabase () |
virtual iterator | begin () const =0 |
virtual iterator | end () const =0 |
virtual size_type | size () const =0 |
bool | empty () const |
std::pair< iterator, bool > | set_alias (const std::string &name_or_alias, const std::string &alias) |
For setting an alias. More... | |
std::string | name (const std::string &name_or_alias) const |
std::string | alias (const std::string &name_or_alias) const |
Get alias from name_or_alias. More... | |
virtual std::pair< iterator, bool > | insert (const ValueType &obj)=0 |
virtual std::pair< iterator, bool > | insert (const ValueType &&obj)=0 |
template<typename InputIt > | |
void | insert (InputIt first, InputIt last) |
virtual iterator | erase (iterator pos)=0 |
size_type | erase (const std::string &name_or_alias) |
size_type | erase (const ValueType &obj) |
virtual size_type | count (const std::string &name_or_alias) const |
virtual iterator | find (const std::string &name_or_alias) const =0 |
virtual void | commit ()=0 |
Selection< ValueType > & | master_selection () |
const Selection< ValueType > & | master_selection () const |
virtual DatabaseBase & | open ()=0 |
virtual void | close ()=0 |
const PrimClex & | primclex () const |
const Structure & | prim () const |
double | crystallography_tol () const |
Protected Member Functions | |
void | read_aliases () |
void | write_aliases () |
template<typename _ValueType > | |
void | clear_name (const _ValueType &obj) const |
Only ValDatabase<ValueType> is allowed to do clear_name. More... | |
template<typename _ValueType > | |
void | set_id (const _ValueType &obj, Index id) const |
Only ValDatabase<ValueType> is allowed to do a const id change. More... | |
template<typename _ValueType > | |
void | set_id (const _ValueType &obj, std::string id) const |
Only ValDatabase<ValueType> is allowed to do a const id change. More... | |
MostDerived & | derived () |
const MostDerived & | derived () const |
Private Attributes | |
std::map< std::string, std::string > | m_name_to_alias |
std::map< std::string, std::string > | m_alias_to_name |
Selection< ValueType > | m_master_selection |
const PrimClex * | m_primclex |
typedef DatabaseIterator<ValueType> CASM::DB::ValDatabase< ValueType >::iterator |
Definition at line 223 of file Database.hh.
|
inherited |
Definition at line 16 of file HasPrimClex.hh.
typedef Index CASM::DB::ValDatabase< ValueType >::size_type |
Definition at line 225 of file Database.hh.
typedef ValueType CASM::DB::ValDatabase< ValueType >::value_type |
Definition at line 224 of file Database.hh.
|
inline |
Definition at line 227 of file Database.hh.
|
inlinevirtual |
Definition at line 229 of file Database.hh.
std::string CASM::DB::ValDatabase< ValueType >::alias | ( | const std::string & | name_or_alias | ) | const |
Get alias from name_or_alias.
Get alias from name_or_alias
Definition at line 83 of file Database_impl.hh.
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
inlineprotected |
Only ValDatabase<ValueType> is allowed to do clear_name.
Definition at line 298 of file Database.hh.
|
pure virtualinherited |
|
pure virtual |
Implements CASM::DB::DatabaseBase.
Implemented in CASM::DB::jsonDatabase< Configuration >, and CASM::DB::jsonDatabase< Supercell >.
|
inlinevirtual |
Definition at line 268 of file Database.hh.
|
inherited |
Definition at line 21 of file HasPrimClex_impl.hh.
|
inlineprotectedinherited |
Definition at line 13 of file CRTPBase.hh.
|
inlineprotectedinherited |
Definition at line 15 of file CRTPBase.hh.
|
inline |
Definition at line 236 of file Database.hh.
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
inline |
Definition at line 262 of file Database.hh.
|
inline |
Definition at line 266 of file Database.hh.
|
pure virtual |
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
inline |
Definition at line 256 of file Database.hh.
|
inline |
Definition at line 285 of file Database.hh.
|
inline |
Definition at line 287 of file Database.hh.
std::string CASM::DB::ValDatabase< ValueType >::name | ( | const std::string & | name_or_alias | ) | const |
Get name from name_or_alias
Definition at line 65 of file Database_impl.hh.
|
pure virtualinherited |
|
inherited |
Definition at line 19 of file HasPrimClex_impl.hh.
|
inlineinherited |
Definition at line 35 of file Database.hh.
|
protected |
Definition at line 106 of file Database_impl.hh.
std::pair< typename ValDatabase< ValueType >::iterator, bool > CASM::DB::ValDatabase< ValueType >::set_alias | ( | const std::string & | name_or_alias, |
const std::string & | alias | ||
) |
For setting an alias.
Definition at line 17 of file Database_impl.hh.
|
inlineprotected |
Only ValDatabase<ValueType> is allowed to do a const id change.
Definition at line 304 of file Database.hh.
|
inlineprotected |
Only ValDatabase<ValueType> is allowed to do a const id change.
Definition at line 310 of file Database.hh.
|
pure virtual |
Implemented in CASM::DB::Database< Supercell >, and CASM::DB::jsonDatabase< Configuration >.
|
protected |
Definition at line 121 of file Database_impl.hh.
|
private |
Definition at line 319 of file Database.hh.
|
private |
Definition at line 322 of file Database.hh.
|
private |
Definition at line 316 of file Database.hh.
|
privateinherited |
Definition at line 38 of file Database.hh.