CASM  1.1.0
A Clusters Approach to Statistical Mechanics
ConfigImport.hh
Go to the documentation of this file.
1 #ifndef CASM_DB_ConfigImport
2 #define CASM_DB_ConfigImport
3 
4 #include <map>
5 #include <memory>
6 #include <string>
7 #include <vector>
8 
10 #include "casm/database/Update.hh"
12 
13 namespace CASM {
14 namespace xtal {
15 class Site;
16 class SimpleStructure;
17 } // namespace xtal
18 using xtal::SimpleStructure;
19 
20 namespace ConfigMapping {
21 struct Settings;
22 }
23 
24 class ConfigMapper;
25 class Configuration;
26 class PrimClex;
27 class jsonParser;
28 } // namespace CASM
29 
30 namespace CASM {
31 namespace DB {
32 
33 template <>
35  public:
38  const PrimClex &_primclex);
39 
40  typedef std::back_insert_iterator<std::vector<ConfigIO::Result> >
42 
57  // TODO: get rid of req_properties, and have it checked on-the-fly at point
58  // where it is needed
59  map_result_inserter map(fs::path p,
60  std::vector<std::string> const &req_properties,
61  std::unique_ptr<Configuration> const &hint_config,
62  map_result_inserter result) const;
63 
65  const ConfigMapping::Settings &settings() const;
66 
67  private:
69  SimpleStructure _make_structure(const fs::path &p) const;
70 
71  std::unique_ptr<ConfigMapper> m_configmapper;
72 };
73 
75 template <>
76 class Import<Configuration> : public ImportT<Configuration> {
77  public:
80 
82  Import(const PrimClex &primclex, const StructureMap<ConfigType> &mapper,
83  ImportSettings const &_set, std::string const &report_dir);
84 
85  static const std::string desc;
86  static int run(const PrimClex &primclex, const jsonParser &kwargs,
87  const Completer::ImportOption &import_opt);
88 
89  protected:
91  DataFormatter<ConfigIO::Result> _import_formatter() const override;
92 };
93 
95 template <>
96 class Update<Configuration> : public UpdateT<Configuration> {
97  public:
99 
101  Update(const PrimClex &primclex, const StructureMap<ConfigType> &mapper,
102  std::string const &report_dir);
103 
104  static const std::string desc;
105  static int run(const PrimClex &primclex, const jsonParser &kwargs,
106  const Completer::UpdateOption &import_opt);
107 
108  private:
109  // Allow ConfigType to specialize the report formatting for 'update'
110  DataFormatter<ConfigIO::Result> _update_formatter() const override;
111 };
112 
113 } // namespace DB
114 } // namespace CASM
115 
116 #endif
static const std::string desc
Definition: ConfigImport.hh:85
Generic ConfigType-dependent part of Import.
Definition: Import.hh:66
std::unique_ptr< ConfigMapper > m_configmapper
Definition: ConfigImport.hh:71
std::back_insert_iterator< std::vector< ConfigIO::Result > > map_result_inserter
Definition: ConfigImport.hh:41
static const std::string desc
Generic ConfigType-dependent part of Import.
Definition: Update.hh:30
Extract data from objects of 'DataObject' class.
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:55
Representation of a crystal of molecular and/or atomic occupants, and any additional properties....
Main CASM namespace.
Definition: APICommand.hh:8
PrimClex * primclex
Definition: settings.cc:135
Struct with optional parameters for Config Mapping Specifies default parameters for all values,...
Struct with optional parameters for Config/Data Import Specifies default parameters for all values,...
Definition: Import.hh:34