-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.h
executable file
·52 lines (40 loc) · 1.51 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _UTILS_H
#define _UTILS_H
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <set>
#include <cmath>
#include <boost/regex.hpp>
#include "strtokenizer.h"
#include "model.h"
#include "transmit.h"
using namespace std;
class model;
class utils {
public:
// parse command line arguments
static int parse_args(int argc, char ** argv, model * pmodel, int& port);
// read and parse model parameters from <model_name>.others
static int read_and_parse(string filename, model * model);
// generate the model name for the current iteration
// iter = -1 => final model
static string generate_model_name(int iter);
static vector<int> findCommon(vector<vector<int>* >& all, int size, int M);
static void genInf(vector<int> candidate);
static double stod(const string& str);
static void show_help();
// sort
static pair<int, double> quicksort_wr(vector<pair<int, double> > vect, int left, int right);
static void quicksort(vector<pair<int, double> > & vect, int left, int right);
static void readfile(string ofile, ofstream& fout, strtokenizer& strtok);
static void readfile(string ofile, strtokenizer& strtok);
static void addfile(string name, vector<string>& pathset, vector<string>::size_type& size);
static void addfile(string name, ofstream& fout, strtokenizer& strtok, vector<pair<string, int> >& classes, int& size);
};
#endif