~uriboni/+junk/filters

« back to all changes in this revision

Viewing changes to backend/modules/Filters/generatorhelperregistry.h

  • Committer: Florian Boucault
  • Date: 2015-02-23 14:11:31 UTC
  • Revision ID: florian.boucault@canonical.com-20150223141131-saclg8xjddfxvut3
Simplified generator registry

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef GENERATORHELPERREGISTRY_H
2
 
#define GENERATORHELPERREGISTRY_H
3
 
 
4
 
#include <QSize>
5
 
#include <QPoint>
6
 
#include <QMap>
7
 
#include <QObject>
8
 
#include <QString>
9
 
 
10
 
#include <Halide.h>
11
 
 
12
 
typedef QRect (*calculateOutputAndMinFunction)(Halide::Internal::GeneratorBase*);
13
 
 
14
 
class GeneratorHelperRegistry
15
 
{
16
 
public:
17
 
    static GeneratorHelperRegistry* instance() {
18
 
        static GeneratorHelperRegistry* singleton = new GeneratorHelperRegistry();
19
 
        return singleton;
20
 
    }
21
 
 
22
 
    void add(Halide::Internal::GeneratorBase* key, calculateOutputAndMinFunction val) { m_helperMap[key] = val; }
23
 
    calculateOutputAndMinFunction get(Halide::Internal::GeneratorBase* key) { return m_helperMap[key]; }
24
 
 
25
 
private:
26
 
    GeneratorHelperRegistry() {}
27
 
 
28
 
    QMap<Halide::Internal::GeneratorBase*, calculateOutputAndMinFunction> m_helperMap;
29
 
};
30
 
 
31
 
#endif // GENERATORHELPERREGISTRY_H