CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <Selection.hh>
Provides a means of selecting and iterating over a subset of objects in a database
Definition at line 113 of file Selection.hh.
Classes | |
struct | Compare |
Public Types | |
typedef std::map< std::string, bool, Compare > | map_type |
typedef map_type::iterator | base_iterator |
typedef map_type::const_iterator | base_const_iterator |
typedef SelectionIterator< ObjType, base_iterator > | iterator |
typedef SelectionIterator< ObjType, base_const_iterator > | const_iterator |
typedef Index | size_type |
Public Member Functions | |
Selection () | |
Default construct into invalid state. More... | |
Selection (const PrimClex &_primclex, fs::path selection_path="MASTER") | |
Use default ObjType database. More... | |
Selection (Database< ObjType > &_db, fs::path selection_path="MASTER") | |
Use specified ObjType database. More... | |
const PrimClex & | primclex () const |
Database< ObjType > & | db () const |
boost::iterator_range< iterator > | all () |
boost::iterator_range< const_iterator > | all () const |
boost::iterator_range< iterator > | selected () |
boost::iterator_range< const_iterator > | selected () const |
map_type & | data () |
const map_type & | data () const |
Index | size () const |
Index | selected_size () const |
const std::vector< std::string > & | col_headers () const |
const std::string & | name () const |
bool | is_selected (const std::string &name_or_alias) const |
True if obj is in Selection and is selected; false otherwise. More... | |
void | set (const DataFormatterDictionary< ObjType > &dict, const std::string &criteria) |
Set selected objects to value of criteria. More... | |
void | set (const DataFormatterDictionary< ObjType > &dict, const std::string &criteria, bool selected) |
Set selected objects to value, if criteria true. More... | |
void | read (std::istream &_input) |
Read csv selection from stream. More... | |
void | print (const DataFormatterDictionary< ObjType > &_dict, std::ostream &_out, bool only_selected=false) const |
Print csv selection to stream. More... | |
const jsonParser & | from_json (const jsonParser &_json) |
Read selection from JSON. More... | |
jsonParser & | to_json (const DataFormatterDictionary< ObjType > &_dict, jsonParser &_json, bool only_selected=false) const |
Write selection to JSON. More... | |
void | write (const DataFormatterDictionary< ObjType > &dict, const fs::path &out_path, bool write_json, bool only_selected) const |
Write selection to file – will overwrite. More... | |
Private Attributes | |
Database< ObjType > * | m_db |
const PrimClex * | m_primclex |
map_type | m_data |
std::vector< std::string > | m_col_headers |
std::string | m_name |
typedef map_type::const_iterator CASM::DB::Selection< ObjType >::base_const_iterator |
Definition at line 123 of file Selection.hh.
typedef map_type::iterator CASM::DB::Selection< ObjType >::base_iterator |
Definition at line 122 of file Selection.hh.
typedef SelectionIterator<ObjType, base_const_iterator> CASM::DB::Selection< ObjType >::const_iterator |
Definition at line 125 of file Selection.hh.
typedef SelectionIterator<ObjType, base_iterator> CASM::DB::Selection< ObjType >::iterator |
Definition at line 124 of file Selection.hh.
typedef std::map<std::string, bool, Compare> CASM::DB::Selection< ObjType >::map_type |
Definition at line 121 of file Selection.hh.
typedef Index CASM::DB::Selection< ObjType >::size_type |
Definition at line 126 of file Selection.hh.
CASM::DB::Selection< ObjType >::Selection |
Default construct into invalid state.
Definition at line 139 of file Selection.cc.
CASM::DB::Selection< ObjType >::Selection | ( | const PrimClex & | _primclex, |
fs::path | selection_path = "MASTER" |
||
) |
Use default ObjType database.
Definition at line 143 of file Selection.cc.
CASM::DB::Selection< ObjType >::Selection | ( | Database< ObjType > & | _db, |
fs::path | selection_path = "MASTER" |
||
) |
Use specified ObjType database.
Definition at line 148 of file Selection.cc.
boost::iterator_range< typename Selection< ObjType >::iterator > CASM::DB::Selection< ObjType >::all |
Definition at line 222 of file Selection.cc.
boost::iterator_range< typename Selection< ObjType >::const_iterator > CASM::DB::Selection< ObjType >::all |
Definition at line 229 of file Selection.cc.
const std::vector< std::string > & CASM::DB::Selection< ObjType >::col_headers |
Definition at line 265 of file Selection.cc.
Selection< ObjType >::map_type & CASM::DB::Selection< ObjType >::data |
Definition at line 250 of file Selection.cc.
const Selection< ObjType >::map_type & CASM::DB::Selection< ObjType >::data |
Definition at line 255 of file Selection.cc.
Database< ObjType > & CASM::DB::Selection< ObjType >::db |
Definition at line 212 of file Selection.cc.
const jsonParser & CASM::DB::Selection< ObjType >::from_json | ( | const jsonParser & | _json | ) |
Read selection from JSON.
Definition at line 393 of file Selection.cc.
bool CASM::DB::Selection< ObjType >::is_selected | ( | const std::string & | name_or_alias | ) | const |
True if obj is in Selection and is selected; false otherwise.
Definition at line 281 of file Selection.cc.
const std::string & CASM::DB::Selection< ObjType >::name |
Definition at line 270 of file Selection.cc.
const PrimClex & CASM::DB::Selection< ObjType >::primclex |
Definition at line 207 of file Selection.cc.
void CASM::DB::Selection< ObjType >::print | ( | const DataFormatterDictionary< ObjType > & | _dict, |
std::ostream & | _out, | ||
bool | only_selected = false |
||
) | const |
Print csv selection to stream.
Definition at line 470 of file Selection.cc.
void CASM::DB::Selection< ObjType >::read | ( | std::istream & | _input | ) |
Read csv selection from stream.
Definition at line 365 of file Selection.cc.
boost::iterator_range< typename Selection< ObjType >::iterator > CASM::DB::Selection< ObjType >::selected |
Definition at line 237 of file Selection.cc.
boost::iterator_range< typename Selection< ObjType >::const_iterator > CASM::DB::Selection< ObjType >::selected |
Definition at line 244 of file Selection.cc.
Index CASM::DB::Selection< ObjType >::selected_size |
Definition at line 275 of file Selection.cc.
void CASM::DB::Selection< ObjType >::set | ( | const DataFormatterDictionary< ObjType > & | dict, |
const std::string & | criteria | ||
) |
Set selected objects to value of criteria.
Definition at line 291 of file Selection.cc.
void CASM::DB::Selection< ObjType >::set | ( | const DataFormatterDictionary< ObjType > & | dict, |
const std::string & | criteria, | ||
bool | selected | ||
) |
Set selected objects to value, if criteria true.
Definition at line 322 of file Selection.cc.
Index CASM::DB::Selection< ObjType >::size |
Definition at line 260 of file Selection.cc.
jsonParser & CASM::DB::Selection< ObjType >::to_json | ( | const DataFormatterDictionary< ObjType > & | _dict, |
jsonParser & | _json, | ||
bool | only_selected = false |
||
) | const |
Write selection to JSON.
Definition at line 448 of file Selection.cc.
void CASM::DB::Selection< ObjType >::write | ( | const DataFormatterDictionary< ObjType > & | dict, |
const fs::path & | out_path, | ||
bool | write_json, | ||
bool | only_selected | ||
) | const |
Write selection to file – will overwrite.
Definition at line 487 of file Selection.cc.
|
private |
Definition at line 194 of file Selection.hh.
|
private |
Definition at line 192 of file Selection.hh.
|
private |
Definition at line 187 of file Selection.hh.
|
private |
Definition at line 195 of file Selection.hh.
|
private |
Definition at line 188 of file Selection.hh.