2003-08-14 00:02:15 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2004-07-13 12:23:47 +00:00
|
|
|
// A sample validator that grants credit to any result whose CPU time is above
|
|
|
|
// a certain minimum
|
2004-03-17 01:26:44 +00:00
|
|
|
|
2003-08-14 00:02:15 +00:00
|
|
|
#include "validate_util.h"
|
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
using std::vector;
|
|
|
|
|
2004-10-04 23:59:51 +00:00
|
|
|
static const double MIN_CPU_TIME = 0;
|
2003-11-04 19:53:32 +00:00
|
|
|
|
2003-09-02 21:16:55 +00:00
|
|
|
int init_result_trivial(RESULT const& result, void*& data) {
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-09-02 21:16:55 +00:00
|
|
|
int check_pair_initialized_trivial(
|
2004-09-09 22:25:10 +00:00
|
|
|
RESULT & r1, void* /*data1*/,
|
2004-09-09 22:28:00 +00:00
|
|
|
RESULT const& r2, void* /*data2*/,
|
|
|
|
bool& match
|
2004-03-17 01:26:44 +00:00
|
|
|
) {
|
2004-09-09 22:28:00 +00:00
|
|
|
match = (r1.cpu_time >= MIN_CPU_TIME && r2.cpu_time >= MIN_CPU_TIME);
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-03-17 01:26:44 +00:00
|
|
|
int cleanup_result_trivial(RESULT const&, void*) {
|
2003-08-14 00:02:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-09-09 22:25:10 +00:00
|
|
|
int check_set(
|
2004-10-08 22:41:33 +00:00
|
|
|
vector<RESULT>& results, WORKUNIT&, int& canonicalid, double& credit,
|
2004-09-09 22:25:10 +00:00
|
|
|
bool& retry
|
|
|
|
) {
|
2004-09-09 21:52:20 +00:00
|
|
|
retry = false;
|
2004-11-03 22:13:13 +00:00
|
|
|
return generic_check_set(
|
2003-09-02 21:16:55 +00:00
|
|
|
results, canonicalid, credit,
|
|
|
|
init_result_trivial,
|
|
|
|
check_pair_initialized_trivial,
|
2004-11-03 22:13:13 +00:00
|
|
|
cleanup_result_trivial,
|
|
|
|
1
|
2003-09-02 21:16:55 +00:00
|
|
|
);
|
2003-08-14 00:02:15 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 22:25:10 +00:00
|
|
|
int check_pair(RESULT & r1, RESULT const& r2, bool& retry) {
|
2004-09-09 22:28:00 +00:00
|
|
|
bool match;
|
2004-09-09 22:25:10 +00:00
|
|
|
retry = false;
|
2004-09-09 22:28:00 +00:00
|
|
|
int retval = check_pair_initialized_trivial(
|
2004-03-17 01:26:44 +00:00
|
|
|
r1, NULL,
|
2004-09-09 22:28:00 +00:00
|
|
|
r2, NULL,
|
|
|
|
match
|
2004-03-17 01:26:44 +00:00
|
|
|
);
|
2004-09-09 22:28:00 +00:00
|
|
|
r1.validate_state = match?VALIDATE_STATE_VALID:VALIDATE_STATE_INVALID;
|
|
|
|
return retval;
|
2003-08-14 00:02:15 +00:00
|
|
|
}
|
|
|
|
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_f3a7a34795 = "$Id$";
|