-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriverInputT.h
32 lines (26 loc) · 1.08 KB
/
DriverInputT.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
//
// Created by Matilde Pulidori on 24/05/2020.
//
#ifndef LABORATORIO3_2020_DRIVER_H
#define LABORATORIO3_2020_DRIVER_H
#include <map>
#include <fstream>
#include <iostream>
#import "MapperInputT.h"
#import "ReducerInputT.h"
#import "ResultT.h"
class DriverInputT {
private:
std::string filename;
template<typename MapperInputT, typename ResultT> using mapfun = std::vector<ResultT> (*)(const MapperInputT &input);
template<typename ReducerInputT, typename ResultT> using reducefun = ResultT (*)(const ReducerInputT &input);
template<typename T> using write_to_pipe = std::vector<T> (*)(int fd, const T& obj);
template<typename T> using read_from_pipe = T (*)(int fd);
public:
explicit DriverInputT(std::string input);
~DriverInputT();
std::string getFilename();
std::map<std::string, ResultT> mapreduce(mapfun<MapperInputT,ResultT> mapfunct, reducefun<ReducerInputT, ResultT> reducefunct);
std::map<std::string, ResultT> mapreducePipe(mapfun<MapperInputT,ResultT> mapfunct, reducefun<ReducerInputT, ResultT> reducefunct);
};
#endif //LABORATORIO3_2020_DRIVER_H