<commit_before>/* 
 * File:   VirtualJudger.h
 * Author: 51isoft
 *
 * Created on 2014年1月31日, 下午9:08
 */

#ifndef VIRTUALJUDGER_H
#define	VIRTUALJUDGER_H

#include "vjudge.h"
#include "SocketHandler.h"
#include "JudgerInfo.h"
#include "Bott.h"



class VirtualJudger {
public:
    VirtualJudger(JudgerInfo *);
    virtual ~VirtualJudger();
    virtual void judge(Bott * bott, string filename);
    void run();
    
    static const int MIN_SOURCE_LENGTH;
    static const int SLEEP_INTERVAL;
    
    // submit status code
    static const int SUBMIT_NORMAL;
    static const int SUBMIT_SAME_CODE;
    static const int SUBMIT_INVALID_LANGUAGE;
    static const int SUBMIT_COMPILE_ERROR;
    static const int SUBMIT_OTHER_ERROR;
protected:
    void log(string);
    void generateSpecialResult(Bott *, string);
    void clearCookies();
    bool isFinalResult(string);
    
    /**
     * Send handshake message, called in run()
     */
    virtual void initHandShake() = 0;
    /**
     * Login to reomote OJ
     */
    virtual void login() = 0;
    /**
     * Submit run to remote OJ
     * @param bott      Bott file for Run info
     */
    virtual int submit(Bott * bott) = 0;
    /**
     * Get result and related info
     * @param bott      Original Bott info
     * @return Result Bott file
     */
    virtual Bott * getStatus(Bott * bott) = 0;
    
    /**
     * Get compile error info from remote OJ
     * @param bott      Result bott file
     * @return Compile error info
     */
    virtual string getCEinfo(Bott * bott) = 0;
    
    void prepareCurl();
    void performCurl();
    SocketHandler * socket;
    JudgerInfo * info;
    string tmpfilename;
    string cookiefilename;
    // language convertion table, convert local language to remote ones
    map <string, string> language_table;
    bool logged_in;
    
    CURL * curl;
    FILE * curl_file;
};

#endif	/* VIRTUALJUDGER_H */

<commit_msg>update initHandShake() comment<commit_after>/* 
 * File:   VirtualJudger.h
 * Author: 51isoft
 *
 * Created on 2014年1月31日, 下午9:08
 */

#ifndef VIRTUALJUDGER_H
#define	VIRTUALJUDGER_H

#include "vjudge.h"
#include "SocketHandler.h"
#include "JudgerInfo.h"
#include "Bott.h"



class VirtualJudger {
public:
    VirtualJudger(JudgerInfo *);
    virtual ~VirtualJudger();
    virtual void judge(Bott * bott, string filename);
    void run();
    
    static const int MIN_SOURCE_LENGTH;
    static const int SLEEP_INTERVAL;
    
    // submit status code
    static const int SUBMIT_NORMAL;
    static const int SUBMIT_SAME_CODE;
    static const int SUBMIT_INVALID_LANGUAGE;
    static const int SUBMIT_COMPILE_ERROR;
    static const int SUBMIT_OTHER_ERROR;
protected:
    void log(string);
    void generateSpecialResult(Bott *, string);
    void clearCookies();
    bool isFinalResult(string);
    
    /**
     * Send handshake message to dispatcher
     */
    virtual void initHandShake() = 0;
    /**
     * Login to reomote OJ
     */
    virtual void login() = 0;
    /**
     * Submit run to remote OJ
     * @param bott      Bott file for Run info
     */
    virtual int submit(Bott * bott) = 0;
    /**
     * Get result and related info
     * @param bott      Original Bott info
     * @return Result Bott file
     */
    virtual Bott * getStatus(Bott * bott) = 0;
    
    /**
     * Get compile error info from remote OJ
     * @param bott      Result bott file
     * @return Compile error info
     */
    virtual string getCEinfo(Bott * bott) = 0;
    
    void prepareCurl();
    void performCurl();
    SocketHandler * socket;
    JudgerInfo * info;
    string tmpfilename;
    string cookiefilename;
    // language convertion table, convert local language to remote ones
    map <string, string> language_table;
    bool logged_in;
    
    CURL * curl;
    FILE * curl_file;
};

#endif	/* VIRTUALJUDGER_H */


{'fraction_non_alphanumeric': 0.09008307372793355, 'fraction_numerical': 0.008826583592938734, 'mean_word_length': 2.5808550185873607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5078171', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1227, 'n_words': 369}