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
61
62
63
64
65
66
67
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#include "libvideostitch/algorithm.hpp"
#include "registeredAlgo.hpp"
namespace VideoStitch {
namespace Util {
Algorithm::Algorithm() {}
Algorithm::~Algorithm() {}
void Algorithm::list(std::vector<std::string>& algos) {
algos.clear();
typedef RegisteredAlgoBase<false>::InstanceMap AlgoMap;
for (const AlgoMap::value_type& inst : RegisteredAlgoBase<false>::getInstances()) {
algos.push_back(inst.first);
}
}
const char* Algorithm::getDocString(const std::string& name) {
RegisteredAlgoBase<false>* reg = RegisteredAlgoBase<false>::getInstance(name);
if (reg) {
return reg->getDocString();
}
return nullptr;
}
Potential<Algorithm> Algorithm::create(const std::string& name, const Ptv::Value* config) {
RegisteredAlgoBase<false>* reg = RegisteredAlgoBase<false>::getInstance(name);
if (reg) {
return reg->create(config);
}
return {Origin::PanoramaConfiguration, ErrType::UnsupportedAction, "Unknown algorithm: '" + name + "'"};
}
OnlineAlgorithm::OnlineAlgorithm() {}
OnlineAlgorithm::~OnlineAlgorithm() {}
void OnlineAlgorithm::list(std::vector<std::string>& algos) {
algos.clear();
typedef RegisteredAlgoBase<true>::InstanceMap AlgoMap;
for (const AlgoMap::value_type& inst : RegisteredAlgoBase<true>::getInstances()) {
algos.push_back(inst.first);
}
}
const char* OnlineAlgorithm::getDocString(const std::string& name) {
RegisteredAlgoBase<false>* reg = RegisteredAlgoBase<false>::getInstance(name);
if (reg) {
return reg->getDocString();
}
return nullptr;
}
Potential<OnlineAlgorithm> OnlineAlgorithm::create(const std::string& name, const Ptv::Value* config) {
RegisteredAlgoBase<true>* reg = RegisteredAlgoBase<true>::getInstance(name);
if (reg) {
return reg->create(config);
}
return {Origin::PanoramaConfiguration, ErrType::UnsupportedAction, "Unknown algorithm: '" + name + "'"};
}
} // namespace Util
} // namespace VideoStitch