当前位置: 首页>>代码示例>>C++>>正文


C++ PROJECT类代码示例

本文整理汇总了C++中PROJECT的典型用法代码示例。如果您正苦于以下问题:C++ PROJECT类的具体用法?C++ PROJECT怎么用?C++ PROJECT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PROJECT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: find_project_with_overdue_results

// find a project with finished results that should be reported.
// This means:
//    - we're not backing off contacting the project
//    - the result is ready_to_report (compute done; files uploaded)
//    - we're within a day of the report deadline,
//      or at least a day has elapsed since the result was completed,
//      or we have a sporadic connection
//
PROJECT* CLIENT_STATE::find_project_with_overdue_results() {
    unsigned int i;
    RESULT* r;

    for (i=0; i<results.size(); i++) {
        r = results[i];
        if (!r->ready_to_report) continue;

        PROJECT* p = r->project;
        if (p->waiting_until_min_rpc_time()) continue;
        if (p->suspended_via_gui) continue;

        if (config.report_results_immediately) {
            return p;
        }

        if (net_status.have_sporadic_connection) {
            return p;
        }

        double cushion = std::max(REPORT_DEADLINE_CUSHION, work_buf_min());
        if (gstate.now > r->report_deadline - cushion) {
            return p;
        }

        if (gstate.now > r->completed_time + SECONDS_PER_DAY) {
            return p;
        }
    }
    return 0;
}
开发者ID:freehal,项目名称:boinc-freehal,代码行数:39,代码来源:cs_scheduler.cpp

示例2: do_backoff

// per-file backoff policy: sets next_request_time
//
void PERS_FILE_XFER::do_backoff() {
    double backoff = 0;

    // don't count it as a server failure if network is down
    //
    if (!net_status.need_physical_connection) {
        nretry++;
    }

    // keep track of transient failures per project (not currently used)
    //
    PROJECT* p = fip->project;
    p->file_xfer_backoff(is_upload).file_xfer_failed(p);

    // Do an exponential backoff of e^nretry seconds,
    // keeping within the bounds of pers_retry_delay_min and
    // pers_retry_delay_max
    //
    backoff = calculate_exponential_backoff(
        nretry, gstate.pers_retry_delay_min, gstate.pers_retry_delay_max
    );
    next_request_time = gstate.now + backoff;
    msg_printf(fip->project, MSG_INFO,
        "Backing off %s on %s of %s",
        timediff_format(backoff).c_str(),
        is_upload?"upload":"download",
        fip->name
    );
}
开发者ID:Gspohu,项目名称:Crowdcomputing,代码行数:31,代码来源:pers_file_xfer.cpp

示例3: global_prefs_source_project

void CLIENT_STATE::show_global_prefs_source(bool found_venue) {
    PROJECT* pp = global_prefs_source_project();
    if (pp) {
        msg_printf(pp, MSG_INFO,
            "General prefs: from %s (last modified %s)",
            pp->get_project_name(), time_to_string(global_prefs.mod_time)
        );
    } else {
        msg_printf(NULL, MSG_INFO,
            "General prefs: from %s (last modified %s)",
            global_prefs.source_project,
            time_to_string(global_prefs.mod_time)
        );
    }
    if (strlen(main_host_venue)) {
        msg_printf(pp, MSG_INFO, "Computer location: %s", main_host_venue);
        if (found_venue) {
            msg_printf(NULL, MSG_INFO,
                "General prefs: using separate prefs for %s", main_host_venue
            );
        } else {
            msg_printf(pp, MSG_INFO,
                "General prefs: no separate prefs for %s; using your defaults",
                main_host_venue
            );
        }
    } else {
        msg_printf(pp, MSG_INFO, "Host location: none");
        msg_printf(pp, MSG_INFO, "General prefs: using your defaults");
    }
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:31,代码来源:cs_prefs.cpp

示例4: find_project_with_overdue_results

// find a project with finished results that should be reported.
// This means:
//    - we're not backing off contacting the project
//    - no upload for that project is active
//    - the result is ready_to_report (compute done; files uploaded)
//    - we're within a day of the report deadline,
//      or at least a day has elapsed since the result was completed,
//      or we have a sporadic connection
//      or the project is in "don't request more work" state
//      or a network suspend period is coming up soon
//      or the project has > RESULT_REPORT_IF_AT_LEAST_N results ready to report
//
PROJECT* CLIENT_STATE::find_project_with_overdue_results(
    bool network_suspend_soon
) {
    unsigned int i;
    RESULT* r;

    for (i=0; i<projects.size(); i++) {
        PROJECT* p = projects[i];
        p->n_ready = 0;
        p->dont_contact = false;
        if (p->waiting_until_min_rpc_time()) p->dont_contact = true;
        if (p->suspended_via_gui) p->dont_contact = true;
#ifndef SIM
        if (actively_uploading(p)) p->dont_contact = true;
#endif
    }

    for (i=0; i<results.size(); i++) {
        r = results[i];
        if (!r->ready_to_report) continue;

        PROJECT* p = r->project;
        if (p->dont_contact) continue;

        if (p->dont_request_more_work) {
            return p;
        }

        if (r->report_immediately) {
            return p;
        }

        if (config.report_results_immediately) {
            return p;
        }

        if (net_status.have_sporadic_connection) {
            return p;
        }

        if (network_suspend_soon) {
            return p;
        }

        double cushion = std::max(REPORT_DEADLINE_CUSHION, work_buf_min());
        if (gstate.now > r->report_deadline - cushion) {
            return p;
        }

        if (gstate.now > r->completed_time + SECONDS_PER_DAY) {
            return p;
        }

        p->n_ready++;
        if (p->n_ready >= RESULT_REPORT_IF_AT_LEAST_N) {
            return p;
        }
    }
    return 0;
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:72,代码来源:cs_scheduler.cpp

示例5: get_disk_usages

// populate:
// PROJECT::disk_usage for all projects
// GLOBAL_STATE::client_disk_usage
// GLOBAL_STATE::total_disk_usage
//
int CLIENT_STATE::get_disk_usages() {
    unsigned int i;
    double size;
    PROJECT* p;
    int retval;
    char buf[MAXPATHLEN];

    client_disk_usage = 0;
    total_disk_usage = 0;
    for (i=0; i<projects.size(); i++) {
        p = projects[i];
        p->disk_usage = 0;
        retval = dir_size(p->project_dir(), size);
        if (!retval) p->disk_usage = size;
    }

    for (i=0; i<active_tasks.active_tasks.size(); i++) {
        ACTIVE_TASK* atp = active_tasks.active_tasks[i];
        get_slot_dir(atp->slot, buf, sizeof(buf));
        retval = dir_size(buf, size);
        if (retval) continue;
        atp->wup->project->disk_usage += size;
    }
    for (i=0; i<projects.size(); i++) {
        p = projects[i];
        total_disk_usage += p->disk_usage;
    }
    retval = dir_size(".", size, false);
    if (!retval) {
        client_disk_usage = size;
        total_disk_usage += size;
    }
    return 0;
}
开发者ID:zx1340,项目名称:boinc,代码行数:39,代码来源:cs_prefs.cpp

示例6: check_anonymous

// look for app_versions.xml file in project dir.
// If find, get app versions from there,
// and use "anonymous platform" mechanism for this project
//
void CLIENT_STATE::check_anonymous() {
    unsigned int i;
    char path[MAXPATHLEN];
    FILE* f;
    int retval;

    for (i=0; i<projects.size(); i++) {
        PROJECT* p = projects[i];
        sprintf(path, "%s/%s", p->project_dir(), APP_INFO_FILE_NAME);
        f = fopen(path, "r");
        if (!f) continue;
        msg_printf(p, MSG_INFO,
            "Found %s; using anonymous platform", APP_INFO_FILE_NAME
        );

        p->anonymous_platform = true;
            // flag as anonymous even if can't parse file
        retval = parse_app_info(p, f);
        if (retval) {
            msg_printf_notice(p, false,
                "http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=app_info",
                "%s",
                _("Syntax error in app_info.xml")
            );
        }
        fclose(f);
    }
}
开发者ID:Wizardofoddz,项目名称:boinc,代码行数:32,代码来源:cs_statefile.cpp

示例7: handle_project_resume

static void handle_project_resume(GUI_RPC_CONN& grc) {
    PROJECT* p = get_project_parse(grc);
    if (!p) return;
    gstate.set_client_state_dirty("Project modified by user");
    msg_printf(p, MSG_INFO, "project resumed by user");
    p->resume();
    grc.mfout.printf("<success/>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:8,代码来源:gui_rpc_server_ops.cpp

示例8: handle_get_project_status

static void handle_get_project_status(MIOFILE& fout) {
    unsigned int i;
    fout.printf("<projects>\n");
    for (i=0; i<gstate.projects.size(); i++) {
        PROJECT* p = gstate.projects[i];
        p->write_state(fout, true);
    }
    fout.printf("</projects>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:9,代码来源:gui_rpc_server_ops.cpp

示例9: handle_get_project_status

static void handle_get_project_status(GUI_RPC_CONN& grc) {
    unsigned int i;
    grc.mfout.printf("<projects>\n");
    for (i=0; i<gstate.projects.size(); i++) {
        PROJECT* p = gstate.projects[i];
        p->write_state(grc.mfout, true);
    }
    grc.mfout.printf("</projects>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:9,代码来源:gui_rpc_server_ops.cpp

示例10: handle_get_simple_gui_info

static void handle_get_simple_gui_info(MIOFILE& fout) {
    unsigned int i;
    fout.printf("<simple_gui_info>\n");
    for (i=0; i<gstate.projects.size(); i++) {
        PROJECT* p = gstate.projects[i];
        p->write_state(fout, true);
    }
    gstate.write_tasks_gui(fout, false);
    fout.printf("</simple_gui_info>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:10,代码来源:gui_rpc_server_ops.cpp

示例11: handle_get_simple_gui_info

static void handle_get_simple_gui_info(GUI_RPC_CONN& grc) {
    unsigned int i;
    grc.mfout.printf("<simple_gui_info>\n");
    for (i=0; i<gstate.projects.size(); i++) {
        PROJECT* p = gstate.projects[i];
        p->write_state(grc.mfout, true);
    }
    gstate.write_tasks_gui(grc.mfout, true);
    grc.mfout.printf("</simple_gui_info>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:10,代码来源:gui_rpc_server_ops.cpp

示例12: handle_project_op

static void handle_project_op(char* buf, MIOFILE& fout, const char* op) {
    PROJECT* p = get_project(buf, fout);
    if (!p) {
        fout.printf("<error>no such project</error>\n");
        return;
    }
    gstate.set_client_state_dirty("Project modified by user");
    if (!strcmp(op, "reset")) {
        gstate.request_schedule_cpus("project reset by user");
        gstate.request_work_fetch("project reset by user");
        gstate.reset_project(p, false);
    } else if (!strcmp(op, "suspend")) {
        msg_printf(p, MSG_INFO, "suspended by user");
        p->suspend();
    } else if (!strcmp(op, "resume")) {
        msg_printf(p, MSG_INFO, "resumed by user");
        p->resume();
    } else if (!strcmp(op, "detach")) {
        if (p->attached_via_acct_mgr) {
            msg_printf(p, MSG_INFO,
                "This project must be detached using the account manager web site."
            );
            fout.printf("<error>must detach using account manager</error>");
            return;
        }
        gstate.detach_project(p);
        gstate.request_schedule_cpus("project detached by user");
        gstate.request_work_fetch("project detached by user");
    } else if (!strcmp(op, "update")) {
        msg_printf(p, MSG_INFO, "update requested by user");
        p->sched_rpc_pending = RPC_REASON_USER_REQ;
        p->min_rpc_time = 0;
#if 1
        rss_feeds.trigger_fetch(p);
#endif
        gstate.request_work_fetch("project updated by user");
    } else if (!strcmp(op, "nomorework")) {
        msg_printf(p, MSG_INFO, "work fetch suspended by user");
        p->dont_request_more_work = true;
    } else if (!strcmp(op, "allowmorework")) {
        msg_printf(p, MSG_INFO, "work fetch resumed by user");
        p->dont_request_more_work = false;
        gstate.request_work_fetch("project allowed to fetch work by user");
    } else if (!strcmp(op, "detach_when_done")) {
        msg_printf(p, MSG_INFO, "detach when done set by user");
        p->detach_when_done = true;
        p->dont_request_more_work = true;
    } else if (!strcmp(op, "dont_detach_when_done")) {
        msg_printf(p, MSG_INFO, "detach when done cleared by user");
        p->detach_when_done = false;
        p->dont_request_more_work = false;
    }
    fout.printf("<success/>\n");
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:54,代码来源:gui_rpc_server_ops.cpp

示例13: parse_account_files_venue

int CLIENT_STATE::parse_account_files_venue() {
    unsigned int i;

    for (i=0; i<projects.size(); i++) {
        PROJECT* p = projects[i];
        if (strlen(p->host_venue)) {
            p->parse_account_file_venue();
        }
    }
    return 0;
}
开发者ID:FoxKyong,项目名称:boinc,代码行数:11,代码来源:cs_account.cpp

示例14: check_project_timeout

void CLIENT_STATE::check_project_timeout() {
    unsigned int i;
    for (i=0; i<projects.size(); i++) {
        PROJECT* p = projects[i];
        if (p->possibly_backed_off && now > p->min_rpc_time) {
            p->possibly_backed_off = false;
            char buf[256];
            sprintf(buf, "Backoff ended for %s", p->get_project_name());
            request_work_fetch(buf);
        }
    }
}
开发者ID:khandesh,项目名称:boinc,代码行数:12,代码来源:cs_scheduler.cpp

示例15: switch

// find a project for which a scheduler RPC has been requested
// - by user
// - by an account manager
// - by the project
// - because the project was just attached (for verification)
//
PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() {
    unsigned int i;
    PROJECT* p;

    for (i=0; i<projects.size(); i++) {
        p = projects[i];
        bool honor_backoff = true;
        bool honor_suspend = true;

        // is a scheduler-requested RPC due?
        //
        if (!p->sched_rpc_pending && p->next_rpc_time && p->next_rpc_time<now) {
            // don't do it if project is set to no new work
            // and has no jobs currently
            //
            if (!p->dont_request_more_work || p->has_results()) {
                p->sched_rpc_pending = RPC_REASON_PROJECT_REQ;
            }
        }

        switch (p->sched_rpc_pending) {
        case RPC_REASON_USER_REQ:
            honor_backoff = false;
            honor_suspend = false;
            break;
        case RPC_REASON_RESULTS_DUE:
            break;
        case RPC_REASON_NEED_WORK:
            break;
        case RPC_REASON_TRICKLE_UP:
            break;
        case RPC_REASON_ACCT_MGR_REQ:
            // This is critical for acct mgrs, to propagate new host CPIDs
            honor_suspend = false;
            break;
        case RPC_REASON_INIT:
            break;
        case RPC_REASON_PROJECT_REQ:
            break;
        }
        if (honor_backoff && p->waiting_until_min_rpc_time()) {
            continue;
        }
        if (honor_suspend && p->suspended_via_gui) {
            continue;
        }
        if (p->sched_rpc_pending) {
            return p;
        }
    }
    return 0;
}
开发者ID:khandesh,项目名称:boinc,代码行数:58,代码来源:cs_scheduler.cpp


注:本文中的PROJECT类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。