I am currently trying to implement a system in which I have a general Effect base class which will be inherited by all effects. This Effect Class is a ReferenceCountedObject. There exists an array of all Effect Classes which my SoundSources send samples to. I would like to be able to do a dynamic_cast down to the actual implementing class in some cases that may require specific interaction between a source and effect. Whenever I do this I get an error
for (auto proc : eprocessor)
{
if(proc->getType() == EffectType::EffectBlendronic)
{
if (proc->getId() == Id) return dynamic_cast<BlendronicProcessor::Ptr>(proc);
}
}
Invalid target type 'BlendronicProcessor::Ptr' (aka 'ReferenceCountedObjectPtr<EffectProcessor>') for dynamic_cast; target type must be a reference or pointer type to a defined class
I understand that it is saying that since the BlendronicProcessor doesn’t directly implement the ReferenceCountedObjectPtr stuff (it only derives from a class which does so) whenever I class BlendronicProcessor::Ptr it is actually an alias to the typedef from the base class. So I guess my question is how would I make the distinction and actually downcast to the specific type of Effect would I am interested in