static boolean_t sfunc_targ_mode(ofmt_arg_t *ofmtarg, char *buf, uint_t bufsize) { ipmpstat_sfunc_arg_t *arg = ofmtarg->ofmt_cbarg; ipmp_targinfo_t *targinfop = arg->sa_data; enum2str(targ_mode, targinfop->it_targmode, buf, bufsize); return (B_TRUE); }
static boolean_t sfunc_group_state(ofmt_arg_t *ofmtarg, char *buf, uint_t bufsize) { ipmpstat_sfunc_arg_t *arg = ofmtarg->ofmt_cbarg; ipmp_groupinfo_t *grinfop = arg->sa_data; enum2str(group_state, grinfop->gr_state, buf, bufsize); return (B_TRUE); }
static boolean_t sfunc_if_state(ofmt_arg_t *ofmtarg, char *buf, uint_t bufsize) { ipmpstat_sfunc_arg_t *arg = ofmtarg->ofmt_cbarg; ipmp_ifinfo_t *ifinfop = arg->sa_data; enum2str(if_state, ifinfop->if_state, buf, bufsize); return (B_TRUE); }
// destructor, handle proper test shutdown Responder::~Responder() { endwin(); if(_pResponse != NULL){ delete[] _pResponse; } time( &_dbginfo.end_time ); // Print final info about test run print_final_statistics(); // check conditions and write statistics to file safe_write_statistics_to_file(_mapStats, _max_success, _return_code); cout << "program exited with code = " << enum2str(_return_code) << endl; }
/* option value to string ------------------------------------------------------ * convert option value to string * args : opt_t *opt I option * char *str O option value string * return : length of output string *-----------------------------------------------------------------------------*/ extern int opt2str(const opt_t *opt, char *str) { char *p=str; trace(3,"opt2str : name=%s\n",opt->name); switch (opt->format) { case 0: p+=sprintf(p,"%d" ,*(int *)opt->var); break; case 1: p+=sprintf(p,"%.15g",*(double*)opt->var); break; case 2: p+=sprintf(p,"%s" , (char *)opt->var); break; case 3: p+=enum2str(p,opt->comment,*(int *)opt->var); break; } return (int)(p-str); }
/// Show Poker card suit and point. void PokerCard::show() { LOG_INFO("Suit: %s, Point: %s", enum2str(suit()), enum2str(point())); }
EXPORT_DEF const char * dc_dtmf_setting2str(dc_dtmf_setting_t dtmf) { return enum2str(dtmf, dtmf_values, ITEMS_OF(dtmf_values)); }
// safe test results to a log file if enabled void Responder::write_log_file() { try { if(_opt.log_file){ std::map<std::string, std::string> hw_info = get_hw_info(); ofstream logs(_stats_log_filename.c_str()); logs << boost::format("title=%s") % _opt.test_title << endl; logs << boost::format("device=%s") % _usrp->get_mboard_name() << endl; logs << boost::format("device_args=%s") % _opt.device_args << endl; logs << boost::format("type=%s") % hw_info["type"] << endl; if (hw_info.size() > 0) { logs << boost::format("usrp_addr=%s") % hw_info["usrp_addr"] << endl; logs << boost::format("usrp_name=%s") % hw_info["name"] << endl; logs << boost::format("serial=%s") % hw_info["serial"] << endl; logs << boost::format("host_interface=%s") % hw_info["interface"] << endl; logs << boost::format("host_addr=%s") % hw_info["host_addr"] << endl; logs << boost::format("host_mac=%s") % hw_info["mac"] << endl; logs << boost::format("host_vendor=%s (id=%s)") % hw_info["vendor"] % hw_info["vendor_id"] << endl; logs << boost::format("host_device=%s (id=%s)") % hw_info["device"] % hw_info["device_id"] << endl; } logs << boost::format("sample_rate=%f") % _opt.sample_rate << endl; logs << boost::format("samps_per_buff=%i") % _opt.samps_per_buff << endl; logs << boost::format("samps_per_packet=%i") % _samps_per_packet << endl; logs << boost::format("delay_min=%f") % _opt.delay_min << endl; logs << boost::format("delay_max=%f") % _opt.delay_max << endl; logs << boost::format("delay_step=%f") % _delay_step << endl; logs << boost::format("delay=%f") % _delay << endl; logs << boost::format("init_delay=%f") % _opt.init_delay << endl; logs << boost::format("response_duration=%f") % _opt.response_duration << endl; logs << boost::format("response_length=%ld") % _response_length << endl; logs << boost::format("timeout=%f") % _opt.timeout << endl; logs << boost::format("timeout_burst_count=%ld") % _timeout_burst_count << endl; logs << boost::format("timeout_eob_count=%f") % _timeout_eob_count << endl; logs << boost::format("allow_late_bursts=%s") % (_allow_late_bursts ? "yes" : "no") << endl; logs << boost::format("skip_eob=%s") % (_opt.skip_eob ? "yes" : "no") << endl; logs << boost::format("combine_eob=%s") % (_opt.combine_eob ? "yes" : "no") << endl; logs << boost::format("skip_send=%s") % (_opt.skip_send ? "yes" : "no") << endl; logs << boost::format("no_delay=%s") % (_no_delay ? "yes" : "no") << endl; logs << boost::format("simulate_frequency=%f") % _simulate_frequency << endl; logs << boost::format("simulate_duration=%ld") % _simulate_duration << endl; logs << boost::format("original_simulate_duration=%ld") % _original_simulate_duration << endl; logs << boost::format("realtime=%s") % (_opt.realtime ? "yes" : "no") << endl; logs << boost::format("rt_priority=%f") % _opt.rt_priority << endl; logs << boost::format("test_iterations=%ld") % _opt.test_iterations << endl; logs << boost::format("end_test_after_success_count=%i") % _opt.end_test_after_success_count << endl; logs << boost::format("skip_iterations=%i") % _opt.skip_iterations << endl; logs << boost::format("overruns=%i") % _overruns << endl; logs << boost::format("num_total_samps=%ld") % _num_total_samps << endl; logs << boost::format("return_code=%i\t(%s)") % _return_code % enum2str(_return_code) << endl; logs << endl; write_debug_info(logs); if(uhd_error_msgs.length() > 0) { logs << endl << "%% UHD ERROR MESSAGES %%" << endl; logs << uhd_error_msgs; } } } catch(...) { cerr << "Failed to write log file to: " << _stats_log_filename << endl; } }
//ostream << weak_ordering std::ostream& operator<<( std::ostream& s, compare::weak_ordering const& x ) { return ( s << enum2str( x ) ); }