forked from jolibrain/deepdetect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputconnectorstrategy.h
115 lines (101 loc) · 2.83 KB
/
outputconnectorstrategy.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* DeepDetect
* Copyright (c) 2014-2015 Emmanuel Benazera
* Author: Emmanuel Benazera <[email protected]>
*
* This file is part of deepdetect.
*
* deepdetect is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* deepdetect is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with deepdetect. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUTPUTCONNECTORSTRATEGY_H
#define OUTPUTCONNECTORSTRATEGY_H
#include <map>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <Eigen/Dense>
#include "utils/utils.hpp"
namespace dd
{
typedef Eigen::MatrixXd dMat;
typedef Eigen::VectorXd dVec;
/**
* \brief bad parameter exception
*/
class OutputConnectorBadParamException : public std::exception
{
public:
OutputConnectorBadParamException(const std::string &s)
:_s(s) {}
~OutputConnectorBadParamException() {}
const char* what() const noexcept { return _s.c_str(); }
private:
std::string _s;
};
/**
* \brief internal error exception
*/
class OutputConnectorInternalException : public std::exception
{
public:
OutputConnectorInternalException(const std::string &s)
:_s(s) {}
~OutputConnectorInternalException() {}
const char* what() const noexcept { return _s.c_str(); }
private:
std::string _s;
};
/**
* \brief main output connector class
*/
class OutputConnectorStrategy
{
public:
OutputConnectorStrategy() {}
~OutputConnectorStrategy() {}
/**
* \brief output data reading
*/
//int transform() { return 1; }
/**
* \brief initialization of output data connector
* @param ad data object for "parameters/output"
*/
void init(const APIData &ad);
/**
* \brief add prediction result to connector output
* @param vrad vector of data objects
*/
void add_results(const std::vector<APIData> &vrad);
/**
* \brief finalize output connector data
* @param ad_in data output object from the API call
* @param ad_out data object as the call response
*/
void finalize(const APIData &ad_in, APIData &ad_out);
};
/**
* \brief no output connector class
*/
class NoOutputConn : public OutputConnectorStrategy
{
public:
NoOutputConn()
:OutputConnectorStrategy() {}
~NoOutputConn() {}
};
}
#include "supervisedoutputconnector.h"
#include "unsupervisedoutputconnector.h"
#endif