1 #ifndef CASM_DatabaseHandler
2 #define CASM_DatabaseHandler
20 class PropertiesDatabase;
81 void insert(std::string db_name, std::unique_ptr<DatabaseBase> &&value);
85 void insert_props(std::string db_name, std::string calc_type,
86 std::unique_ptr<PropertiesDatabase> &&value);
101 template <
typename T>
105 template <
typename T>
109 template <
typename T>
113 template <
typename T>
117 template <
typename T>
121 template <
typename T>
123 std::string calc_type)
const;
126 template <
typename T>
128 std::string calc_type);
132 typedef std::map<std::pair<std::string, std::string>,
133 std::unique_ptr<DatabaseBase> >
138 PropDBKey(std::string _config_type, std::string _db_type,
139 std::string _calc_type)
140 :
m_value(_config_type, _db_type, _calc_type) {}
154 std::tuple<std::string, std::string, std::string>
m_value;
158 typedef std::map<PropDBKey, std::unique_ptr<PropertiesDatabase> >
161 template <
typename T>
162 map_type::iterator
_find(std::string db_name)
const;
164 template <
typename T>
165 props_map_type::iterator
_find_props(std::string db_name,
166 std::string calc_type)
const;
168 template <
typename T>
171 template <
typename T>
173 std::string calc_type)
const;
const std::string & db_type() const
std::string & calc_type()
std::string & config_type()
bool operator<(const PropDBKey &B) const
const std::string & config_type() const
PropDBKey(std::string _config_type, std::string _db_type, std::string _calc_type)
std::tuple< std::string, std::string, std::string > m_value
const std::string & calc_type() const
Provides access to all databases.
const ValDatabase< T > & const_generic_db()
Access default Database<T>
std::map< std::pair< std::string, std::string >, std::unique_ptr< DatabaseBase > > map_type
const PrimClex * m_primclex
PropertiesDatabase & db_props(std::string calc_type)
Access default PropertiesDatabase.
props_map_type m_db_props
map_type::iterator _find(std::string db_name) const
std::string m_default_db_name
void insert_props(std::string db_name, std::string calc_type, std::unique_ptr< PropertiesDatabase > &&value)
Insert a PropertiesDatabase.
ValDatabase< T > & generic_db()
Access default Database<T>
const PrimClex & primclex() const
Database< T > & db()
Access default Database<T>
void close()
Close all databases.
DatabaseHandler(const PrimClex &_primclex)
void insert(std::string db_name, std::unique_ptr< DatabaseBase > &&value)
Insert a Database.
const Database< T > & const_db()
Access default Database<T>
std::map< PropDBKey, std::unique_ptr< PropertiesDatabase > > props_map_type
const PropertiesDatabase & const_db_props(std::string calc_type)
Access default PropertiesDatabase.
void _no_props_database_error(std::string db_name, std::string calc_type) const
void _no_database_error(std::string db_name) const
props_map_type::iterator _find_props(std::string db_name, std::string calc_type) const
Generic interface for database of a particular CASM type.
PrimClex is the top-level data structure for a CASM project.