forked from mblum/libgp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcov_factory.h
46 lines (35 loc) · 1.17 KB
/
cov_factory.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
// libgp - Gaussian process library for Machine Learning
// Copyright (c) 2013, Manuel Blum <[email protected]>
// All rights reserved.
#ifndef __COV_FACTORY_H__
#define __COV_FACTORY_H__
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include "cov.h"
namespace libgp {
template <typename ClassName> CovarianceFunction * create_func()
{
return new ClassName();
}
/** Factory class for generating instances of CovarianceFunction.
* @author Manuel Blum */
class CovFactory
{
public:
CovFactory ();
virtual ~CovFactory ();
/** Create an instance of CovarianceFunction.
* @param input_dim input vector dimensionality
* @param key string representation of covariance function
* @return instance of CovarianceFunction */
libgp::CovarianceFunction* create(size_t input_dim, const std::string key);
/** Returns a string vector of available covariance functions. */
std::vector<std::string> list();
private:
typedef CovarianceFunction*(*create_func_def)();
std::map<std::string , CovFactory::create_func_def> registry;
};
}
#endif /* __COV_FACTORY_H__ */