Back-end utility functions

The following functions can be used in your validator and assimilator code:


int get_output_file_path(RESULT const&, std::string&);

Returns the path of a result's output file (parses result.xml_doc_out and computes the file's position in the hierarchical directory structure).

int get_output_file_paths(RESULT const&, vector<string>&);

Same, for multiple output files.


int try_fopen(char* path, FILE*& f, char* mode);

Open a file, distinguishing between recoverable and nonrecoverable errors. Returns zero on success. Returns ERR_FOPEN if the directory is present but not the file (this is considered a nonrecoverable error). Returns ERR_OPENDIR if the directory is not there (this is generally a recoverable error, like NFS mount failure).


double median_mean_credit(vector<RESULT> const& results);

Given a vector of N correct results, computes a canonical credit as follows:

  • if N==1, return that result's claimed credit
  • if N==2, return min of claimed credits
  • if N>2, toss out high and low claimed credit, and return the average of the rest.

If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.