iVS3D v2.0.0
Loading...
Searching...
No Matches
readerfactory.h
1#ifndef READERFACTORY_H
2#define READERFACTORY_H
3
4#include "reader.h"
5#include "readerparams.h"
6
7typedef std::function<Reader *(QString path, std::shared_ptr<ReaderParams> params)> AbstractReader;
8
10{
11public:
12
13 static ReaderFactory &instance(){
14 static ReaderFactory INSTANCE;
15 return INSTANCE;
16 }
17
18 Reader* createReader(QString path, std::shared_ptr<ReaderParams> params);
19
20 bool reg(std::string name, AbstractReader builder);
21
22private:
23 std::map<std::string, AbstractReader> m_availablerReader;
25
26};
27
28template<typename Implementation>
29Reader *builder(QString path, std::shared_ptr<ReaderParams> params){
30 return new Implementation(path, params);
31}
32
33#define REGISTER_READER(name, impl) const bool res = ReaderFactory::instance().reg(name, builder<impl>);
34
35
36#endif // READERFACTORY_H
Definition readerfactory.h:10
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23