1 #ifndef CASM_FUNCTIONS_HH
2 #define CASM_FUNCTIONS_HH
4 #include <boost/filesystem/path.hpp>
55 fs::path _root = fs::path());
59 fs::path _root = fs::path());
97 std::unique_ptr<PrimClex> &uniq_primclex);
101 std::unique_ptr<std::ostream> &fout,
102 fs::path out_path,
bool gzip);
108 template <
typename OptionType>
113 template <
typename OptionType>
118 template <
typename OptionType>
125 virtual std::string
help()
const = 0;
127 virtual std::string
name()
const = 0;
132 std::unique_ptr<InterfaceBase>
clone()
const {
133 return std::unique_ptr<InterfaceBase>(this->
_clone());
141 template <
typename OptionType>
143 return notstd::make_unique<InterfaceMap<OptionType> >(
Base class for generic use of algorithms through the API.
virtual InterfaceBase * _clone() const =0
std::unique_ptr< InterfaceBase > clone() const
virtual std::string name() const =0
virtual int run(PrimClex const &primclex, jsonParser const &json_options) const =0
virtual std::string help() const =0
PrimClex is the top-level data structure for a CASM project.
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
std::map wrapper to enforce a 1-1 ValueType->KeyType relationship
CommandMap & command_map()
Return static CommandMap containing all CASM API commands.
int version_command(const CommandArgs &args)
int help_command(const CommandArgs &args)
Print CASM help info to log()
std::ostream & make_ostream_if(bool output, std::ostream &sout, std::unique_ptr< std::ostream > &fout, fs::path out_path, bool gzip)
Return a reference to proper std::ostream.
std::map< std::string, Command > CommandMap
int casm_api(const CommandArgs &args)
Executes CASM commands specified by args.
std::unique_ptr< InterfaceMap< OptionType > > make_interface_map()
Use to construct an InterfaceMap.
PrimClex & make_primclex_if_not(const CommandArgs &args, std::unique_ptr< PrimClex > &uniq_primclex)
If !_primclex, construct new PrimClex stored in uniq_primclex, then return reference to existing or c...
std::function< int(const CommandArgs &)> Command
void print_splash(std::ostream &out)
std::unique_ptr< T > clone(const T &obj)
Data structure holding basic CASM command info.
CommandArgs & operator=(const CommandArgs &)=delete
CommandArgs(int _argc, char *_argv[], PrimClex *_primclex=nullptr, fs::path _root=fs::path())
CommandArgs constructor.
CommandArgs & operator=(CommandArgs &&)=delete
CommandArgs(const CommandArgs &other)=delete
CommandArgs(CommandArgs &&other)=delete
~CommandArgs()
CommandArgs destructor.