Created a class to allow easy access to all the fitlers
This commit is contained in:
parent
291e08b604
commit
6ef1a50f24
|
@ -41,3 +41,5 @@ const std::map<std::string,filterpair> makeFilterMap()
|
||||||
InsertFilter("sdlStretch3x",sdlStretch3x,sdlStretch3x);
|
InsertFilter("sdlStretch3x",sdlStretch3x,sdlStretch3x);
|
||||||
InsertFilter("sdlStretch4x",sdlStretch4x,sdlStretch4x);
|
InsertFilter("sdlStretch4x",sdlStretch4x,sdlStretch4x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::map<std::string,filterpair> filters::filterMap = makeFilterMap();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "interframe.hpp"
|
#include "interframe.hpp"
|
||||||
#include "../common/Types.h"
|
#include "../common/Types.h"
|
||||||
|
@ -15,11 +16,33 @@ typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int);
|
||||||
typedef std::pair<FilterFunc,FilterFunc> filterpair;
|
typedef std::pair<FilterFunc,FilterFunc> filterpair;
|
||||||
typedef std::pair<std::string,filterpair> namedfilter;
|
typedef std::pair<std::string,filterpair> namedfilter;
|
||||||
|
|
||||||
//Function to make the filterMap
|
///A class allowing for easy access to all the filters
|
||||||
const std::map<std::string,filterpair> makeFilterMap();
|
class filters {
|
||||||
|
private:
|
||||||
//A named map of all the filters
|
//A named map of all the filters
|
||||||
// static const std::map<std::string,filterpair> filterMap = makeFilterMap();
|
static const std::map<std::string,filterpair> filterMap;
|
||||||
|
public:
|
||||||
|
///Returns a function pointer to a 32 bit filter
|
||||||
|
FilterFunc GetFilter(std::string filterName)
|
||||||
|
{
|
||||||
|
std::map<std::string,filterpair>::const_iterator found = filterMap.find(filterName);
|
||||||
|
if(found == filterMap.end()){
|
||||||
|
throw std::runtime_error("ERROR: Filter not found!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return found->second.first;
|
||||||
|
};
|
||||||
|
///Returns a function pointer to a 16 bit filter
|
||||||
|
FilterFunc GetFilter16(std::string filterName)
|
||||||
|
{
|
||||||
|
std::map<std::string,filterpair>::const_iterator found = filterMap.find(filterName);
|
||||||
|
if(found == filterMap.end()){
|
||||||
|
throw std::runtime_error("ERROR: Filter not found!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return found->second.second;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
//These are the available filters
|
//These are the available filters
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue