blob: e8fb683c2bd76539fa2d46ce0d799607b92394bd (
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 For : public GenLoader<Impl, Params...> {
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
|