Sorry if the title is too generic but I do not know how to phrase it differently. Here is my issue:
The goal is to have wrapper classes in order to use different libraries with the same generic API. I have an abstract class which define all kind of computations possible. Then, I have several child class which implement this computations using different library (one class only use one specific library).
There is one argument given to a lot of this classes methods which is an Eigen::VectorXd, now for one of the library this vector need to be arranged differently than with the others.
So basically for one of the child class I will need to write something like this in a lot of methods:
void ChildB::computeXXXX(const Eigen::VectorXd &A, unsigned int b,const Eigen::Vector3d &c)
{
const Eigen::VectorXd A_formatB = convertToChildB(A);
libraryB::computeXXX(A_formatB, b, c)
// do stuff
//....
}
It also get a little tricky when this argument is passed to other methods of the class from inside the class, I need to take care of always using the good format. As you can see, my naive solution could lead to a lot of mistakes and headaches. So my question is: is there a smart/automatic way to do this ? Like for all call to libraryB::something I want the argument named "A" (it is always the same name) to be re arranged before.