blob: 4208f40bed9e123ca24a3ddae8e123403e9d45fa (
plain)
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
|
#ifndef GENLOADER_H
#define GENLOADER_H
#include "componentLoader.h"
#include "plugable.h"
template <class Impl, typename... Params>
class GenLoader : public ComponentLoader {
public:
template <class T, class BaseLoader = GenLoader<Impl, Params...>>
class For : public BaseLoader {
public:
inline Impl * create(const Params & ... p) const
{
return new T(p...);
}
};
virtual Impl * create(const Params & ...) const = 0;
inline static Impl * createNew(const std::string & n, const Params & ... p)
{
return Plugable::getLoader<GenLoader<Impl, Params...>, NotSupported>(n)->create(p...);
}
inline static boost::shared_ptr<GenLoader<Impl, Params...>> getFor(const std::string & n)
{
return Plugable::getLoader<GenLoader<Impl, Params...>, NotSupported>(n);
}
};
#endif
|