-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandlerFactory.cpp
More file actions
58 lines (48 loc) · 1.54 KB
/
HandlerFactory.cpp
File metadata and controls
58 lines (48 loc) · 1.54 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
#include "HandlerFactory.h"
#include "HandlerShip.h"
#include "HandlerSAR.h"
#include "HandlerYolo.h"
using namespace MQ;
std::shared_ptr<HandlerFactory> HandlerFactory::factory = 0;
HandlerFactory* HandlerFactory::instance()
{
if (!factory)
factory.reset(new HandlerFactory());
return factory.get();
}
HandlerFactory::HandlerFactory()
{
}
HandlerFactory::~HandlerFactory()
{
}
std::shared_ptr<HandlerBase> HandlerFactory::create(int handler_id_, const std::string& path_, const dev::ConfigParams *cp_)
{
//std::cout << "hbk in HandlerFactory::creat() ... and handler_id is " << handler_id_ << " \n";
std::unique_lock<std::mutex> lock(mtx);
switch(handler_id_) {
// check option BUILD_SHIP if ON or OFF
#ifdef USE_SHIP
case SHIP_METHOD_ID:
//std::cout << "in HandelFactory build with ship ... \n";
//std::cout << "\n case SHIP_METHOD_ID ... \n\n";
//return nullptr ;
return std::make_shared<detect::HandlerShip>(path_, cp_);
#endif
// check option BUILD_SAR if ON or OFF
#ifdef USE_SAR
case SAR_METHOD_ID:
//std::cout << "\n case SAR_METHOD_ID ... \n\n";
return std::make_shared<detect::HandlerSAR>(path_, cp_);
#endif
// check option BUILD_YOLO if ON or OFF
#ifdef USE_YOLO
case YOLO_METHOD_ID:
//std::cout << "in HandelFactory build with yolo ... \n";
//std::cout << "case Yolo_METHOD_ID ... \n";
return std::make_shared<detect::HandlerYolo>(path_, cp_);
#endif
default:
return 0;
}
}