2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2003-08-14 00:02:15 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2003-08-14 00:02:15 +00:00
|
|
|
|
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
|
|
|
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
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
|
|
|
|
2005-02-16 23:17:43 +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$";
|