I have written a class that reads in data from external files, manipulates the data, and then does a calculation.
The class is very long, particularly the constructor. This is where I read in data from external files and manipulate it in preparation for the calculation. I use template functions to do this.
I know that it would be better style to split the class up, but I am using it in combination with commercial code that I can't change. Also, people who will need to use the code need it to be one class + auxiliary files, so I'm restricted to this one class. To make the code more readable, I would like to store some of the code from the constructor in helper .cpp/.h files called "auxiliary.h/.cpp" and access it through functions.
Here's the problem:
1) Passing the template functions (member functions of the class) as function arguments to the auxiliary files. I can't do this, although I have heard it might be possible through something called "disambiguation." It is no problem to pass non-template functions and vectors and things like that... The template functions are the problem.
2) Also, even if I could pass the template functions as arguments to the functions that access the auxiliary files, my argument lists end up very long.
What I would like to know is, is there some way to make the auxiliary files "see" the class? I tried passing an INSTANCE of the class as an argument/parameter in each function that does stuff in the auxiliary files. But this results in "instanceName not declared in this scope" and it does seem like a rather circular/convoluted approach.
Any advice would be very appreciated. Thanks.
You can probably make a template helper class instead of helper functions, passing a pointer to your first (the big one) class to it ?