Sorry if this is hard to understand what I'm trying to do here, but, I do not know how to approach this.
I am using method overloading in my constructors of a class, and I have multiple "Window" functions which are all classes that can be used and I need to initialise an object of one of these classes depending on which is passed through. For example:
I have an enum
which stores the types of Windows available:
enum WindowType {
Barlett = 0,
Blackman = 1,
Hamming = 2,
Hanning = 3,
Nuttall = 4,
};
And inside my class I have the following:
template<typename Inverse>
STFT(Inverse begin, Inverse end, size_t x, size_t y, WindowType type)
{
switch(type)
{
case 0:
// I need to initialise an object, in this case "Barlett"
// Window::Barlett barlett(100); // e.g.
break;
// etc..
}
}
The only problem is that: What if I need to pass this to another method inside a class? For example:
Transform(std::vector<double> &values, Window& {?});
My theory was to use an associative way, and, store it in the class members and use a template, like so:
template<typename T>
Window T;
But this, obviously would not work.
Does anyone have any suggestions to how to approach this?
EDIT:
I realise at main I could initialise which window I want to use and then pass it through to the constructor, however, I just wanted to see if there are any alternatives to the way I'm currently wanting to implement this. My main currently looks like:
STFT frquency(
// Data
std::begin(signal),
std::end(signal),
// Sizes
100,
256,
Window::Hanning
);