int show_log_helper( command::log_opt_t& result, const command& cmd, const show_commands_t& show_commands ) { constexpr auto option = store_info<S>::option; if ( cmd.is_set( option ) ) { result = boost::any_cast<std::shared_ptr<show_store_entry<S>>>( show_commands.at( option ) )->log(); } return 0; }
int show_helper( bool& result, command& cmd, const environment::ptr& env, show_commands_t& show_commands, const std::string& dotname ) { constexpr auto option = store_info<S>::option; if ( cmd.is_set( option ) ) { result = boost::any_cast<std::shared_ptr<show_store_entry<S>>>( show_commands[option] )->operator()( env->store<S>().current(), dotname, cmd ); } return 0; }
void store_write_io_type<circuit, io_quipper_tag_t>( const circuit& circ, const std::string& filename, const command& cmd ) { if ( cmd.is_set( "ascii" ) ) { write_quipper_ascii( circ, filename ); } else { write_quipper( circ, filename ); } }
void store_write_io_type<circuit, io_tikz_tag_t>( const circuit& circ, const std::string& filename, const command& cmd ) { create_tikz_settings ct_settings; ct_settings.draw_io = !cmd.is_set( "hideio" ); std::ofstream os( filename.c_str() ); if ( cmd.is_set( "standalone" ) ) { os << "\\documentclass{standalone}" << std::endl << "\\usepackage{tikz}" << std::endl << std::endl << "\\begin{document}" << std::endl; } create_image( os, circ, ct_settings ); if ( cmd.is_set( "standalone" ) ) { os << "\\end{document}" << std::endl; } }
circuit store_read_io_type<circuit, io_real_tag_t>( const std::string& filename, const command& cmd ) { if ( cmd.is_set( "string" ) ) { return circuit_from_string( cmd.vm["string"].as<std::string>() ); } else { circuit circ; read_realization( circ, filename ); return circ; } }
binary_truth_table store_read_io_type<binary_truth_table, io_spec_tag_t>( const std::string& filename, const command& cmd ) { if ( cmd.is_set( "permutation" ) ) { std::vector<unsigned> perm; parse_string_list( perm, cmd.vm["permutation"].as<std::string>() ); return permutation_to_truth_table( perm ); } else { binary_truth_table spec; read_specification( spec, filename ); return spec; } }
bool show_store_entry<rcbdd>::operator()( rcbdd& bdd, const std::string& dotname, const command& cmd ) { using namespace std::placeholders; auto * fd = fopen( dotname.c_str(), "w" ); if ( cmd.is_set( "add" ) ) { bdd.manager().DumpDot( std::vector<ADD>{bdd.chi().Add()}, 0, 0, fd ); } else { bdd.manager().DumpDot( std::vector<BDD>{bdd.chi()}, 0, 0, fd ); } fclose( fd ); return true; }
inline command::rule_t file_exists_if_set( const command& cmd, const std::string& filename, const std::string& argname ) { return { [&cmd, filename, argname]() { return !cmd.is_set( argname ) || boost::filesystem::exists( filename ); }, argname + " does not exist" }; }