-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutil.h
36 lines (35 loc) · 2.01 KB
/
util.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
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <io.h>
#include "type.h"
class Util {
private:
static std::vector<std::string> _allFiles;
static std::vector<std::vector<std::bitset<32>>> _finger_database;
static int _LoadFingerFromOneFile(std::string filepath_prefix, unsigned int fileNum);
static int _OutputFingerToOneFile(std::string filepath_prefix, unsigned int fileNum);
public:
static int LoadOneFile(std::string filepath, std::vector<unsigned int>& audio_fingers);
static std::vector<std::string> LoadDir(std::string dirpath, std::string type);
static void LoadDirSpecific(std::vector<std::vector<std::string>>& allQueryFiles, std::string dirpath, std::string type);
static int LoadIndex(std::string index_filepath, IndexType& index);
static int OutputIndex(std::string index_filepath, IndexType& index);
static int LoadFingerDatabase(std::string filepath_prefix);
static int OutputFingerToFile(std::string filepath_prefix);
static int DeleteSomeIndex(std::string index_filepath, std::set<int> remove_list);
static int DeleteSomeIndex(std::string index_filepath, std::string filepath);
static int DeleteFingerDatabase(std::string database_filepath, std::set<int> remove_list);
static int DeleteFingerDatabase(std::string database_filepath, std::string filepath);
static int IncrementalBuildIndex(std::string index_filepath, std::string dir_path);
static int IncrementalBuildFingerDatabase(std::string database_filepath, std::string dir_path);
static std::vector<std::bitset<32>> VectorIntToVectorBitset(std::vector<unsigned int> v);
static std::vector<unsigned int> VectorBitsetToVectorInt(std::vector<std::bitset<32>> v);
//ÒÔÉϺ¯Êý¾ù²âÊÔͨ¹ý
static int t_DeleteFingerDatabase(std::vector<std::vector<std::bitset<32>>>& finger_database, std::set<int> remove_list);
static int t_DeleteSomeIndex(IndexType& index, std::set<int> remove_list);
static int t_OutputFingerToFile(std::string filepath_prefix, std::vector<std::vector<std::bitset<32>>>& database);
};