CASM  1.1.0
A Clusters Approach to Statistical Mechanics
Remove.hh
Go to the documentation of this file.
1 #ifndef CASM_DB_Remove
2 #define CASM_DB_Remove
3 
5 
6 namespace CASM {
7 namespace Completer {
8 class RmOption;
9 }
10 } // namespace CASM
11 
12 // To be specialized for calculable 'ConfigType' classes:
13 // StructureMap<ConfigType>::map(std::string, DatabaseIterator<ConfigType>
14 // hint, inserter result) Import<ConfigType>::desc Import<ConfigType>::run
15 // Import<ConfigType>::_import_formatter
16 // Update<ConfigType>::desc
17 // Update<ConfigType>::run
18 // Update<ConfigType>::_update_formatter
19 // Remove<ConfigType>::desc
20 // Remove<ConfigType>::run
21 
22 namespace CASM {
23 namespace DB {
24 
26 template <typename _ConfigType>
27 class RemoveT : protected ConfigData {
28  public:
29  typedef _ConfigType ConfigType;
30 
31  RemoveT(const PrimClex &primclex, std::string report_dir);
32 
34  void erase(const DB::Selection<ConfigType> &selection, bool dry_run);
35 
37  void erase_data(const DB::Selection<ConfigType> &selection, bool dry_run);
38 
44  void erase_all(const DB::Selection<ConfigType> &selection, bool dry_run);
45 
46  private:
47  void _erase_report(const std::vector<std::string> &fail);
48 
49  std::string m_report_dir;
50 };
51 
52 // To be specialized for ConfigType (default implementation exists for
53 // ConfigTypes)
54 template <typename ConfigType>
55 class Remove : public RemoveT<ConfigType> {
56  public:
57  Remove(const PrimClex &primclex, std::string report_dir);
58  static std::string desc();
59  static int run(const PrimClex &, const Completer::RmOption &opt);
60 };
61 } // namespace DB
62 } // namespace CASM
63 
64 #endif
const PrimClex & primclex() const
Definition: ConfigData.hh:152
static std::string desc()
Definition: Remove_impl.hh:104
Remove(const PrimClex &primclex, std::string report_dir)
Definition: Remove_impl.hh:100
static int run(const PrimClex &, const Completer::RmOption &opt)
Definition: Remove_impl.hh:130
Generic ConfigType-dependent part of Remove.
Definition: Remove.hh:27
void erase(const DB::Selection< ConfigType > &selection, bool dry_run)
Erase Configurations that have no data.
Definition: Remove_impl.hh:27
void erase_data(const DB::Selection< ConfigType > &selection, bool dry_run)
Erase data and files (permanently), but not Configuration.
Definition: Remove_impl.hh:51
_ConfigType ConfigType
Definition: Remove.hh:29
std::string m_report_dir
Definition: Remove.hh:49
void _erase_report(const std::vector< std::string > &fail)
Definition: Remove_impl.hh:87
void erase_all(const DB::Selection< ConfigType > &selection, bool dry_run)
Removes Configurations and data and files (permanently)
Definition: Remove_impl.hh:77
RemoveT(const PrimClex &primclex, std::string report_dir)
Definition: Remove_impl.hh:22
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
Main CASM namespace.
Definition: APICommand.hh:8