feature_maker.h
1.17 KB
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
52
53
54
55
56
57
58
59
60
#ifndef FEATURE_MAKER
#define FEATURE_MAKER
#include <vector>
#include <thread>
#include <functional>
#include <iostream>
#include "feature_callable.h"
#include "multithread/worker_callable_pool.h"
#include "Importer/entry.h"
#include "constant.h"
#include "feature.h"
#include "data/storage_worker.h"
namespace feature {
class Feature_maker{
protected:
std::thread t;
std::string id;
data::Data_Store *storage;
data::Storage_worker *storage_worker;
multithread::Worker_callable_pool<data::Data_basic*,data::Data_basic*> pool;
public:
Feature_maker(feature::Feature_callable *c,
multithread::Buffer<data::Data_basic*> *in,
data::Data_Store *out,
std::string id):
id(id),
storage(out),
pool(c,in,storage_worker = new data::Storage_worker(out)){
this->storage_worker->start();
this->pool.start();
}
virtual ~Feature_maker(){
this->join();
delete this->storage_worker;
}
void join(){
this->pool.join();
this->storage_worker->join();
}
std::string getId() const{
return this->id;
}
data::Data_Store* getStorage(){
return this->storage;
}
};
}
#endif // FEATURE_MAKER