Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
zethtool::generic_subcommand< CommandT > Class Template Reference

#include <tool_common.hpp>

Inheritance diagram for zethtool::generic_subcommand< CommandT >:
Inheritance graph
[legend]
Collaboration diagram for zethtool::generic_subcommand< CommandT >:
Collaboration graph
[legend]

Classes

class  this_caller
 

Public Member Functions

 generic_subcommand (const std::string &subcommand_name, const std::string &description)
 
- Public Member Functions inherited from libtool::subcommand< GlobalOptionsT >
 subcommand (const std::string &subcommand_name, const std::string &description)
 
virtual ~subcommand ()
 
const std::string & description () const
 
int execute (const char *argv0, const std::vector< std::string > command_args, const GlobalOptionsT &global)
 Common code to parse options and invoke the virtual execute entrypoint. More...
 

Protected Member Functions

void initialize_suboptions (boost::program_options::options_description &options, boost::program_options::options_description &, boost::program_options::positional_options_description &) override
 Instantiation can now set up the boost program_options structures. More...
 
void parse_suboptions (const boost::program_options::variables_map &vm) override
 
int execute_subcommand (const global_options &options) override
 
- Protected Member Functions inherited from libtool::subcommand< GlobalOptionsT >
void usage (const char *argv0, const boost::program_options::options_description &options)
 
virtual void subcommand_usage (const char *argv0)=0
 Any command-specific output for usage. More...
 
virtual int execute_subcommand (const GlobalOptionsT &global)=0
 Execute the command using global options defined by the caller. More...
 

Protected Attributes

std::string curve
 
std::string snark
 
- Protected Attributes inherited from libtool::subcommand< GlobalOptionsT >
std::string subcommand_name
 
std::string subcommand_description
 

Detailed Description

template<class CommandT>
class zethtool::generic_subcommand< CommandT >

Base class of subcommands with entry points generic over curve and snark. Implementations are expected to implement a public generic execute_generic method of the form:

class my_cmd : generic_subcommand_base<my_cmd> { public: template<typename ppT, typename snarkT> int execute_generic( const global_options &) { ... } }

along side the usual parsing entry points initialize_suboptions and parse_suboptions, which MUST call the equivalent methods on this base class.

Definition at line 87 of file tool_common.hpp.

Constructor & Destructor Documentation

◆ generic_subcommand()

template<class CommandT >
zethtool::generic_subcommand< CommandT >::generic_subcommand ( const std::string &  subcommand_name,
const std::string &  description 
)
inline

Definition at line 90 of file tool_common.hpp.

Member Function Documentation

◆ execute_subcommand()

template<class CommandT >
int zethtool::generic_subcommand< CommandT >::execute_subcommand ( const global_options options)
inlineoverrideprotected

Definition at line 118 of file tool_common.hpp.

119  {
121  curve, snark, this, options);
122  }

◆ initialize_suboptions()

template<class CommandT >
void zethtool::generic_subcommand< CommandT >::initialize_suboptions ( boost::program_options::options_description &  options,
boost::program_options::options_description &  all_options,
boost::program_options::positional_options_description &  pos 
)
inlineoverrideprotectedvirtual

Instantiation can now set up the boost program_options structures.

Implements libtool::subcommand< GlobalOptionsT >.

Definition at line 97 of file tool_common.hpp.

101  {
102  // Options
103  options.add_options()(
104  "curve,c",
105  po::value<std::string>(),
106  "Curve: alt-bn128, bls12-377 or bw6-761");
107  options.add_options()(
108  "snark,s", po::value<std::string>(), "Snark: groth16 or pghr13");
109  }

◆ parse_suboptions()

template<class CommandT >
void zethtool::generic_subcommand< CommandT >::parse_suboptions ( const boost::program_options::variables_map &  vm)
inlineoverrideprotectedvirtual

Instantiation can record any command-specific information from the parsed variables_map.

Implements libtool::subcommand< GlobalOptionsT >.

Definition at line 111 of file tool_common.hpp.

113  {
114  curve = vm.count("curve") ? vm["curve"].as<std::string>() : "alt-bn128";
115  snark = vm.count("snark") ? vm["snark"].as<std::string>() : "groth16";
116  }

Member Data Documentation

◆ curve

template<class CommandT >
std::string zethtool::generic_subcommand< CommandT >::curve
protected

Definition at line 135 of file tool_common.hpp.

◆ snark

template<class CommandT >
std::string zethtool::generic_subcommand< CommandT >::snark
protected

Definition at line 136 of file tool_common.hpp.


The documentation for this class was generated from the following file:
libtool::subcommand::description
const std::string & description() const
zethtool::curve_and_snark_resolver::resolve
static int resolve(const std::string &curve_name, const std::string &snark_name, Args... args)
Definition: tool_common.hpp:39
libtool::subcommand::subcommand_name
std::string subcommand_name
Definition: subcommand.hpp:54
zethtool::zeth_subcommand
libtool::subcommand< global_options > zeth_subcommand
Definition: tool_common.hpp:20
zethtool::generic_subcommand::curve
std::string curve
Definition: tool_common.hpp:135
snark
libzeth::defaults::snark snark
Definition: prover_server.cpp:30