CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DB::jsonDatabase< Supercell > Class Referenceabstract

#include <jsonDatabase.hh>

+ Inheritance diagram for CASM::DB::jsonDatabase< Supercell >:

Detailed Description

ValueType must have:

  • std::string ValueType::name() const

Derived classes must implement public methods:

This JSON Database has the following structure json["version"] contains the version (format) of this database. json["supercells"] is a JSON object that corresponds to a map in which the supercell name is the key and the value is the information of that supercell.

Definition at line 72 of file jsonDatabase.hh.

Public Types

typedef DatabaseIterator< Supercelliterator
 
typedef Supercell value_type
 
typedef Index size_type
 
typedef Base::MostDerived MostDerived
 

Public Member Functions

 jsonDatabase (const PrimClex &_primclex)
 
jsonDatabase< Supercell > & open () override
 
void commit () override
 
void close () override
 
iterator begin () const override
 
iterator end () const override
 
size_type size () const override
 
std::pair< iterator, bool > insert (const Supercell &obj) override
 
std::pair< iterator, bool > insert (const Supercell &&obj) override
 
void insert (InputIt first, InputIt last)
 
template<typename... Args>
std::pair< iterator, bool > emplace (Args &&... args)
 
iterator erase (iterator pos) override
 
virtual iterator erase (iterator pos)=0
 
size_type erase (const std::string &name_or_alias)
 
size_type erase (const Supercell &obj)
 
iterator find (const std::string &name_or_alias) const override
 
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 size_type count (const std::string &name_or_alias) const
 
Selection< Supercell > & master_selection ()
 
const Selection< Supercell > & master_selection () const
 
const PrimClexprimclex () const
 
const Structureprim () const
 
double crystallography_tol () const
 

Protected Types

typedef std::set< Supercell >::iterator base_iterator
 

Protected Member Functions

std::pair< iterator, bool > _on_insert_or_emplace (const std::pair< base_iterator, bool > &result)
 
void clear ()
 
iterator _iterator (base_iterator base_it) const
 
void read_aliases ()
 
void write_aliases ()
 
void clear_name (const _ValueType &obj) const
 Only ValDatabase<ValueType> is allowed to do clear_name. More...
 
void set_id (const _ValueType &obj, Index id) const
 Only ValDatabase<ValueType> is allowed to do a const id change. More...
 
void set_id (const _ValueType &obj, std::string id) const
 Only ValDatabase<ValueType> is allowed to do a const id change. More...
 
MostDerivedderived ()
 
const MostDerivedderived () const
 

Protected Attributes

std::map< std::string, base_iteratorm_name_to_scel
 
std::set< Supercellm_scel_list
 

Private Member Functions

void _read_scel_list ()
 
void _read_SCEL ()
 

Private Attributes

bool m_is_open
 
std::map< std::string, std::string > m_name_to_alias
 
std::map< std::string, std::string > m_alias_to_name
 
Selection< Supercellm_master_selection
 
const PrimClexm_primclex
 

Member Typedef Documentation

◆ base_iterator

Definition at line 61 of file ScelDatabase.hh.

◆ iterator

Definition at line 223 of file Database.hh.

◆ MostDerived

typedef Base::MostDerived CASM::HasPrimClex< CRTPBase< DatabaseBase > >::MostDerived
inherited

Definition at line 16 of file HasPrimClex.hh.

◆ size_type

Definition at line 225 of file Database.hh.

◆ value_type

Definition at line 224 of file Database.hh.

Constructor & Destructor Documentation

◆ jsonDatabase()

Definition at line 94 of file jsonDatabase.cc.

Member Function Documentation

◆ _iterator()

Database< Supercell >::iterator CASM::DB::Database< Supercell >::_iterator ( base_iterator  base_it) const
protectedinherited

Definition at line 66 of file ScelDatabase.cc.

◆ _on_insert_or_emplace()

std::pair< Database< Supercell >::iterator, bool > CASM::DB::Database< Supercell >::_on_insert_or_emplace ( const std::pair< base_iterator, bool > &  result)
protectedinherited

Definition at line 48 of file ScelDatabase.cc.

◆ _read_SCEL()

void CASM::DB::jsonDatabase< Supercell >::_read_SCEL ( )
private

Definition at line 185 of file jsonDatabase.cc.

◆ _read_scel_list()

void CASM::DB::jsonDatabase< Supercell >::_read_scel_list ( )
private

Definition at line 153 of file jsonDatabase.cc.

◆ alias()

std::string CASM::DB::ValDatabase< Supercell >::alias ( const std::string &  name_or_alias) const
inherited

Get alias from name_or_alias.

Get alias from name_or_alias

  • Checks if name_or_alias is a known alias
  • If yes, returns name_or_alias
  • If no, checks if name_or_alias is a name corresponding to a known alias
    • If yes, returns alias
    • If no, (because name_or_alias is an invalid name, or because name_or_alias is a valid name without an alias), returns empty string

Definition at line 250 of file Database_impl.hh.

◆ begin()

Database< Supercell >::iterator CASM::DB::Database< Supercell >::begin ( ) const
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 6 of file ScelDatabase.cc.

◆ clear()

void CASM::DB::Database< Supercell >::clear ( )
protectedinherited

Definition at line 61 of file ScelDatabase.cc.

◆ clear_name()

void CASM::DB::ValDatabase< Supercell >::clear_name ( const _ValueType &  obj) const
inlineprotectedinherited

Only ValDatabase<ValueType> is allowed to do clear_name.

Definition at line 298 of file Database.hh.

◆ close()

void CASM::DB::jsonDatabase< Supercell >::close ( )
overridevirtual

Implements CASM::DB::DatabaseBase.

Definition at line 147 of file jsonDatabase.cc.

◆ commit()

void CASM::DB::jsonDatabase< Supercell >::commit ( )
overridevirtual

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 117 of file jsonDatabase.cc.

◆ count()

virtual size_type CASM::DB::ValDatabase< Supercell >::count ( const std::string &  name_or_alias) const
inlinevirtualinherited

Definition at line 268 of file Database.hh.

◆ crystallography_tol()

double CASM::HasPrimClex< CRTPBase< DatabaseBase > >::crystallography_tol
inherited

Definition at line 21 of file HasPrimClex_impl.hh.

◆ derived() [1/2]

template<typename _MostDerived >
MostDerived& notstd::CRTPBase< _MostDerived >::derived ( )
inlineprotectedinherited

Definition at line 13 of file CRTPBase.hh.

◆ derived() [2/2]

template<typename _MostDerived >
const MostDerived& notstd::CRTPBase< _MostDerived >::derived ( ) const
inlineprotectedinherited

Definition at line 15 of file CRTPBase.hh.

◆ emplace()

template<typename... Args>
std::pair<iterator, bool> CASM::DB::Database< Supercell >::emplace ( Args &&...  args)
inlineinherited

Definition at line 49 of file ScelDatabase.hh.

◆ empty()

bool CASM::DB::ValDatabase< Supercell >::empty ( ) const
inlineinherited

Definition at line 236 of file Database.hh.

◆ end()

Database< Supercell >::iterator CASM::DB::Database< Supercell >::end ( ) const
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 10 of file ScelDatabase.cc.

◆ erase() [1/4]

size_type CASM::DB::ValDatabase< Supercell >::erase ( const std::string &  name_or_alias)
inlineinherited

Definition at line 262 of file Database.hh.

◆ erase() [2/4]

size_type CASM::DB::ValDatabase< Supercell >::erase ( const Supercell obj)
inlineinherited

Definition at line 266 of file Database.hh.

◆ erase() [3/4]

Database< Supercell >::iterator CASM::DB::Database< Supercell >::erase ( iterator  pos)
overrideinherited

Definition at line 28 of file ScelDatabase.cc.

◆ erase() [4/4]

virtual iterator CASM::DB::ValDatabase< Supercell >::erase ( iterator  pos)
pure virtualinherited

◆ find()

Database< Supercell >::iterator CASM::DB::Database< Supercell >::find ( const std::string &  name_or_alias) const
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 36 of file ScelDatabase.cc.

◆ insert() [1/3]

std::pair< Database< Supercell >::iterator, bool > CASM::DB::Database< Supercell >::insert ( const Supercell &&  obj)
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 23 of file ScelDatabase.cc.

◆ insert() [2/3]

std::pair< Database< Supercell >::iterator, bool > CASM::DB::Database< Supercell >::insert ( const Supercell obj)
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 18 of file ScelDatabase.cc.

◆ insert() [3/3]

void CASM::DB::ValDatabase< Supercell >::insert ( InputIt  first,
InputIt  last 
)
inlineinherited

Definition at line 256 of file Database.hh.

◆ master_selection() [1/2]

Selection<Supercell >& CASM::DB::ValDatabase< Supercell >::master_selection ( )
inlineinherited

Definition at line 285 of file Database.hh.

◆ master_selection() [2/2]

const Selection<Supercell >& CASM::DB::ValDatabase< Supercell >::master_selection ( ) const
inlineinherited

Definition at line 287 of file Database.hh.

◆ name()

std::string CASM::DB::ValDatabase< Supercell >::name ( const std::string &  name_or_alias) const
inherited

Get name from name_or_alias

  • Checks if name_or_alias is a known alias
  • If known alias, returns associated name
  • If not known alias, assumed to be a name and returns name_or_alias

Definition at line 247 of file Database_impl.hh.

◆ open()

jsonDatabase< Supercell > & CASM::DB::jsonDatabase< Supercell >::open ( )
overridevirtual

Implements CASM::DB::DatabaseBase.

Definition at line 97 of file jsonDatabase.cc.

◆ prim()

const Structure & CASM::HasPrimClex< CRTPBase< DatabaseBase > >::prim
inherited

Definition at line 19 of file HasPrimClex_impl.hh.

◆ primclex()

const PrimClex& CASM::DB::DatabaseBase::primclex ( ) const
inlineinherited

Definition at line 35 of file Database.hh.

◆ read_aliases()

void CASM::DB::ValDatabase< Supercell >::read_aliases
protectedinherited

Definition at line 292 of file Database_impl.hh.

◆ set_alias()

std::pair< typename ValDatabase< Supercell >::iterator, bool > CASM::DB::ValDatabase< Supercell >::set_alias ( const std::string &  name_or_alias,
const std::string &  alias 
)
inherited

For setting an alias.

Definition at line 239 of file Database_impl.hh.

◆ set_id() [1/2]

void CASM::DB::ValDatabase< Supercell >::set_id ( const _ValueType &  obj,
Index  id 
) const
inlineprotectedinherited

Only ValDatabase<ValueType> is allowed to do a const id change.

Definition at line 304 of file Database.hh.

◆ set_id() [2/2]

void CASM::DB::ValDatabase< Supercell >::set_id ( const _ValueType &  obj,
std::string  id 
) const
inlineprotectedinherited

Only ValDatabase<ValueType> is allowed to do a const id change.

Definition at line 310 of file Database.hh.

◆ size()

Database< Supercell >::size_type CASM::DB::Database< Supercell >::size ( ) const
overridevirtualinherited

Implements CASM::DB::ValDatabase< Supercell >.

Definition at line 14 of file ScelDatabase.cc.

◆ write_aliases()

void CASM::DB::ValDatabase< Supercell >::write_aliases
protectedinherited

Definition at line 294 of file Database_impl.hh.

Member Data Documentation

◆ m_alias_to_name

std::map<std::string, std::string> CASM::DB::ValDatabase< Supercell >::m_alias_to_name
privateinherited

Definition at line 319 of file Database.hh.

◆ m_is_open

bool CASM::DB::jsonDatabase< Supercell >::m_is_open
private

Definition at line 87 of file jsonDatabase.hh.

◆ m_master_selection

Selection<Supercell > CASM::DB::ValDatabase< Supercell >::m_master_selection
privateinherited

Definition at line 322 of file Database.hh.

◆ m_name_to_alias

std::map<std::string, std::string> CASM::DB::ValDatabase< Supercell >::m_name_to_alias
privateinherited

Definition at line 316 of file Database.hh.

◆ m_name_to_scel

std::map<std::string, base_iterator> CASM::DB::Database< Supercell >::m_name_to_scel
protectedinherited

Definition at line 70 of file ScelDatabase.hh.

◆ m_primclex

const PrimClex* CASM::DB::DatabaseBase::m_primclex
privateinherited

Definition at line 38 of file Database.hh.

◆ m_scel_list

std::set<Supercell> CASM::DB::Database< Supercell >::m_scel_list
protectedinherited

Definition at line 71 of file ScelDatabase.hh.


The documentation for this class was generated from the following files: