本文整理汇总了C++中MIOFILE::printf方法的典型用法代码示例。如果您正苦于以下问题:C++ MIOFILE::printf方法的具体用法?C++ MIOFILE::printf怎么用?C++ MIOFILE::printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MIOFILE
的用法示例。
在下文中一共展示了MIOFILE::printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_get_cc_status
static void handle_get_cc_status(GUI_RPC_CONN* gr, MIOFILE& fout) {
fout.printf(
"<cc_status>\n"
" <network_status>%d</network_status>\n"
" <ams_password_error>%d</ams_password_error>\n"
" <task_suspend_reason>%d</task_suspend_reason>\n"
" <task_mode>%d</task_mode>\n"
" <task_mode_perm>%d</task_mode_perm>\n"
" <task_mode_delay>%f</task_mode_delay>\n"
" <gpu_suspend_reason>%d</gpu_suspend_reason>\n"
" <gpu_mode>%d</gpu_mode>\n"
" <gpu_mode_perm>%d</gpu_mode_perm>\n"
" <gpu_mode_delay>%f</gpu_mode_delay>\n"
" <network_suspend_reason>%d</network_suspend_reason>\n"
" <network_mode>%d</network_mode>\n"
" <network_mode_perm>%d</network_mode_perm>\n"
" <network_mode_delay>%f</network_mode_delay>\n"
" <disallow_attach>%d</disallow_attach>\n"
" <simple_gui_only>%ds</simple_gui_only>\n",
net_status.network_status(),
gstate.acct_mgr_info.password_error?1:0,
gstate.suspend_reason,
gstate.run_mode.get_current(),
gstate.run_mode.get_perm(),
gstate.run_mode.delay(),
gpu_suspend_reason,
gstate.gpu_mode.get_current(),
gstate.gpu_mode.get_perm(),
gstate.gpu_mode.delay(),
gstate.network_suspend_reason,
gstate.network_mode.get_current(),
gstate.network_mode.get_perm(),
gstate.network_mode.delay(),
config.disallow_attach?1:0,
config.simple_gui_only?1:0
);
if (gr->au_mgr_state == AU_MGR_QUIT_REQ) {
fout.printf(
" <manager_must_quit>1</manager_must_quit>\n"
);
gr->au_mgr_state = AU_MGR_QUIT_SENT;
}
fout.printf(
"</cc_status>\n"
);
}
示例2: handle_get_screensaver_tasks
static void handle_get_screensaver_tasks(MIOFILE& fout) {
unsigned int i;
ACTIVE_TASK* atp;
fout.printf(
"<handle_get_screensaver_tasks>\n"
" <suspend_reason>%d</suspend_reason>\n",
gstate.suspend_reason
);
for (i=0; i<gstate.active_tasks.active_tasks.size(); i++) {
atp = gstate.active_tasks.active_tasks[i];
if ((atp->task_state() == PROCESS_EXECUTING) ||
((atp->task_state() == PROCESS_SUSPENDED) && (gstate.suspend_reason == SUSPEND_REASON_CPU_THROTTLE))) {
atp->result->write_gui(fout);
}
}
fout.printf("</handle_get_screensaver_tasks>\n");
}
示例3: write
// Write time statistics
// to_remote means GUI RPC reply; else writing client state file
//
int CLIENT_TIME_STATS::write(MIOFILE& out, bool to_remote) {
out.printf(
"<time_stats>\n"
" <on_frac>%f</on_frac>\n"
" <connected_frac>%f</connected_frac>\n"
" <cpu_and_network_available_frac>%f</cpu_and_network_available_frac>\n"
" <active_frac>%f</active_frac>\n"
" <gpu_active_frac>%f</gpu_active_frac>\n"
" <client_start_time>%f</client_start_time>\n"
" <total_start_time>%f</total_start_time>\n"
" <total_duration>%f</total_duration>\n"
" <total_active_duration>%f</total_active_duration>\n"
" <total_gpu_active_duration>%f</total_gpu_active_duration>\n",
on_frac,
connected_frac,
cpu_and_network_available_frac,
active_frac,
gpu_active_frac,
client_start_time,
total_start_time,
total_duration,
total_active_duration,
total_gpu_active_duration
);
if (to_remote) {
out.printf(
" <now>%f</now>\n"
" <previous_uptime>%f</previous_uptime>\n"
" <session_active_duration>%f</session_active_duration>\n"
" <session_gpu_active_duration>%f</session_gpu_active_duration>\n",
gstate.now,
previous_uptime,
session_active_duration,
session_gpu_active_duration
);
} else {
out.printf(
" <previous_uptime>%f</previous_uptime>\n"
" <last_update>%f</last_update>\n",
gstate.now - client_start_time,
last_update
);
}
out.printf("</time_stats>\n");
return 0;
}
示例4: read_all_projects_list_file
static void read_all_projects_list_file(MIOFILE& fout) {
string s;
int retval = read_file_string(ALL_PROJECTS_LIST_FILENAME, s);
if (!retval) {
strip_whitespace(s);
fout.printf("%s\n", s.c_str());
}
}
示例5: handle_get_cc_config
static void handle_get_cc_config(MIOFILE& fout) {
string s;
int retval = read_file_string(CONFIG_FILE, s);
if (!retval) {
strip_whitespace(s);
fout.printf("%s\n", s.c_str());
}
}
示例6: handle_get_newer_version
static void handle_get_newer_version(MIOFILE& fout) {
fout.printf(
"<newer_version>%s</newer_version>\n"
"<download_url>%s</download_url>\n",
gstate.newer_version.c_str(),
config.client_download_url.c_str()
);
}
示例7: handle_create_account
void GUI_RPC_CONN::handle_create_account(char* buf, MIOFILE& fout) {
ACCOUNT_IN ai;
ai.parse(buf);
create_account_op.do_rpc(ai);
fout.printf("<success/>\n");
}
示例8: write_platforms
// write XML list of supported platforms
//
void CLIENT_STATE::write_platforms(PROJECT* p, MIOFILE& mf) {
mf.printf(
" <platform_name>%s</platform_name>\n",
p->anonymous_platform ? "anonymous" : get_primary_platform()
);
for (unsigned int i=1; i<platforms.size(); i++) {
PLATFORM& platform = platforms[i];
mf.printf(
" <alt_platform>\n"
" <name>%s</name>\n"
" </alt_platform>\n",
platform.name.c_str()
);
}
}
示例9: write_xml
void COPROC::write_xml(MIOFILE& f, bool scheduler_rpc) {
f.printf(
"<coproc>\n"
" <type>%s</type>\n"
" <count>%d</count>\n",
type, count
);
if (scheduler_rpc) {
write_request(f);
}
if (have_opencl) {
opencl_prop.write_xml(f, "coproc_opencl");
}
f.printf("</coproc>\n");
}
示例10: handle_get_project_config
void GUI_RPC_CONN::handle_get_project_config(char* buf, MIOFILE& fout) {
string url;
parse_str(buf, "<url>", url);
canonicalize_master_url(url);
get_project_config_op.do_rpc(url);
fout.printf("<success/>\n");
}
示例11: handle_acct_mgr_rpc_poll
static void handle_acct_mgr_rpc_poll(char*, MIOFILE& fout) {
fout.printf(
"<acct_mgr_rpc_reply>\n"
);
if (gstate.acct_mgr_op.error_str.size()) {
fout.printf(
" <message>%s</message>\n",
gstate.acct_mgr_op.error_str.c_str()
);
}
fout.printf(
" <error_num>%d</error_num>\n",
gstate.acct_mgr_op.error_num
);
fout.printf(
"</acct_mgr_rpc_reply>\n"
);
}
示例12: write_coproc_info_file
int COPROCS::write_coproc_info_file(vector<string> &warnings) {
MIOFILE mf;
unsigned int i, temp;
FILE* f;
f = boinc_fopen(COPROC_INFO_FILENAME, "wb");
if (!f) return ERR_FOPEN;
mf.init_file(f);
mf.printf(" <coprocs>\n");
for (i=0; i<ati_gpus.size(); ++i) {
ati_gpus[i].write_xml(mf, false);
}
for (i=0; i<nvidia_gpus.size(); ++i) {
temp = nvidia_gpus[i].count;
nvidia_gpus[i].count = 1;
nvidia_gpus[i].pci_infos[0] = nvidia_gpus[i].pci_info;
nvidia_gpus[i].write_xml(mf, false);
nvidia_gpus[i].count = temp;
}
for (i=0; i<intel_gpus.size(); ++i) {
intel_gpus[i].write_xml(mf, false);
}
for (i=0; i<ati_opencls.size(); ++i) {
ati_opencls[i].write_xml(mf, "ati_opencl", true);
}
for (i=0; i<nvidia_opencls.size(); ++i) {
nvidia_opencls[i].write_xml(mf, "nvidia_opencl", true);
}
for (i=0; i<intel_gpu_opencls.size(); ++i) {
intel_gpu_opencls[i].write_xml(mf, "intel_gpu_opencl", true);
}
for (i=0; i<cpu_opencls.size(); i++) {
cpu_opencls[i].write_xml(mf);
}
for (i=0; i<warnings.size(); ++i) {
mf.printf("<warning>%s</warning>\n", warnings[i].c_str());
}
mf.printf(" </coprocs>\n");
fclose(f);
return 0;
}
示例13: write
int CERT_SIGS::write(MIOFILE &f) {
if (this->signatures.size()==0) return true;
f.printf("<signatures>\n");
for(unsigned int i=0;i < this->signatures.size(); i++) {
f.printf(" <entry>\n");
f.printf(" <signature>\n%s\n", this->signatures.at(i).signature);
f.printf(" </signature>\n");
f.printf(" <subject>%s</subject>\n", this->signatures.at(i).subject);
f.printf(" <type>%s</type>\n", (this->signatures.at(i).type == MD5_HASH) ? "md5" : "sha1");
f.printf(" <hash>%s</hash>\n", this->signatures.at(i).hash);
f.printf(" </entry>\n");
}
f.printf("</signatures>\n");
return true;
}
示例14: handle_result_show_graphics
static void handle_result_show_graphics(char* buf, MIOFILE& fout) {
string result_name;
GRAPHICS_MSG gm;
ACTIVE_TASK* atp;
if (match_tag(buf, "<full_screen/>")) {
gm.mode = MODE_FULLSCREEN;
} else if (match_tag(buf, "<hide/>")) {
gm.mode = MODE_HIDE_GRAPHICS;
} else {
gm.mode = MODE_WINDOW;
}
parse_str(buf, "<window_station>", gm.window_station, sizeof(gm.window_station));
parse_str(buf, "<desktop>", gm.desktop, sizeof(gm.desktop));
parse_str(buf, "<display>", gm.display, sizeof(gm.display));
if (parse_str(buf, "<result_name>", result_name)) {
PROJECT* p = get_project(buf, fout);
if (!p) {
fout.printf("<error>No such project</error>\n");
return;
}
RESULT* rp = gstate.lookup_result(p, result_name.c_str());
if (!rp) {
fout.printf("<error>No such result</error>\n");
return;
}
atp = gstate.lookup_active_task_by_result(rp);
if (!atp) {
fout.printf("<error>no such result</error>\n");
return;
}
atp->request_graphics_mode(gm);
} else {
for (unsigned int i=0; i<gstate.active_tasks.active_tasks.size(); i++) {
atp = gstate.active_tasks.active_tasks[i];
if (atp->scheduler_state != CPU_SCHED_SCHEDULED) continue;
atp->request_graphics_mode(gm);
}
}
fout.printf("<success/>\n");
}
示例15: handle_project_attach_poll
static void handle_project_attach_poll(char*, MIOFILE& fout) {
unsigned int i;
fout.printf(
"<project_attach_reply>\n"
);
for (i=0; i<gstate.project_attach.messages.size(); i++) {
fout.printf(
" <message>%s</message>\n",
gstate.project_attach.messages[i].c_str()
);
}
fout.printf(
" <error_num>%d</error_num>\n",
gstate.project_attach.error_num
);
fout.printf(
"</project_attach_reply>\n"
);
}