I have a Client class, and an abstract Algorithm class, with multiple derived Algorithm classes / actual implementations AlgorithmOne and AlgorithmTwo.
I create the client from the main class via a helper class in which I do
Ptr<Application> app = m_factory.Create<TcpStreamClient> ();
and in the TcpStreamClient class I do in the constructor:
Ptr<AlgorithmOne> algoOne = CreateObject<AlgorithmOne>(a, b, c, d);
Note: I want to create the AlgoOne, AlgoTwo, etc... object inside the Client, since the client has to compute a, b, c, d first.
But now I want the client's constructor to be generic, so that I can be able to do something like
template <typename T> TcpStreamClient::TcpStreamClient ()
{
Ptr<T> algo = CreateObject<T>(a,b,c,d);
}
and the before mentioned helper class I can do something like
Ptr<Application> app = m_factory.Create<TcpStreamClient<AlgorithmOne>> ();
which is of course obviously doesn't work that way, wrong syntax, etc.
I hope you know what I'm trying to achieve and can help me.